Handling bash shell history

This might be a little OT for all of you, but it’s an interesting piece nonetheless. Allan Odgaard of TextMate put together an interesting little piece about the bash shell history system including how to remove duplicates from the history and how to access a command by event number rather than scrolling back through your history with the arrow keys. The first step in making a great history file is adding:

export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend

to .bash_login in your home directory. You can then search your history by typing “history|grep [search term]” and then run the command by typing “![transaction number].” Sorry. The nerd in me got excited by this. Feel free to carry on.