The find Command on Mac: Locate Files From Terminal
Spotlight is fast because it searches an index — which means it misses whatever the index skips. find walks the actual folders, so it sees everything you have permission to read: hidden files, system paths, folders excluded from Spotlight. Here's the small slice of its syntax you'll actually reuse.
Search by name
The pattern is always find WHERE TESTS. Start in a folder and match a name, quoting any wildcard so the shell doesn't expand it first:
# every PDF under the current folder
find . -name '*.pdf'
# case-insensitive, so Invoice.PDF matches too
find ~/Documents -iname 'invoice*'
-iname is the one to remember — file names on a Mac are rarely consistent about capitalization. The . means "start here"; swap in ~ to search your whole home folder.
Two refinements save a lot of scrolling. -maxdepth 1 keeps the search in the starting folder without descending into subfolders — usually what you want in ~/Downloads. And you can negate any test with !: find . -type f ! -name '*.png' lists every file that isn't a PNG. If a folder like node_modules keeps flooding results, exclude the whole path with ! -path '*/node_modules/*'.
Filter by size, date, and type
Tests combine by just listing them — every test must match:
# files over 100 MB in your home folder
find ~ -type f -size +100M
# files modified in the last 7 days
find ~/Desktop -type f -mtime -7
# folders (not files) named node_modules
find ~/Projects -type d -name 'node_modules'
-type f is files, -type d is directories. For -size and -mtime, the sign matters: +100M means more than 100 MB, -7 means fewer than 7 days ago, and +30 would mean older than 30 days.
For recent changes measured in minutes rather than days, -mmin works the same way: find ~/Desktop -mmin -30 lists what changed in the last half hour, which is perfect for answering "where did that app just save my file?" There's also -empty, which matches zero-byte files and empty folders — a quick way to spot debris left behind by interrupted downloads before you clean it up.
Act on results — carefully
-exec runs a command on each match; {} stands in for the file and \; ends the command:
# show matches with sizes and dates
find ~/Downloads -name '*.dmg' -exec ls -lh {} \;
# delete matches — run WITHOUT -delete first to preview
find ~/Downloads -name '*.dmg' -delete
Treat -delete with respect: it bypasses the Trash, so there is no undo. Always run the same command without -delete first and read the list, and note that -delete must come after your tests — putting it first deletes everything the search touches.
When you pipe find's results into another command instead, file names containing spaces will break the pipeline silently. The robust pattern is find … -print0 | xargs -0 command, which separates names with a character that can never appear in a path. This matters more than it sounds: half the folders on a Mac — "Application Support", "Mobile Documents" — have spaces in their names, and a naive pipe treats each word as a separate file.
Fix "Operation not permitted"
When find sweeps broad paths it hits folders macOS protects (Desktop, Documents, Photos libraries) and prints permission errors. Two fixes: append 2>/dev/null to hide the noise, or grant Terminal real access under System Settings → Privacy & Security → Full Disk Access (add Terminal, toggle it on, restart Terminal). The toggle is reversible — switch it off when you're done. This works identically on Ventura, Sonoma, and Sequoia.
Terminal power without the memorization: Mainspring turns 90+ hidden macOS settings into labelled, reversible toggles, each with a plain-English description and one-click undo.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
When you want speed instead of thoroughness
find reads the disk directly, so sweeping a whole drive takes minutes. If the file is somewhere Spotlight indexes, mdfind searches the Spotlight index from Terminal and returns in under a second — use find when you need certainty, mdfind when you need speed.