Cheat Sheet Library

macOS Terminal / iTerm2 Cheat Sheet

The default macOS shell is zsh (config in ~/.zshrc). Most Linux commands work too; see the Bash sheet. This page covers the Mac-specific parts.

  • 51 entries
  • 6 sections
  • Updated
  • Click a command to see all its options

51 entries

On this page

Terminal.app Shortcuts #

ShortcutAction
⌘ N / ⌘ TNew window / new tab
⌘ WClose tab
⌘ ⇧ [ / ⌘ ⇧ ]Previous / next tab
⌘ KClear the screen and scrollback
⌘ DSplit the window (view the scrollback of the same shell)
⌘ FFind
⌘ + / ⌘ -Bigger / smaller text
⌥ + clickMove the cursor to the clicked position
⌘ .Interrupt (same as ⌃ C)

iTerm2 Shortcuts #

ShortcutAction
⌘ DSplit pane vertically (side by side)
⌘ ⇧ DSplit pane horizontally (stacked)
⌘ [ / ⌘ ]Previous / next pane
⌘ ⌥ ←/→/↑/↓Move to the pane in that direction
⌘ ⇧ EnterMaximize / restore the current pane
⌘ EnterFull screen
⌘ ;Autocomplete from words on screen
⌘ ⇧ HPaste history
⌘ ⇧ ;Command history (requires shell integration)
⌘ /Highlight the cursor position
⌘ ⌥ BInstant replay (scroll back in time)
⌘ ⌥ IBroadcast input to all panes
⌘ ,Preferences (set a Hotkey Window for a drop-down terminal)

Mac-Only Commands #

CommandAction
Open the current folder in Finder
Open with the default app
Open with a specific app
Copy file content to the clipboard
Paste the clipboard into a file
Text to speech
Keep the Mac awake (until ⌃ C)
Spotlight search from the terminal
Quick Look preview
Interactive screenshot
macOS version
Disks and partitions
List system updates
Install command-line developer tools (git, make, clang)
Always show hidden files

Homebrew (package manager) #

CommandAction
Install a CLI tool
Install a GUI app
Search
Installed packages
Update Homebrew and all packages
Remove
Remove old versions
Diagnose problems
Run a service in the background

zsh Tips #

FeatureHow
Config file~/.zshrc, reload with
Alias
Change folder without Type the folder name (with setopt autocd)
Recursive glob
Oh My ZshThemes and plugins (git, autosuggestions…)

Tips #

  • Drag a file or folder from Finder into the terminal to paste its path.
  • In iTerm2 set Profiles → Keys → Left Option key to Esc+ so ⌥ ←/→ jumps words.
  • ⌃ A / ⌃ E (start / end of line) and ⌃ R (history search) work in zsh just like in Bash.