Copy Mode โ€” Vim Motions in Your Scrollback

Read the buffer, select text, yank it, paste it

Keys: Ctrl-B [, h, j, k, l, /, n, v, y, q

Ctrl-B [ enters copy mode: a read-only view of the pane's scrollback with full Vim motions. Press v to start a selection, y to copy, q or Esc to leave.

Copy Mode

Copy mode is tmux's read-only scrollback view. Enter it with Ctrl-B[. Once inside, every Vim motion you already know works:

Keys Action
h j k l Move one cell
0 ^ $ Beginning / first non-blank / end of line
w b e Word forward / back / end
gg / G Top / bottom of scrollback
Ctrl-U Ctrl-D Ctrl-B Ctrl-F Half-page / full-page scroll
/ ? n N Search forward / backward / next / previous
v Toggle visual character selection
V Toggle visual line selection (in vi-mode tmux)
y Copy selection to tmux's paste buffer
q or Esc Leave copy mode

After you copy, paste with Ctrl-B]. The copy buffer is a tmux-internal stack; tmux list-buffers shows everything you've yanked recently.

System Clipboard Integration

By default, copy mode's y writes to a tmux buffer โ€” useful inside tmux, invisible to your OS clipboard. To make y write to the system clipboard so you can paste into a browser or another app, bind copy-pipe to a clipboard tool:

# macOS
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"

# Linux X11 (xclip)
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection clipboard"

# Linux Wayland (wl-copy)
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "wl-copy"

Watch

See also: Panes โ€” Split, Navigate, Resize, Pattern Search