Monday, September 16, 2013

Shell history search

Found at http://lifehacker.com/supercharge-your-command-lines-history-search-with-fou-478683529
I have found this to be very useful. 
create file ~/.inputrc and add these lines:

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

This will make it so that when you use the up arrow to go through your search history, if you have anything already typed, it will only search anything with that term. e.g. if you want to run a sudo command from before you can type sudo, then use the up arrow to search commands that were run with sudo.

No comments:

Post a Comment