Linux - Find files having a specific keyword, Search files with specific keyword

Find files having a specific keyword

While you are using LINUX as a development server you will might come across in such a situation and alter or modify files which has a specific keyword. In such situation you can use the below commands to find out the files which has a specific word or keyword.

 # find / -name \*.cpp -exec grep -q "variable_name" '{}' \; -print

 # find / -name \*.cpp -print -exec grep -q "variable_name" '{}' \;

The above code will search for the keyword called variable in all files with cpp extension.

The topic on Linux - Find files having a specific keyword is posted by - Math

Hope you have enjoyed, Linux - Find files having a specific keywordThanks for your time

Tech Bluff