Wednesday, September 30, 2009

Linux Find Command find text in files

To find the text "JoomlArt" in all files in all subdirectories under the current dir, use this:

find . -type f -name "*" -exec grep -il JoomlArt {} \;

If you just wanted to search in php file for example, it would be this:

find . -type f -name "*.php" -exec grep -il JoomlArt {} \;

(grep is not needed in these examples)

1 comment:

PablitoRun said...

What!!! I see a grep in both those commands! :)

Just a note in most installations grep -r does what command one does. However, earlier versions of grep did not have the recursive option..