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 {} \;
![rate this post positively positive Bewertung](/images/pro.gif)
{{percentage}} % positive
![rate this article negatively negative Bewertung](/images/con.gif)