Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Feb 2005 09:21:01 -0800
From:      "Loren M. Lang" <lorenl@alzatex.com>
To:        f-q <freebsd-questions@freebsd.org>
Subject:   Re: I killed my system with grep
Message-ID:  <20050227172101.GB1672@alzatex.com>
In-Reply-To: <20050226044248.GA2467@holestein.holy.cow>
References:  <003801c51b2b$1deecc60$04cf589d@simula.eis.uva.es> <20050225135707.GC18789@alzatex.com> <20050226044248.GA2467@holestein.holy.cow>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 25, 2005 at 11:42:48PM -0500, Parv wrote:
> in message <20050225135707.GC18789@alzatex.com>,
> wrote Loren M. Lang thusly...
> >
> > On Fri, Feb 25, 2005 at 12:14:04PM +0100, Ramiro Aceves wrote:
> > > 
> > > I am running a FreeBSD 5.3 system with 64MB RAM and 150 MB swap.
> > > 
> > > Yesterday I entered the command:
> > > 
> > > # grep -R something /
> > 
> > You probably hit a file under /dev/ and caused grep to hang.  It's
> > possible that as root, certain device files might hang the system,
> > but nothing comes to mind at the moment unless /dev/io could do
> > it.  Also, think about what happens when grep hit's /dev/zero.  It
> > will never finish.
> 
> Would using -I option (not search text-like files) help to avoid
> above described hang ups in /dev?

No, it still searches all files, it just doesn't print the usual line
that it matched, only whether there was success or not.  You really just
need to make sure grep never goes into /dev.  Since your running 5.x,
/dev is it's own filesystem of a unique type, so the following command
will run grep on only filesystems of type ufs, which won't include
network filesystems, or /dev:

find / -fstype ufs -exec grep -H something {} \;

> 
> 
>   - Parv
> 
> -- 

-- 
I sense much NT in you.
NT leads to Bluescreen.
Bluescreen leads to downtime.
Downtime leads to suffering.
NT is the path to the darkside.
Powerful Unix is.

Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: B3B9 D669 69C9 09EC 1BCD  835A FAF3 7A46 E4A3 280C
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050227172101.GB1672>