[PLUG] Locate v. find

frankhunt fh-linux at frankhunt.com
Mon Nov 29 14:38:49 UTC 2010


As usual, especially in Linux, "it depends" . . .

whereis: will search only particular paths to find binaries and or 
manpages.

locate: locate uses a database created by updatedb to efficiently locate 
files. Works great, assuming your database is updated often enough.  
updatedb usually runs daily via cron but can be run manually from the 
command line.

find*:* find is a powerful, general purpose search command. For just 
locating a file/program of a particular name, it'll definitely be slower 
than locate or whereis because it will search each and every path 
recursively from it's start point.

Of course, in all cases RTFM.



On 11/29/2010 06:03 AM, Rich Shepard wrote:
> On Sun, 28 Nov 2010, Rogan Creswick wrote:
>
>> If you need to find things often, you're probably better served by running
>> updatedb more frequently.  I often 'sudo updatedb', grab a coffee, and
>> come back to run locate. (well, I do this less often than I drink coffee
>> :).  For me, updatedb is a 5-10 min operation.  Find will do roughly the
>> same thing, but find's results aren't as easily reusable (unless you're
>> really thinking ahead, and really know find).
>     One can also edit /etc/syslog.conf so that slocate runs each day. Then the
> database is current (as of the night before) and locate, in my experience,
> returns results much more quickly than does find becuase it's a database
> lookup using an index rather than a file-by-file search across all
> partitions.
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>

-- 
frank hunt
(L0F) R0B-ZAR1
befuddled linux admin
erstwhile photographer
hillsboro oregon




More information about the PLUG mailing list