Practical Tmux
Tmux keeps terminal work in a server-side hierarchy of session → window → pane. If SSH drops, the session continues on the VPS and can be reattached. It helps with upgrades, builds, logs, and migrations, but is not a backup or a second access path.
The default prefix is Ctrl-b: press it, release it, then press the command key.
tmux new -s maintenance
# Ctrl-b d detaches without stopping work
tmux ls
tmux attach -t maintenance
# create or attach idempotently
tmux new-session -A -s maintenance
Ctrl-Z is different: it suspends the foreground job in the current shell. Use jobs -l, fg %1, or bg %1. For long jobs, start inside Tmux rather than relying on bg after an accident.
A useful ops session has deploy, logs, and health windows. Run Compose from the service directory, follow docker compose logs -f --tail 100, and monitor docker ps. Name windows by purpose.
If Tmux warns about nesting, inspect $TMUX; usually do not start Tmux inside Tmux. Use tmux attach -d -t <name> to detach another client and attach here. Tmux does not survive a VPS reboot; permanent services need systemd or a Docker restart policy. End panes normally with exit; tmux kill-session -t maintenance terminates the named session and its processes, so verify the target.