Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Aug 1997 15:11:40 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Online Impressions <oli@olim.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: How to find a file..
Message-ID:  <19970817151140.37942@lemis.com>
In-Reply-To: <3.0.32.19970816222229.0068c174@mail.deltanet.com>; from Online Impressions on Sat, Aug 16, 1997 at 10:22:37PM -0700
References:  <3.0.32.19970816222229.0068c174@mail.deltanet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 16, 1997 at 10:22:37PM -0700, Online Impressions wrote:
>
> Is there a command that will tell me if a file exists and if so where it
> can be found?

Yes.

> I have been using "ls -R |grep filename" to determine if a file
> exists but the trouble is if it does this command fails to tell me
> where it is.

It's also not exactly fast.

If you're looking for an executable, 'which' should tell you where it
is.  Otherwise, use 'locate'.  By default, the locate database is
rebuilt every week with the cron job /etc/weekly, so if you turn your
machine off at night it won't get updated.  Look in /etc/weekly to see
how to rebuild it manually.

Greg



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