In the terminal, I can type CRTL+R
to search for a matching command previously typed in BASH. E.g., if I type CTRL+R
then grep
is lists my last grep
command, and I can hit enter to use it. This only gives one suggestion though. Is there any way to cycle through other previously typed matching commands?
|
||||
If I understand the question correctly you should be able to cycle trough alternatives by keep hitting Ctrl+R. E.g.: Ctrl+R
|
|||||
|
You can also set up the up and down arrows to do a slightly different search by adding these lines to ~/.inputrc:
Instead of searching for a substring anywhere in the command (like Ctrl-r) it will search for a command starting with the text to the left of the cursor. For example, if I run these commands:
then type These approaches both have their strengths, and both of them can save a lot of time. |
|||
|
Ctrl+R
. – Sukminder Apr 24 at 2:10