find . -exec grep -l “string to find” {} \;
OR
find . -exec grep -H “string to find” {} \;
OR
grep -l “string to find” `find .`
OR
grep -H “string to find” `find .`

grep can search through your entire directory tree, scanning every file along the way:

grep -r “modules” .

You can also use grep to search for multiple words:

grep -r “text1\|text2\|text3″ .

In this example, grep will search only file names starting with “log”:
grep -lr “mod.*” ./log*

Search many files for a string. This example finds the string “thingy.” This is useful when I want to find, say, a CSS class name that has changed, and update it in all of my .js, .jsp and .jspf files:

find \( -name “*js” -o -name “*jsp” -o -name “*jspf” \) | xargs grep -niP ‘thingy’

To find for a particular filename use this command:

find . -name “filename” -print

To search the current directory and all subdirectories for a folder or file, use the following command:

find . -name filename

– where filename is the file or folder for which you are looking…

To search one directory all all its subdirectories use the following command:

find foldername -name filename

– where filename is the file or folder for which you are looking and foldername is the folder in which you want to search

To search for one or more strings in one or more files. E.g.

Search for the string ‘searchText’  in all the files in current directory’ and print out each line that matches.

grep “searchText” *.*

Extended grep search all files for ‘search” or ‘Text” case insensitive (-i) and if found display line number (-n) along with the line contents.

egrep -in “search | Text” *.*

Another way to search for a text in files with a particular extension:

find . -name “*.mk” | xargs grep “search.text”