Last Updated: February 25, 2016
· eriwen

Search history with up/down arrow keys

Add the following to ~/.inputrc to search history by typing the first part of a command and then hitting the up arrow:

"\eOA": history-search-backward
"\e[A": history-search-backward
"\eOB": history-search-forward
"\e[B": history-search-forward

Now if you type, say, git into your terminal in hit the up/down arrows, you will cycle through all of the git commands in your history. This is much easier than history | grep foo. Enjoy!

Say Thanks
Filed Under