Searching folder of files for a string

Ill never remember this and its just come in very handy

grep -lr “string” path

-l – this makes it list the filenames where it finds the string
-r – this makes it recursively scan all sub folders

e.g.

grep -lr “/var/www/proj” ./*

This would scan for the string “var/www/prog” in all files/folders starting from the current working directory.

Love linux!

 

http://old.personalprojector.co.uk/catalog/admin/

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s