Most “Mac terminal commands” lists are really Unix commands — cd, ls, grep, cp — that behave the same on any Linux box and are documented in a thousand other places. Worth knowing, but not worth a Mac-specific page. The commands worth learning here are the ones that only exist on a Mac and handle everyday Mac tasks: opening things in Finder, using the clipboard, searching with Spotlight, resizing an image, deleting a file to the Trash instead of for good. All of them ship with macOS — nothing to install.
The universal basics, in one breath
You’ll type these constantly, and they work like they do anywhere: pwd prints where you are, ls lists a folder (ls -la adds hidden files and details), cd moves around (cd ~ home, cd .. up one level, cd - back to where you just were), and mkdir, cp, mv, rm make, copy, move, and delete. That’s the Unix half, and any command-line reference covers it. The rest of this page is the Mac half.
open — the bridge between Terminal and Finder
open is the command Linux doesn’t have, and the one you’ll reach for most. It hands a file or folder to whatever app macOS would use if you double-clicked it:
open . # the current folder, in Finder
open report.pdf # a file, in its default app
open -a "Visual Studio Code" . # the current folder, in a specific app
open https://osxhub.com # a URL, in your default browser
open . on its own earns its keep — it’s the quickest way to jump from a folder in Terminal straight into a Finder window.
pbcopy and pbpaste — the clipboard, from the command line
These two move text between the Terminal and the same clipboard Cmd-C uses. pbcopy reads from a pipe into the clipboard; pbpaste writes the clipboard back out:
pwd | pbcopy # copy the current path, ready to paste anywhere
cat notes.txt | pbcopy # copy a whole file's contents
pbpaste > clip.txt # dump whatever you last copied into a file
Sending a command’s output straight to the clipboard — a path, a config snippet, a block of log — is one of those things that feels obvious the moment you have it.
mdfind — Spotlight, without the window
find works on a Mac, but it walks the disk every time and is slow across a whole drive. mdfind queries the Spotlight index instead — the same index behind Cmd-Space — so it answers almost instantly:
mdfind -name budget # every file with "budget" in the name
mdfind "quarterly report" # full-text search of file contents
For “where did that file go,” mdfind beats find on a Mac almost every time.
trash — delete to the Trash, not forever
rm deletes immediately and permanently — there’s no undo. trash, now built into macOS where it used to need a Homebrew install, moves a file to the Trash instead, so it stays recoverable from Finder until you empty it:
trash old-draft.txt # one file to the Trash
trash *.log # several at once
For anything you’re not certain you want gone, trash is the safer habit than rm.
screencapture — screenshots from the command line
The same screenshots you’d take with Cmd-Shift-3 or Cmd-Shift-4, scriptable:
screencapture shot.png # the whole screen, to a file
screencapture -i shot.png # select an area first
screencapture -c # straight to the clipboard, no file
Handy inside scripts, or for grabbing a shot on a timer without touching the keyboard.
sips — resize and convert images
sips (the Scriptable Image Processing System) edits images from the terminal with no app open. The two everyday jobs are resizing and changing format — including turning an iPhone .heic into a .png or .jpg:
sips -Z 800 photo.jpg # resize so the longest side is 800px
sips -s format png photo.heic --out photo.png # convert HEIC to PNG
-Z keeps the aspect ratio; -s format sets the output type. It edits the file in place unless you give it --out, so copy anything you want to keep untouched first.
A few one-liners for everyday Mac tasks
Check your macOS version — the exact number and build, which matters when a fix only applies to a specific release:
$ sw_vers
ProductName: macOS
ProductVersion: 26.5.2
BuildVersion: 25F84
Check the battery without leaving the terminal — pmset -g batt reports the charge level and power source, e.g. 77%; AC attached; not charging.
Show hidden files in Finder — the keyboard way is Cmd-Shift-., and the terminal way is a defaults write followed by restarting Finder:
defaults write com.apple.finder AppleShowAllFiles true
killall Finder
Keep the Mac awake while something long runs — caffeinate holds off sleep until you stop it with Ctrl-C, or for a set number of seconds:
caffeinate # stay awake until Ctrl-C
caffeinate -t 3600 # stay awake for one hour
Make it talk, or chime — say reads text aloud through the system voice, and afplay plays a sound file, which is a nice “it’s done” alert at the end of a long script:
say "backup finished"
afplay /System/Library/Sounds/Glass.aiff
The universal commands are the same everywhere, so pick them up once from any Unix reference. Everything on this page is a Mac-only built-in — none of it turns up in a generic command-line tutorial, which is exactly why these are the ones worth starting with on a Mac.