tmux is a terminal multiplexer for Unix-like systems that allows multiple terminal sessions to run simultaneously within a single window, with sessions persisting even after disconnection. It enables detachable sessions that survive SSH drops, system reboots (with plugins), and accidental terminal closures — making it invaluable for remote work, long-running processes, and complex multi-pane workflows. The key mental model: sessions contain windows, windows contain panes — each layer offers progressively finer control over your terminal workspace, with the prefix key (Ctrl+b by default) serving as the gateway to all tmux commands.
What This Cheat Sheet Covers
This topic spans 19 focused tables and 161 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Session Management
Sessions are the outermost layer of tmux — a self-contained workspace that keeps running on the server even after you disconnect. These are the commands you reach for to create, name, attach to, and tear down those sessions, which is exactly what makes tmux survive a dropped SSH connection. Get comfortable with new, attach, and detach first; everything else falls into place once that reattach loop clicks.
| Command | Example | Description |
|---|---|---|
tmux new -s work | • Creates a new named session • sessions persist after disconnection and can be reattached later | |
tmux attach -t work | • Attaches to an existing session by name or ID • reconnects to your work exactly where you left off | |
Ctrl+b d | • Detaches from the current session • session continues running in the background | |
tmux ls | Lists all active sessions with their names, window count, and creation time. | |
tmux kill-session -t work | • Terminates a specific session and all its windows and panes • cannot be recovered |