iTerm2 basics

Commands && Shortcuts for wellness and zen

By Christopher Black

iTerm2 is an amazing Terminal replacement (err, technically, a terminal emulator) for Mac users. If you spend any time at all in the terminal, free from the prescriptive constraints of the GUI, iTerm2 is worth checking out. All of us begin our terminal journey learning the basics: the commands for moving around the filesystem, basic file manipulation, and probably a few administrative commands (e.g. chmod +r file). Learning how to operate the terminal itself quickly and efficiently is the next stage in your journey. Imagine the power one wields when being able to split terminal panes or delete entire sentences with a single keystroke…

This list started life as squarism’s iTerm2 shortcuts gist, which is well worth bookmarking. I’ve trimmed it to the shortcuts that earn their keep, split what iTerm2 does from what your shell does, and updated it against the current iTerm2 documentation.

⌘ Command · ⌥ Option · ⇧ Shift · ⌃ Control

One setting first

Out of the box, ⌥ types special characters instead of talking to your shell, so “jump a word” shortcuts don’t work (this question is where I first ran into it). Fix it once: Settings › Profiles › Keys › General › Left Option key › Esc+.

Start here

Function Shortcut
Split pane vertically / horizontally ⌘D / ⌘⇧D
Jump between panes ⌘⌥ + arrow
Maximize a pane (press again to restore) ⌘⇧↩
Search your command history ⌃R
Clear the screen ⌘K

iTerm2: tabs, windows and panes

Function Shortcut
New tab ⌘T
Close tab or pane ⌘W
Go to tab 1–9 ⌘1 … ⌘9
Next / previous tab ⌘→ / ⌘←
Cycle iTerm2 windows ⌘`
Split pane vertically ⌘D
Split pane horizontally ⌘⇧D
Select pane by direction ⌘⌥ + arrow
Select pane in order of use ⌘] / ⌘[
Maximize / restore pane ⌘⇧↩
Resize pane ⌃⌘ + arrow
Move a pane ⌘⌥⇧ + drag it with the mouse
Full screen ⌘↩

iTerm2: power features

Function Shortcut
Broadcast typing to every pane in the tab (press again to stop) ⌘⌥I
Clear the buffer ⌘K
Find the cursor ⌘/
Set a mark / jump back to it ⌘⇧M / ⌘⇧J
Paste history ⌘⇧H
Instant Replay (scrub back through what the screen showed) ⌘⌥B
Open Quickly (search tabs, panes, commands) ⌘⇧O

iTerm2: copy without the mouse

Function Shortcut
Enter Copy Mode ⌘⇧C (Edit › Copy Mode)
Move around h j k l or arrow keys
Start selecting characters / lines v / V
Rectangular selection ⌃V
Copy the selection y
Leave Copy Mode Esc or q

Copies land on the normal system clipboard, so paste as usual.

Your shell: moving and editing

These belong to your shell (zsh has been the macOS default since 2019; bash behaves the same), not to iTerm2, so they work in any terminal.

Function Shortcut
Start / end of line ⌃A / ⌃E
Back / forward one word (needs Esc+ above) ⌥B / ⌥F
Back / forward one character ⌃B / ⌃F
Delete the previous word ⌃W
Delete to the end of the line ⌃K
Delete the line (zsh) or everything before the cursor (bash) ⌃U
Paste back what you just deleted ⌃Y
Delete the character under the cursor (exits the shell on an empty line) ⌃D
Clear the screen ⌃L

Your shell: searching history

Function Shortcut
Search as you type ⌃R, then type
Older matches ⌃R again
Run the match ↩
Edit the match before running it → or Esc
Cancel and restore your original line ⌃G
Share: X (Twitter) Facebook LinkedIn