Wednesday, May 2, 2012

Reverse search for a previous command on Linux

Use CTRL-r to reverse search through a history of your previous commands executed in Linux e.g.
$(reverse-i-search)`':

Type in the text for a command you are searching for e.g. 'cat'
$(reverse-i-search)`cat': cat test.txt

In this case the last command executed with the substring 'cat' is 'cat test.txt'.

To exit the reverse search just use CTRL-g.

No comments:

Post a Comment