Saturday, 30 April 2011

Reverse Incremental Search in Bash

I learned a new trick this week. Reverse incremental search through bash history using the up key. This blog post outlines it nicely:

Using these bindings, I can type 'git', then hit the up-arrow to search back through all the recent git commands I've used. This is a really quick way to improve productivity at the command line.

For future reference, just in case the above linked blog entry disappears.

In ~/.inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
In ~/.bashrc:
export HISTSIZE=1000000
export HISTFILESIZE=1000000000

1 comment:

  1. Thanks for posting this! I was able to find it on google more easily than the original post :)