Better Bash history | Arabesque
By default, the Bash shell keeps the history of your most recent session in the .bash_history
file, and the commands you've issued in your current session are also available with a history
call. These defaults are useful for keeping track of what you've been up to in the shell on any given machine, but with disks much larger and faster than they were when Bash was designed, a little tweaking in your .bashrc
file can record history more permanently, consistently, and usefully.
Append history instead of rewriting it
You should start by setting the histappend
option, which will mean that when you close a session, your history will be appended to the .bash_history
file rather than overwriting what's in there.
shopt -s histappend
Allow a larger history file
The default maximum number of commands saved into the .bash_history
file is a rather meager 500. If you want to keep history further back than a few weeks or so, you may as well bump this up by explicitly setting $HISTSIZE
to a much larger number in your .bashrc
. We can do the same thing with the $HISTFILESIZE
variable.
Read full article from Better Bash history | Arabesque
No comments:
Post a Comment