Grep whole directory recursively by file extension only

Using grep to scan thru a whole directory recursively is done with:

grep -R 'string' dir/

In addition, you can also tell grep to only scan files that have a certain extension (or pattern, for that matter):

grep -R 'string' --include *.cpp dir/

 

About the author

Gábor Hargitai

View all posts