find command to search keyword in files recursively in linux

find command to search keyword in files recursively in linux
Find command is one of the system command which is useful to search files and directory.
It has many used and you can modify your search by using -exec flag. Here I am using exec with grep command.

By below given command you can find the keyword in files in linux system.
(Replace the “keyword” with your searching word)

Here below given flags with grep command have these features
-l will only show file name
-w will look for exact same keyword

Find more keywords by typing command “grep –help”


find / -type f -exec grep "keyword" {} +

or 

find / -type f -exec grep -l "keyword" {} +

eg.

For Exact Pattern of keyword

find / -type f -exec grep -w "keyword" {} +

OR 

find / -type f -exec grep -w -l "keyword" {} +

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.