Command line and power tools
The commands and shortcuts from across this site, collected.
| Keys | Does |
|---|---|
| ⌘Space | Spotlight |
| ⌥⌘Space | Finder search window |
| ⌘F | Search in current Finder window |
| ⇧⌘G | Go to typed path |
| ⇧⌘. | Toggle hidden files |
| Space | Quick Look |
| ⌥⌘C | Copy full path |
| ⌘↑ | Enclosing folder |
| ⌘I | Get Info |
mdutil -s / # index status
sudo mdutil -E / # rebuild
sudo mdutil -i on / # enable indexing
sudo mdimport -R # rebuild importer cache
mdimport /path/to/file # re-import one file
mdls /path/to/file # show all metadata
mdfind "term" # names and contents
mdfind -name term # names only
mdfind -onlyin ~/Library "term" # a folder Spotlight hides
mdfind -count "term" # how many
mdfind "kMDItemFSSize > 1073741824" # over 1 GB
find ~ -iname "*term*" # case-insensitive name
find ~ -type f -size +100M # over 100 MB
find ~ -type f -mtime -7 # modified this week
find ~ -type d -name node_modules -prune # skip build dirs
find / -name "x" 2>/dev/null # hide permission noise
grep -r "term" ~/Documents
rg "term" # ripgrep, much faster
rg -t swift "func name" # one file type
du -h -d 2 ~ | sort -hr | head -25
tmutil listlocalsnapshots /
diskutil info / | grep -i free
unzip -l archive.zip | grep -i term
tar -tf archive.tar.gz | grep -i term
ext:pdf size:>100mb dm:today
path:Downloads "exact name" /regex/
a | b !exclude
mdfind -name term for speed, find ~ -iname "*term*" for completeness.
mdfind -onlyin ~/Library "term" — the index often has files the interface will not show.
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