what is the difference between locate and find ?

Paul Howarth paul at city-fan.org
Tue Nov 8 16:25:07 UTC 2005


M E Fieu wrote:
> Hi.. I tried to look for a file in a linux box using both locate and find , when using find I can
> find my file but locate cannot.  However I found sometime locate will work when I look for other
> file.  what is the difference between locate and find ?
> 
> [root at wa html]# locate abc.pl
> [root at wa html]# find / -name abc.pl -print
> find: /proc/21829/fd: No such file or directory
> /usr/local/abc/abc.pl
> [root at wa html]# 

locate uses a database that is refreshed periodically, whereas find does 
a search on your live filesystem.

So locate is likely to be faster, but find will be more up to date.

Paul.




More information about the users mailing list