Searching for text in directories

To find which pure text files contains a given text from the command line, this is the proper command:

grep -ilr "pattern" directory

The -i option makes the search case-insensitive, -r searches the pattern recursively (that is, in the subdirectories that the actual directory might contain), and -l shows the file list where the pattern occurs.

Thanks to Juan Luis Belmonte for the tip (credit where credit is due).

Posted in Personal technotes. Comments Off