Linux: Find Files Containing a Specific String

To find files containing a specific text string…

grep -inr "STRING" /PATH/TO/THE/DIRECTORY

where:
-i ignores the case distinctions in both the PATTERN and the input files,
-n prefixes each line of output with the 1-based line number within its input file,
-r reads all files under each directory, recursively, following symbolic links only if they are on the command line.

That’s it.

Advertisements
This entry was posted in Linux, Server and tagged , , , , . Bookmark the permalink.