Click the virtual machine below to start practicing
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Click the virtual machine below to start practicing
Your progress through the guide is saved. Start a fresh machine to keep practicing.
From the last lab. Answer in your head, then open to check.
job?tmux attach -t job.Output scrolls off the screen fast. Copy mode lets you scroll back, search, and copy text, without a mouse. ~/project/app.log has 200 lines, and one of them is an error you need.
Keys are written Ctrl-b then %: press Ctrl+b, let go, then press %. Ctrl-b is tmux's prefix: it tells tmux the next key is for it.
Every pane keeps a history of its output: 2000 lines by default (the history-limit option). Copy mode is a view onto that history that you can scroll, search and select from.
Copied text goes into tmux's own paste buffers, not your computer's clipboard. tmux list-buffers shows them, and Ctrl-b ] pastes the newest one into the current pane.
tmux's copy mode can use Emacs-style or Vi-style keys. Vi keys are easier to remember. Start a session and switch to them:
tmux new -s logs
tmux set -g mode-keys vi
cat app.log
The error has scrolled far off the top.
Press Ctrl-b [ to enter copy mode (a counter appears at the top right). Search upwards for the error:
?ERROR
Type ?ERROR and press Enter. The cursor jumps to the match.
With the cursor on the error line:
0 jumps to the start of the line.Space starts a selection.$ extends it to the end of the line.Enter copies it and leaves copy mode.Save the copied line to a file. Start cat, paste with Ctrl-b ], press Enter, then Ctrl-d:
cat > found.txt
Ctrl-b [ enters copy mode; q leaves it.? searches up and / searches down.Space starts a selection and Enter copies it.Ctrl-b ] pastes.