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 {} \;


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 Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: