Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Nov 092010
 

Only show filenames in grep command

Answer:

Sometimes you want the grep command only return the filenames that matched a pattern, you can try the following:

# grep -r -l "foo" .

The key is the -l option.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>