Last Updated: March 08, 2016
· vinitcool76

Find files containing specific pattern among many similar files.

Here is how you can use grep to find to find file which contains the pattern, It is a pretty handy tool if you want to find which file contains the specific pattern. Say i need to find which file contain the word chrome in the file and lets assume its a javascript file that use chrome's API. Finding it is easy.

grep -r 'chrome' *

Use this and you will get all the files containing the word chrome in it. So the general code would be

grep -r '<pattern>' *

where 'pattern' is the word/pattern you are searching. Pretty handy, right!

Say Thanks