Finding files containing 'string'

Paul Howarth paul at city-fan.org
Wed Feb 1 16:58:09 UTC 2006


Anne Wilson wrote:
> I need to list all files that refer to my network-name, but I can't work 
> out a command to do it.  I thought I would have to cat everything, 
> piping through grep 'string', but that doesn't search recursively, the 
> help-file doesn't show a recursive flag, and I'm not sure that it would 
> actually give me the filenames anyway.

For a multitude of different ways of doing this, check out the thread 
from last month where the same question was asked:

http://www.redhat.com/archives/fedora-list/2006-January/msg02876.html

My personal favourite solution for this problem:

$ grep -i -r -l 'string' /place/to.start/searching

This would have been much easier to find in the archives if the OP from 
last month had used a sensible Subject: and hadn't hijacked another 
thread of course.

Paul.




More information about the users mailing list