Know something we should know? E-mail us your tips! We respect anonymity. »
Handling bash shell history
  • 1 Comment
by John Biggs on July 1, 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.

Comments rss icon

  • If all you want to do with the history look up is rerun an earlier command, than Ctrl+Shift+R is probably more useful then the silly history grep maneuver.

Leave Comment

Commenting Options

Enter your personal information to the left, or sign in with your Facebook account by clicking the button below.

Alternatively, you can create an avatar that will appear whenever you leave a comment on a Gravatar-enabled blog.

bugbugbug