Is it possible when I press Ctrl+r and after this, for example, press the letter a
, then using the up and down arrow key to search only the commands in the history that start with a
? Or if I type ssh
and then use the arrow keys to search commands that start with ssh
.
Is there a script that can implement this?
You can even avoid the need of typing Ctrl+r by adding these two lines to your
~/.inputrc
:Up and down arrows will continue to browse your history if you press them at the bash prompt. But it will search for a command starting with the text to the left of the cursor if you type the beginning of a command like
ssh
.