Tag Archives: grep

UNIX find grep

I am always hunting for this, and so I’m going to put it here so I can remember!

This command is great:  find . -exec grep -l hello {} \;

Essentially, it does this:

  1. find all files starting in the current directory (“.”)
  2. for each file found execute “grep -l hello”
  3. grep -l will print file names — with full relative path — that match the grep criteria

This is great, as a programmer, to try and figure out which file had a certain word (or phrase, or Regular Expression pattern) in it.

There are also a couple of other pages with a large set of references here and here.