FabioRosado
7 months ago

Search previous typed command on terminal

If you press ctrl+r in the terminal you will activate the reverse-i-search. With it, you can search your whole history for a command. If you type very long commands you or if you don't remember the whole command that you typed you can just press ctrl+r and type the bit you remember, the command that matches will show up.

If you want to search it again all you need to do is press ctrl+r again.

Example

Let's say you used the command git rebase -i Head~2 before, but you don't remember what does after git rebase or you just don't feel like typing the whole thing.

Press ctrl+r and then type git re if git rebase -i Head~2 was the last command that you used, it will be shown. Then just press enter to run the command.

Do you have any comment on this tricks? then let the author know about that. comment here