Copy text in copy mode
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-gdrops 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.
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.
Here is what just happened.
C-b [ runs copy-mode. Inside, keys send copy mode commands: C-Space is begin-selection and M-w is copy-selection-and-cancel, both via send-keys -X. The copy landed in an automatic buffer, ready to paste.
- Enter copy mode; arrows move, C-a and C-e go to line start and end, q exitsC-bthen[
- Start a selection at the cursor (copy mode); C-g cancels itC-Space
- Copy the selection into a new buffer and leave copy modeM-w
Go further
C-b ?lists copy mode’s keys along with everything else;man tmuxhas the full table for both key styles.qleaves copy mode without copying.
- 1If
C-Spacedoes nothing in your terminal, pressC-b :and runsend-keys -X begin-selectioninstead. - 2
C-b [enters copy mode.UpandDownmove;C-aandC-ego to the start and end of the line. - 3On the deploy key line:
C-a,C-Space,C-e, thenM-wto copy and leave.
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
Alpine Linux and tmux 3.4 on an x86 emulator. Nothing to install, and no server behind it.
about 15 MB, once
Done when
not started- Window 0 of session learn is in copy mode— not done yet
- A paste buffer contains the deploy key line— not done yet