Skip navigation

Want to Grep through the files of a directory and sub directories recursively?


find /your/path/here -name \*php -exec grep "text your searching for here" {} \; -exec ls -l {} \;

Explained:

find /your/path/here

(the beginning path)

-name \*php

(All files that end in php)

-exec grep “text your searching for here” {} \;

(For each php file found grep through looking for “text your searching for here” then echo the line)

-exec ls -l {} \;

(Echo the full location of the file)

One Comment

  1. Grep actually provides a recursive option to accomplish the same thing much easier

    grep -R “test your searching for” /your/path/here

    That should save you a few keystrokes


Leave a comment