Sep 09

How to Find Commands in Your Bash History

by in Linux, Techie :: Techno ::, Ubuntu

One of the things that drives me mad is typing long commands or sequences that I need to type over and over again.

Luckily there is a way to search your previous commands in bash.

Simply type CTRL R and you will get a new command prompt. Then start typing part of the command.
To keep looking back through other instances of the command just keep hitting CTRL R.
Once you’ve found the line you want a simple “arrow up” or similar will get you back to your normal command prompt.

Thanks to Paul / Niall for the tip.

Related Posts:

Tags: , , , , , , , ,

2 Responses to “How to Find Commands in Your Bash History”

  1. From Paul Browne - Technology and People:

    Uber Techie , but very useful. It also works on Cygwin (Linux Console for Windows).
    Been wondering how to do this for a while now …
    Paul

    Posted on September 13, 2007 at 1:49 pm #
  2. From Michele Neylon:

    Paul
    I use that command all the time :)
    All my personal domains are hosted on servers without any control interfaces apart from SSH. I used to rely on grepping .bash_history until someone showed me this really cool solution :)
    Michele

    Posted on September 13, 2007 at 2:51 pm #