Linux Search text in files: grep
Search the console for the contents of specific files.
Search all files
The following command searches the contents of all files including files in subfolders:
grep -r SEARCHSTRING *
Search specific files
The following command searches the contents of all files with extension .php incl. files in the subfolders
find . -name *.php -exec grep -l SEARCHSTRING {} \;
Search specific files in specific folders
The following command searches the contents of all files with extension .php in folders that contain test in their name
find . -path *test* -name *.php -exec grep -l SEARCHSTRING {} \;

{{percentage}} % positive

THANK YOU for your review!
created by Bernhard
| published: 2022-07-13
| Updated: 2022-07-13 |
Übersetzung Deutsch
|🔔
| Comments:0