Tip #743   Grep for word in directory

I've often seen people using the find command on a directory to get all the files, then using these with grep to find files containing a particular word. This can however, be done better just using grep:

grep --color=auto -inHR "search_for" /in/dir

greps for occurances of 'search_for' in the specified directory and below, or the current directory if none specified.


-i case insensitive
-n shows line number
-H shows file name
-R recursive