The locate database

December 17th, 2004 by admin

The MacOS X command line has a cool command, called locate, than can be useful when you’re trying to track down some strange unix file by its file name, say maybe you want to know where report.cls is located in your tetex installation, or some iraf source file.

The usage is merely locate filename but you have to have the locate database made first, and this is not done by default. You have to do this:

     sudo /usr/libexec/locate.updatedb

Now you can type locate extern.pkg and behold the results. I imagine Tiger’s spotlight feature will blow this away in the 2nd quarter of 2005, but it’s still handy. You’ll really miss it on other UNIX systems once you get used to using it.

Update Actually, this post was all wrong until recently – the makewhatis command that was mentioned creates the database for man pages. So, you can do a man -k print and get all the unix command line programs that have to do with printing. Also, in Tiger, the locate and makewhatis databases should be updated automatically, via launchd, whether your computer is always on, or goes to sleep, etc. Still, you can use the locate.updatedb at any time, to update it to this very moment.

makewhatis, however is in /usr/libexec just like locate.updatedb

.

Please remember this is the archive of Macsingularity. Comments are no longer supported, and this content and site are no longer updated.


1 Response to “The locate database”

  1. 1

    Handy Hack: Access the ‘locate’ command on OS/X « Alec the Geek

    [...] Hack: Access the ‘locate’ command on OS/X The locate database at Mac Singularity The usage is merely locate filename but you have to have the locate database made first, and this [...]



Bad Behavior has blocked 290 access attempts in the last 7 days.

WP SlimStat