Handling bash shell history

John Biggs

Biggs is the East Coast Editor of TechCrunch. Biggs has written for the New York Times, InSync, USA Weekend, Popular Mechanics, Popular Science, Money and a number of other outlets on technology and wristwatches. He is the former editor-in-chief of Gizmodo.com and lives in Bay Ridge, Brooklyn. You can Tweet him here and G+ him here. Email him directly at... → Learn More

Tuesday, July 1st, 2008

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.

blog comments powered by Disqus