[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Finding files/directory's.
My tuppence: I was very pleased to find "locate" on my SuSE7.3
installation...
luckily, updatedb is in root's crontab and it runs every night so my
locatedb is fairly up-to-date; sometimes I run it on demand if I have a
lot of things to find quickly but I can wait for a while while updatedb
does its stuff.
To search for an exact match with locate, you can do
% locate "*/foo"
(_with_ the quote marks!) and that will do the trick. The man pages
explain that.
Also locate is much faster than find as the index is pre-built. I find
the syntax of find rather strange as well.
Matt.
On Sun, 2003-01-12 at 19:35, Chris J wrote:
>
> >
> > Oddly, some more recent distros (Mdk 9, RedHat 8) do not install locate
> > by default. Also, note that it builds an index
> > (/var/lib/slocate/slocate.db) which may get out of sync between updates,
> > so if you need to find a file or files before the update puts them in
> > the index, you would be better of using find.
> >
>
> Another point, just to expand on the update - even if locate /is/
> installed, the installation may not have put updatedb into root's crontab,
> so the database would never update... :)
>
> locate is also bad as if you know the exact name of a file and type "locate
> foo", it'll return all files that contain foo somewhere within the file
> name, including foo, foobar, barfoo, foobarfoo, and barfoobar. So it isn't
> ideal. It's fine to try and find summat quicker, less ideal if you want to
> script summat.
>
> Chris...
>
> --
> \ Chris Johnson \ NP: - Crazyhouse - Butterfly
> \ cej [at] nightwolf.org.uk ~-----,
> \ http://cej.nightwolf.org.uk/ ~-----------------------------------,
> \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____
>
>
> ___________________________________________________________________
>
> Sheffield Linux User's Group -
> http://www.sheflug.co.uk/mailfaq.html
>
> GNU the choice of a complete generation.
--
== . Matt Fairtlough . +44 (0)114 236 2067 . ==
== . 22 Harley Road . . ==
== . Sheffield, S11 9SE, UK . matt [at] fairtlough.net . ==
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.