Search for text in all files of a directory
find which file contains text linux | grep recursive search string | search file contents | search php files for function | grep | searchgrep -rnI --include='*.php' 'base64_decode' /var/www/vhosts/example.com/httpdocsSearches recursively in all files whose name matches the pattern and prints file path, line number and line of every match. -I skips binary files. Typical for finding a configuration option, an old domain or suspicious code.
Note: The search term is a regular expression. Add -F to match characters like ( or . literally, and -l to list only file names instead of lines.
Also searched as
- find which file contains text linux
- grep recursive search string
- search file contents
- search php files for function