The history command has only 10 commands, more linux like please?

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
How can I change the behaviour of the history command so it will show me much much much more history and I can search it using | grep?
All the stuff I've learnt over the years, but use infrequently, is buried in commands which could save me making forum posts.
How do I adjust this default behaviour to show significantly more information?
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
What version of FreeNAS are you using?
Code:
[root@fn_11.2-u8] ~# history | wc -l
    1000

[root@fn_11.3-u5] ~# history | wc -l
    1000
[root@fn_11.3-u5] ~# set| grep hist
history	1000
savehist	(1000 merge)

I did not change anything in the defaults.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
I have 12 RC1


root@freenas[~]# history | wc -l
16


root@freenas[~]# set | grep hist
HISTFILE=/root/.zsh-histfile
histchars='!^#'
history
historywords
root@freenas[~]#


NOTE! USB User, happy to locate histfile elsewhere if needed
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
OK, I see, you should update your footer.

So it looks like this changed due to the switch from csh to zsh. Please note that the history command works different in zsh compared to tcsh or bash.

history lists only the 15 most recent history entries.
history 1 lists all.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
How does one update the footer?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,681
How can I change the behaviour of the history command so it will show me much much much more history and I can search it using | grep?
All the stuff I've learnt over the years, but use infrequently, is buried in commands which could save me making forum posts.
How do I adjust this default behaviour to show significantly more information?

Please note that history isn't an actual command, and is a shell built-in (if it exists at all). The way history behaves - including whether or not you can grep through it, the number of entries retained within a session, the number of entries retained between sessions, etc. - is entirely dependent on how the shell chooses to implement it. The retention of history is typically controlled by variables, if supported.

Shells do not use a uniform style for their rc (run commands). For example, csh/tcsh might want to see

set history = 1000 savehist = 1000

in .cshrc, while /bin/sh uses HISTSIZE in the environment. I don't recall what zsh wants offhand.

And this has nothing to do with being "linux like". Linux uses the same selection of shells and you are just as welcome to set your dotfiles there to have, or not have, a large history.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
I typed "history 1" and only got 20 results.
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
Check the values of HISTFILE HISTSIZE SAVEHIST, all documented in the corresponding manpages. man zsh, man zshparam.
 
Top