Welcome to the navigation

Ullamco dolor ea nulla labore commodo amet, dolore ut eu id ipsum consectetur laboris sed deserunt est exercitation occaecat incididunt ad cupidatat dolor laborum, ex. Officia qui lorem quis in consectetur cillum minim dolor exercitation cupidatat veniam, est deserunt fugiat ex et laborum, esse mollit aute anim pariatur, eu id

Yeah, this will be replaced... But please enjoy the search!

Using locate in Mac OS X

Categories Tags
As you might be aware of there is an entire world below the pretty window manager in Mac OS X. It has many names, I usually refer to it as the console. However, finding and managing files in it can be a hassle unless you are aware of a large variety of commands. This guide will describe the 'locate' command.

Locate

The manual sais 'locate -- find filenames quickly' and 'The locate program searches a database for all pathnames which match the specified pattern.' which is very true. Basically locate searches a locally stored database. Default in Mac OS X the locate database isn't generated, and there is no need to unless you are a console user. To enable this you have to open a console and type
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
This commands automates the locate database a bit. If we look at the file (/System/Library/LaunchDaemons/com.apple.locate.plist) we can see the following data
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>15</integer>
<key>Weekday</key>
<integer>6</integer>
This means the indexing should appear 3:15 every Saturday. I suppose it's a normal and quite good time to index the database, but being able to update it manually is a very good option sometimes as well too. To do this simply run
$ sudo /usr/libexec/locate.updatedb

# To simplify this you can create an alias, type
$ sudo ln -s /usr/libexec/locate.updatedb /usr/bin/updatedb

# Now you can simply type
$ sudo updatedb

Using the database

This is very simple, just type
$ locate <searchterm>

# Example
$ locate apachectl

# Will return something like this
/Library/WebServer/share/httpd/manual/programs/apachectl.html
/Library/WebServer/share/httpd/manual/programs/apachectl.html.en
/Library/WebServer/share/httpd/manual/programs/apachectl.html.ko.euc-kr
/Library/WebServer/share/httpd/manual/programs/apachectl.html.tr.utf8
/usr/sbin/apachectl
/usr/share/man/man8/apachectl.8.gz
/usr/share/zsh/4.3.9/functions/_apachectl
Fancy huh :)
Please note that this portal is a BETA site , I will continuously improve all functionality and performance during the coming weeks / the author