Much smarter command line history up/down behavior - with search
You may know about ctrl+shift+R for reverse case-insensitive search (or whatever it stands for) and that is still useful if you remember one very unique keyword from the middle of a command.
Far more useful, however, is a simple extension to your bash to make command line up (and down) arrow traversing of the command line history restrict its results based on the first letters you type. For instance, type g and press the up arrow then all the grep, gvim, and git commands you have used recently come up, and none of the rake, drush, cd, and ls commands. Type gi or git before using the up arrow or down arrow and you'll have only the git commands you've typed before.
How to set this up in Ubuntu:
sudo vi /etc/inputrc
Then add the following or uncomment/modify existing lines to look like this:
# alternate mappings for "key up" and "key down" to search the history
"\e[A": history-search-backward
"\e[B": history-search-forward
Restart the shell (close remaining windows and open a new one) for this to take effect.
Tip courtesy Stefan.
Comments
Post new comment