Lesson 5 of 9 · 20m
tmux: The Terminal Multiplexer
Sessions that survive disconnects, panes that split your view, and the muscle memory that makes tmux the best $0 upgrade to remote work.
tmux solves two problems: sessions that survive your connection dropping, and more terminal space than a single window gives. Both are table stakes for serious remote work.
The model
- Server — the daemon; survives your ssh disconnect.
- Session — a named workspace (
tmux new -s work). - Window — a full-screen tab within a session.
- Pane — a split inside a window.
Attach, do work, detach (Ctrl-b d), the session runs on the server. Reconnect days later: tmux attach -t work — everything still there, logs still scrolling.
The essentials
tmux new -s work # new session
tmux ls # list sessions
tmux attach -t work # reattachInside tmux, everything hangs off the prefix Ctrl-b:
Ctrl-b %— split vertically;Ctrl-b "— horizontallyCtrl-barrows — move between panesCtrl-b c— new window;Ctrl-b n/p— next/prev windowCtrl-b [— scroll mode (qto quit)
The workflow patterns
- Dev: one window for the editor (or vim), one for the test runner, one for git — all in one ssh connection.
- Long jobs:
tmux new -s buildthen run the deploy — detach, go home, reattach tomorrow. - Shared session: two people
tmux attachto the same session — the original pair-programming remote.
Field notes
tmux -CC(iTerm2 integration) makes tmux windows native terminal windows — the best of both worlds.set -g mouse onin~/.tmux.confenables scroll/click for pane selection — the quality-of-life flag everyone adds.- Nested tmux (
tmuxinsidetmux) works — the inner prefix isCtrl-b b(send-prefix); you usually don't want it.