Boost Your Workflow: The macOS Terminal Cheat Sheet That Matters

The macOS Terminal is more than a tool — it’s a shortcut to doing things faster, smarter, and with way more control. Whether you're building, debugging, scripting, or just customising your setup, the right commands can save time and unlock features the GUI keeps buried. This cheat sheet pulls together the most practical, underrated, and surprisingly fun commands macOS has to offer.
📁 FILE & NAVIGATION
─────────────────────────────────────────────
cd ~ # Home directory
cd /Volumes # External drives
ls -lh # List with sizes
open . # Open folder in Finder
open -a AppName # Open app
open file.txt # Open file in default app
touch file.txt # Create blank file
pbcopy < file.txt # Copy to clipboard
pbpaste > file.txt # Paste into file
mkdir -p dir1/dir2 # Nested folders
🔍 SEARCHING & METADATA
─────────────────────────────────────────────
find . -name "*.jpg" # Find images recursively
grep -r "password" . # Search in files
mdfind "project name" # Spotlight from terminal
mdls myphoto.jpg # Metadata info
🎩 HIDDEN MAC TRICKS
─────────────────────────────────────────────
say "Welcome, hacker" # Make your Mac talk
caffeinate # Prevent sleep
screencapture -i file.png # Interactive screenshot
tmutil listbackups # List Time Machine backups
pmset -g batt # Battery info
drutil tray eject # Eject CD tray (nostalgia!)
🧪 NERD-LEVEL SYSTEM COMMANDS
─────────────────────────────────────────────
sudo periodic daily # Run maintenance script
csrutil status # SIP status
diskutil list # List disks
sudo lsof -i :3000 # Who's using port 3000?
sudo dscacheutil -flushcache # Clear DNS cache
nvram -p # View NVRAM
sudo powermetrics # Power/CPU info
🌍 NETWORK & INTERNET
─────────────────────────────────────────────
ping google.com # Ping site
ifconfig # IP info
curl ifconfig.me # Public IP
curl -s wttr.in # Weather forecast (ASCII)
🧙♂️ BONUS COMMANDS
─────────────────────────────────────────────
uptime # System runtime
cal 1999 # Calendar (any year)
yes "ALL HAIL MAC TERMINAL" # Infinite spam (CTRL+C to stop)
📜 ALIASES TO ADD TO ~/.zshrc
─────────────────────────────────────────────
alias gs='git status'
alias showHidden='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
alias hideHidden='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'