Recently I came across the command Ctrl-R in the bash shell. It allows you to search and browse your bash history.
For instance you ssh into your server every day, in between each ssh you do a bunch of other things, this makes in impractical to use the Up arrow key to go through your history to find the command. Instead hit
Ctrl-R, and start typing ss, it will search your bash history for the last time you used a command with ss in it:
(reverse-i-search)`ss': ssh foo.servername.com
You hit ‘Enter’ and the line will be executed.
If you hit
Ctrl-R again in will go back again in your history to the previous time you used a line with ss in it such as:
(reverse-i-search)`ss': vim /etc/ssh/sshd_config
If you wish to change your search parameters just hit the backspace key and write your new search, e.g.
(reverse-i-search)`sc': screen -r
I hope this helps people who’ve become annoyed with hitting the Up arrow all the time to get at yesterday’s command!