↑ ↓ select, Enter open, Esc close

Search for text in all files of a directory

Adjust the values, the command updates live
user@server
grep -rnI --include='*.php' 'base64_decode' /var/www/vhosts/example.com/httpdocs

Searches 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

Related one-liners

All in Filesystem

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.