Subject: Re: find command. Newbie question..
To: Alfredo Estuar , <netbsd-help@netbsd.org>
From: Richard Rauch <rauch@rice.edu>
List: netbsd-help
Date: 06/04/2002 05:46:26
Re. http://mail-index.netbsd.org/netbsd-help/2002/06/03/0002.html

Try ``locate <filename>'' if you know the name of the file.

If you want to use a regular expression, you can try:

     locate '*' | grep -E '<regular expression>'

(Locate does some pattern matching on its own, but it doesn't support
grep's regular expression syntax.  It only does ``globbing'' type
matches.)

...this assumes that you have allowed your system to build its locate
database.  (When the system ships/installs, you don't have a locate
database.  Normally it's generated by the weekly system script.  But if
you don't run your system more or less continuously, you may have to
manually invoke the weekly script to get the database generated.)


find(1) is rather more capable, but the downside is that it's slow.  It
actually *reads* the filesystem.  locate uses a pre-generated list of
filenames and searches out pattern matches.  So, if you're searching only
by filename, locate is probably a *much* better choice.


  ``I probably don't know what I'm talking about.'' --rauch@math.rice.edu