Inside tmux the terminal's own scrollback does not work as usual, so copy mode is how you read and grab old output.
tmux keeps each pane's history itself (2000 lines by default, see history-limit). To look at it, enter copy mode with C-b [ (or C-b PgUp, which also scrolls up one page). A position indicator appears in the top-right corner.
Copy mode has two key tables: emacs (default) and vi, chosen with the mode-keys option (tmux picks vi if $VISUAL or $EDITOR contains "vi"). In vi mode:
h j k l,w b,Ctrl-u/Ctrl-d,g/Gmove around./and?search forward and backward,n/Nrepeat.Spacestarts a selection,Entercopies it and leaves copy mode;vtoggles rectangle selection.qexits.
Copied text goes into a tmux paste buffer. C-b ] pastes the most recent buffer into the current pane, C-b = lets you choose from all buffers, and tmux show-buffer prints it in a shell.
With set -g mouse on, scrolling the wheel enters copy mode and dragging selects text, copying on release. Holding Shift while dragging bypasses tmux and uses the terminal's native selection.
Paste buffers are separate from the system clipboard; the clipboard lesson connects them.
Example
# inside tmux, vi mode-keys:
# C-b [ enter copy mode
# ?error<Enter> search backward for 'error'
# Space start selection, move with j / w ...
# Enter copy selection, leave copy mode
# C-b ] paste into the current pane
tmux show-buffer # print the latest paste buffer
tmux list-buffers # buffer0: 23 bytes: "..."
tmux set -g history-limit 50000 # more scrollback for new panesRemember
- C-b [ enters copy mode, q leaves it
- Space selects, Enter copies, C-b ] pastes (vi keys)
- history-limit controls how much scrollback each pane keeps
Watch out for
- Raising history-limit and expecting existing panes to grow; it applies to panes created afterwards.