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 comment to HowTo: Find Recently Used Commands in Linux

  • Allan

    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

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>