How to Find Commands in Your Bash History

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.

By Michele Neylon

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight.

2 comments

  1. 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

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version