Outputting all history
Hi guys. http://www.tldp.org/LDP/GNU-Linux-To...html/x1712.htm says
Quote:
|
Are you using BASH, KornShell or the Z Shell? There is an environment variable you can set for either of those, HISTSIZE; e.g., in your ~/.profile file add
Code:
export HISTSIZE=1000 Don't have a .profile in your home directory? Create one; it's a text file, it should not be executable, just a plain old text file. It is executed once when you log in to set the environment variable (so, you need to log out and log back in again to have it take effect). Hope this helps some. |
The history log file is a rotating buffer of commands. It doesn't hold every command - only the N commands specified by HISTSIZE. I believe the default is 500.
Also note - on login the contents are whatever was in there earlier, so that could include yesterdays entries as well. |
tronayne, I use zsh.
Code:
$ cat ~/.zshrc | head -n 3 |
Quote:
There are two environment variables, COLUMNS and LINES that may or may not be set; those two variables can be used by a number of terminal-type utilities and it doesn't hurt to set them (in .profile or .zsh, which I am not familiar with, at log in: Code:
# Use a common screen size to start Now, we're part way there; set up an alias that will show you a screen-size list of history: Code:
alias hi='history -${LINES}' Want more? Code:
history -250 | pg (or more or less). Hope this helps some. |
Tronayne, thanks for your advices. One more strange thing. "history n" doesn't actually output last n commands. The n here means "since what command to output the list to the last command" as I can understand from the behaviour of my shell. If I type in "history 20" it outputs all commands starting from 20'th command. "history 1", as it turned out, outputs all. Is it normal? Web manuals didn't mention it.
|
That's normal behavior.
On my system (KornShell) Code:
hisotry 1 Code:
history -50 The "trick" is the - in front of the 50. There is a manual page for history, it's a GNU utility (and, of course, has a gazillion options). You might find it interesting. Hope this helps some. |
All times are GMT -5. The time now is 08:30 AM. |