Command line and power tools
mdfind queries the same index as Spotlight but without the ranking, the blending or the interface deciding what you may see.
mdfind "invoice"
Searches names and contents everywhere. To search only names:
mdfind -name invoice
To restrict to a folder — including folders Spotlight's interface hides:
mdfind -onlyin ~/Library "invoice"
That -onlyin trick is the single most useful thing here: the index frequently contains files the Spotlight menu refuses to display.
mdfind -count "kMDItemContentType == 'com.adobe.pdf'"
Structured queries use metadata attributes:
mdfind "kMDItemFSSize > 1073741824"
mdfind "kMDItemContentTypeTree == 'public.image'"
mdfind "kMDItemFSName == '*.key'c"
mdfind 'kMDItemContentModificationDate >= $time.today(-7)'
The trailing c makes a comparison case-insensitive. $time supports today, now, this_week, this_month with optional offsets.
Combine with && and ||:
mdfind "kMDItemContentTypeTree == 'public.image' && kMDItemFSSize > 10485760"
To see every attribute Spotlight holds for a file:
mdls ~/Downloads/somefile.pdf
That is the reference — whatever mdls prints, you can query with mdfind.
mdfind -live "invoice"
Keeps running and updates as files change. Useful for watching a folder during an import.
mdfind reads Spotlight's index, so it cannot see what was never indexed: excluded folders, package contents, unmounted volumes, unindexed formats. It is a better interface to the same data, not more data.
It queries the same index, so lookup speed is similar. It feels faster because it does no ranking and no content blending.
mdfind -name term, or query kMDItemFSName directly for exact patterns.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Download for Mac