Skip to main content
Welcome guest. | Register | Login | Post


Ctrl-R in the Bash Shell

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

You hit 'Enter' and the line will be executed.

The default shell on most Linux operating systems is called Bash. There are a couple of important hotkeys that you should get familiar with if you plan to spend a lot of time at the command line. These shortcuts will save you a ton of time if you learn them.