Linux - Howto find files specific text string, Search for a particular word in all files

Howto find files specific text string

Today I had a requirement to search for a string in all the files which has particular word or text. You can find or search for the string in linux machine as below.

To find the string in all directories
 # find / -name \"*.*\" | xargs grep -i \'find string\'

To serach for a word in all directories
 # grep -r \"search word\" /home/tom

Search Particular word in all files
 # grep \"search word\" /home/math/*.txt

List file names which search word or string
 # grep -H -r \'find word\' /home/math

 # grep -lr particular word\' /home/math

 # find . -type f -print -exec grep -inH \'search string\' {} \\;
Get rid of errors during your search
 # find . -type f -exec grep -i \'specific word\' {} \\; -print 2>/dev/null

The topic on Linux - Howto find files specific text string is posted by - Math

Hope you have enjoyed, Linux - Howto find files specific text stringThanks for your time

Tech Bluff