learntmux.dev

Copy text in copy mode

Goal

A paste buffer holds the deploy key line.

Copy mode is the read-and-select mode for a pane’s screen and its scrollback. The pane freezes, and inside it no key needs a prefix:

C-b [
enter copy mode
arrows
move the cursor
C-a / C-e
jump to the start or end of the line
C-Space
start a selection (C-g drops it and stays)
M-w
copy the selection into a buffer and leave
q
leave without copying

The copied text becomes a paste buffer, ready for the next task.

Do this

Press C-b [.

The pane freezes and a position counter appears top right.

Press Up until the cursor is on deploy key: deploy-key-7f3a9c2e, then C-a.

The cursor sits at the start of that line.

Press C-Space, then C-e.

The line highlights from start to end.

Press M-w.

The highlight goes, copy mode ends, and the line is in a buffer.

How automatic buffers are kept

Buffers copied this way are automatic — buffer0, buffer1 and so on — and tmux keeps the last 50.

C-w copies exactly like M-w, but many browsers close the tab on C-w first, so M-w is the safer habit.

The keys above are emacs-style, the default. A vi-style table exists too, and the mode-keys option switches between them.

Stuck on this one?

This is a live terminal. Typing goes to the machine, including Tab. Press Shift and Tab together to move focus back out to the page.

A real terminal, in this tab

about 15 MB, once

session learn

Done when

not started
  1. Window 0 of session learn is in copy mode— not done yet
  2. A paste buffer contains the deploy key line— not done yet