The terminal multiplexer
tmux lets one terminal hold multiple windows and panes, and — crucially — keeps them alive when you disconnect. SSH into a server, start a tmux session, run a long job, close your laptop, come back tomorrow, reattach, see the same screen.
The mental model
- Server — one tmux daemon per user.
- Session — a named workspace. Survives client disconnect.
- Window — like a tab. Multiple per session.
- Pane — a split inside a window.
The prefix key
Default prefix is Ctrl+B. Every tmux command starts with the prefix, then a key. Many people remap to Ctrl+A (GNU Screen muscle memory) — add set -g prefix C-a; unbind C-b to ~/.tmux.conf.
Daily commands
tmux new -s work— new session named work.Ctrl+B d— detach. Session keeps running.tmux ls— list sessions.tmux attach -t work— reattach.Ctrl+B c— new window.Ctrl+B n/p— next / previous window.Ctrl+B 0..9— jump to window N.Ctrl+B %— split pane vertically.Ctrl+B "— split pane horizontally.Ctrl+B arrow— move between panes.Ctrl+B z— zoom into the current pane (toggle).Ctrl+B [— copy mode (vi keys to scroll/search).
Persistent dev environment
tmuxinator or smug save/restore named session layouts. tmux-resurrect persists across reboots. Many engineers ssh into a box, attach to a long-lived tmux session, and never "open a terminal" in the modern sense.
A terminal session is not a backup
tmux preserves an interactive process tree across client disconnects, but not host failure, reboot, or deleted data. Keep durable output elsewhere and use a service manager when unattended restart and health reporting are requirements.
A shared session has an authorization boundary
Anyone able to attach may see output, type commands, or inherit access available inside the session. Control socket permissions and users, and avoid placing secrets in scrollback.