Copy mode: scrolling, searching, copying

The first time your mouse wheel does nothing in tmux is a rite of passage. tmux keeps its own scrollback per pane, behind copy mode — freeze the screen, move like a text editor, search, copy.

Scrolling

prefix [ enters copy mode. Arrows or PgUp/PgDn scroll, q exits back to live output. Enable vi keys (setw -g mode-keys vi) and you get C-u/C-d half-pages, g/G top/bottom — the muscle memory you already have from less and vim. Or set set -g mouse on and the wheel just works.

Searching — the killer feature

Inside copy mode, ? searches upward (which is almost always the direction you want — the error scrolled past). Type the pattern, Enter, then n/N to walk matches. Grep for your scrollback.

Copying

Move to the start, Space to begin selecting, move to the end, Enter to copy and exit. prefix ] pastes. And prefix = shows every previous copy — tmux keeps them all as buffers, a clipboard history you get for free.

The clipboard catch

Copies land in tmux's buffers, not your system clipboard, until you wire them together — one line for modern terminals:

~/.tmux.conf
set -g set-clipboard on   # OSC 52: works locally AND over SSH

Before moving on

  1. Run: seq 1 500, then scroll with Ctrl-b [ and PgUp
  2. Search: press ? inside copy mode, type 137, Enter
  3. Copy a line: Space, move, Enter — paste with Ctrl-b ]
  4. Add set-clipboard on to your config and copy to your OS clipboard