Find files.
Syntax locate pattern
locate searches a database for all pathnames which match the specified pattern. The database is recomputed periodically, (about once a week) and contains the path-names of all files which are publicly accessible.
Shell globbing and quoting characters (`*', `?', ``\'', `[' and `]') may be used in pattern, although they will have to be escaped from the shell.
Preceding any character with a backslash (`\') eliminates any special meaning which it may have. The matching differs in that no characters must be matched explicitly, including slashes (`/').
As a special case, a pattern containing no globbing characters (`foo') is matched as though it were `*foo*'..
Examples
Force a build/update of the database:
$ sudo /usr/libexec/locate.updatedb
Search the database for files with names containing "foo",
or in folders with names containing "foo"
$ locate foo
Search the database for files with names ending in ".jpg"
(but not in folders ending in ".jpg")
$ locate '*.jpg'
File locations
Database
/var/db/locate.database
Script to update database
/usr/libexec/locate.updatedb
Related:
locate man page - Apple.com
find - Search for files that meet a desired criteria
grep - Search file(s) for lines that match a given pattern
ln - Make links between files (hard links, symbolic links)
ls - List information about file(s)
mdfind - Spotlight search
where - Report all known instances of a command
which - Locate a program file in the user's path