Monday, June 17, 2013

Bash history made better

The following can be used to set up a much more useful bash history search. Simple to set up, it basically gives you the "ctrl-r" style command search simply by pressing the up button. 

Eg: Typing $ vim and pressing the up arrow will return all commands that start with vim. So simple, so powerful.

Setup:

$ cd ~
$ touch .inputrc

Add the following to .inputrc

"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on

That's it! Now you have awesome history search.