Monday, June 30, 2008

bash history hack

History in the bash shell is an awesome thing but .. dayum .. it saves everything. Do you really need every 'clear', 'ls' and 'exit'?

You know you don't.

With this you have a variable that suppresses duplicate commands, 'ls', 'clear' and the shell built-ins bg, fg, and exit:

# cat $HOME/.bash_profile | grep HISTIGNORE
export HISTIGNORE="&:ls:clear:[bf]g:exit"


Isn't that a slick bit of awesome? From 'Using Bash's History Effectively' by Jason Bechtel.
blog comments powered by Disqus