Finding files containing 'string'

CodeHeads ch at code-heads.com
Wed Feb 1 20:41:24 UTC 2006


On Wed, 2006-02-01 at 11:46 -0500, Robert P. J. Day wrote:
> On Wed, 1 Feb 2006, fredex wrote:
> 
> > On Wed, Feb 01, 2006 at 04:42:19PM +0000, 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.
> > >
> > > Help, please?
> > >
> > > Anne
> > > --
> > > Registered Linux User No.293302 (http://counter.li.org/)
> >
> > Do this as root.
> >
> > To see a list of filenames containing the target string:
> >
> > find / -name \* -exec grep -l 'put your string here' {} \;
> >
> > if you want to see the actual file content containing the string, simply
> > remove the -l option from grep.
> 
> "grep" works recursively, you know.
> 
> rday
> 

How about this:

$du -a <PATH> | grep <FILE>

This works well for me.
-- 
Best regards,
~WILL~
Public Key: 0xC8E166BB
Key: http://code-heads.com/keys/ch1.asc
Linux Registered User: 406084
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20060201/e50aa8f4/attachment-0001.sig>


More information about the fedora-list mailing list