To grep a string recursively
grep -rin "string" /directory
Add -w flag for a word search
grep -rinw "string" /directory
Add -l flag to list file name only
grep -rinl "string" /directory
number of occurrences per file
grep -rc "string /directory
grep only from certain file extensions
grep -rinl "string" /directory --include=*.php
-r
recursively
-i
ignore-case
-n
print line number
-w
word search
-l
list just the file name
Other options
grep -rnw "searchName" /directory grep -rnw "searchName" /directory | cut -d : -f 1