Unlike the Terminal find command, locate provides indexed search results which is faster than find. Before using locate, you must build a database of system files, which will allow you to search by using the locate command. To build the database type the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

After the database is built you can run the locate command using the following syntax:

locate name

Locate does not search the files on your disk, instead it searches for file paths in a database. One downside of locate is that the database must be constantly updated in order for your new files to be included in the search. Now this should be updated automatically in a cron every morning but if it is not, you can manually update the database as a root user using the updatedb command. This will ensure your database is current. Please see the example below using locate to search for a particular file: