To look up files recursively in the given directory for the given text, and display the file name with line number that has the matching text.
grep -rHn "text to search" /path/to/dir
To use a search pattern, use the following command:
grep -rHn -e "text pattern to search" /path/to/dir
Args:
r – search recursively
H – display the file name with the matching text
n – display the line number in the file with the matching text