Blog Command Line HowTo Posts

HowTo: Find Recently Used Commands in Linux

One of my most used commands in Linux is the history command, it lists all your recent commands. The problem with this is you might have to scroll through hundreds before you get to one of any interest, so adding grep to search through these and bring back only relative one’s is great.

Give it a try (just change searchcriteria for what you want like apt-get or tar):

history | grep searchcriteria

Manual pages:

1 reply on “HowTo: Find Recently Used Commands in Linux”

You can also press Ctrl+R to perform a “as-you-type” search through your recent commands. A press on the Enter/Return-key will execute the currently displayed command, and a press on the Tab-key will close the search, and put the command on your command-line (just as if you typed it all over again), allowing you to edit it.

Leave a Reply

Your email address will not be published. Required fields are marked *