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 {} \;
positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details