Control-R Through Your History

Interactively search through your command line history with a simple keyboard shortcut.

method/1491/Screen Shot 2012-04-22 at 15.55.21.png

At a new shell prompt (bash or Terminal.app on Mac) press Ctrl-R

Start typing the search string to lookup in your bash history. As you type the top matching command in your history will appear.

Hit Return to accept the search and execute the matching command or Esc to cancel the search.

You can also hit the right-arrow to edit the command before running it.

Continue reading

Find all files containing a given string  bash

A quick one-liner to recursively search files for a given text string. Open up a terminal session and enter the following - replacing "foo" with the text to search for. find . -exec grep -l "foo" {} \; You can also limit the search to files with a particular extension (e.g. HTML or ... More

Discussion