Showing posts with label history. Show all posts
Showing posts with label history. Show all posts

Friday, March 2, 2012

Important history options to be placed in .bashrc

Configuring the command-line history options in .bash_login (or .bashrc) is really useful. The following is a cadre of settings that I use on my Macbook Pro.
Setting the following makes bash erase duplicate commands in your history
export HISTCONTROL="erasedups:ignoreboth"
I also jack my history size up pretty high too.
export HISTFILESIZE=500000 export HISTSIZE=100000
Another thing that I do is ignore some commands from my history. No need to remember the exit command.
export HISTIGNORE="&:[ ]*:exit"
You definitely want to set histappend. Otherwise, bash overwrites your history when you exit.
shopt -s histappend
Another option that I use is cmdhist. This lets you save multi-line commands to the history as one command.
shopt -s cmdhist