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.
Ctrl-b % side by side; Ctrl-b " top and bottom.Ctrl-b z to zoom in, and again to zoom out.This is what tmux is really for. A long job (a build, a download, a server) keeps going while you're away, even if your connection drops.
~/project/counter.sh counts up once a second and writes each number to count.log.
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.
When a connection drops (or a tab closes), the system sends a hang-up signal to everything that was started from that terminal, and those programs usually quit.
Programs in tmux weren't started from your terminal. They're children of the tmux server, which isn't attached to any terminal, so no hang-up reaches them. That's why tmux is how people keep long jobs and agents running on remote machines.
tmux new -s job
./counter.sh
Numbers start counting up.
Detach with Ctrl-b d, then reload this page (or close the tab and reopen the lab).
You've disconnected completely. The counter doesn't know or care.
tmux attach -t job
The count carried on while you were gone.
Jobs started inside tmux survive detaching, closed tabs and dropped connections. tmux attach -t name takes you straight back.