On Thu, Jan 27, 2011 at 2:56 AM, John Hodrien <J.H.Hodrien at leeds.ac.uk> wrote: > On Thu, 27 Jan 2011, Always Learning wrote: > >> Thanks for the explanation. Now I know why locate never usually worked >> for me - it hadn't updated. >> >> find is fast, especially when I restrict the search paths. > > But locate is faster still, in all but the smallest of cases. I'd only tend > to use find if I had reason to think that changes had made the locate database > invalid. locate with a regexp is plain good and fast. Yeah, way back in yesteryear under UNIX, the "find" and the "locate" tools were part of one package. Under RHEL/CentOS, locate is in the "mlocate" package, and some folks making stripped servers rip it out to avoid storing the database. (Think embedded OS's and NFS hosted / and /var partitions.) One *does* have to remember the "mlocate" package's limitations. It doesn't browse network mounted directories, it doesn't browse /tmp or look for other excluded targets, and it runs with the nightly cron jobs. So if you're looking for files in /var/tmp/ or an NFS share, or files that were created an hour ago, well, it's back to "find". I have found it very useful, when checking updates on a machine, to become root and run the "updatedb" command to get the mlocate database updated.