While using Babun (a windows shell) sometimes I need to retype a previous command, so i just use the up/down arrow keys to navigate the commands. This is a nice feature, but what about retyping a command that you have used long time ago? no need to keep pushing the arrow keys to get it, just use this quick keyboard shortcut to search through previous commands:
- Open your shell and press
ctrl + r
- Start typing a command
- You will have some suggestions
- Type again
ctrl + rto narrow the suggestions
This is called reverse-i-search and it is available in terminal and bach etc.
Press Ctrl+R and type
ssh. Ctrl+R will start search from most recent command to old one (reverse-search). If you have more than one command which starts with
ssh, Press Ctrl+Ragain and again until you find the match.
Once you’ve found the match you can press Enter to execute the command or left / right cursor to just select the text of the command.
There is no default reverse option for Ctrl+R to invert the direction of the search but here you will find some suggestions about it.