[Note, 20130510: The posting below is correct, but I now maintain information in my Notes collection — see the current note or visit the search page for the Notes collection and search for "mdfind" or "updatedb", etc.]
Users of Linux are accustomed to the utilities updatedb
followed by
locate
, used at the command-line prompt for finding currently
installed files in readable directories on the system. On Mac OS X, not
only does updatedb
have to be run manually from
/usr/libexec/locate.updatedb
, but for some reason locate
apparently
doesn't always find filenames that exist and would be returned on a
Linux installation.
Instead, Apple supplies mdfind
, which searches the Spotlight metadata
store. The man page describes a number of options, most usefully
-name
for names only (the default search is for name or content, just like Spotlight)-onlyin
for limiting the search to specific directories-live
to initiate live updating of search results
The man page is online at https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/mdfind.1.html
[end]