mdfind

From Mac Guides

Jump to: navigation, search

Image:Tiger_small.jpg

This tip requires
Mac OS X Tiger

mdfind is a Terminal command used to performs Spotlight searches. It accepts a search string as input, and returns a list of files (with paths) to each match.

Examples

To search for all files containing "MacRumors"

 mdfind "MacRumors"

To search for "PowerBook" in your home directory

 mdfind -onlyin ~ "PowerBook"

To perform a continuing search for the string "Important information"

 mdfind -live "Important Information"

The last example leaves spotlight active, and will update with any new matches as well as a count.

Man Page Excerpt

The mdfind command consults the central metadata store and returns a list of files that match the given metadata query. The query can be a string or a query expression.

See Also