"grep" command in linux can be used to search text in files. We can further tune this command to search text in certain file types only. Let see how to do it.

Search text in files

grep -r "search text" .

Search text in files by type

grep -r --include=" *.php" "search text" .

In the above command,

-r indicates recursive search
--include option to search only files with php extension
. [dot] is given to search in the current directory


Comments (0)
Leave a Comment

loader Posting your comment...