DDefault prefix: press Ctrl-b, release it, then press the command key. Example: Ctrl-b, then c. tmux Getting Started
Sessions
tmux new -s work # Start a named sessiontmux ls # List sessionstmux attach -t work # Reattach to a sessiontmux kill-session -t work
Ctrl-b d detaches from a session; it keeps running in the background.
Default keys
| Keys | Action |
|---|---|
Ctrl-b c | Create a window |
Ctrl-b , | Rename current window |
Ctrl-b n / p | Next / previous window |
Ctrl-b 0–9 | Select window by number |
Ctrl-b w | Choose a window |
Ctrl-b % | Split pane left/right |
Ctrl-b " | Split pane top/bottom |
Ctrl-b + arrow | Move to pane in that direction |
Ctrl-b o | Cycle through panes |
Ctrl-b z | Zoom or unzoom current pane |
Ctrl-b x | Close current pane |
Ctrl-b & | Close current window |
Ctrl-b [ | Enter copy mode; press q to leave |
Ctrl-b d | Detach |
Ctrl-b ? | Show key bindings |
Ctrl-b : | Open tmux command prompt |
Window and pane close commands ask for confirmation. Key bindings can be listed with Ctrl-b ?; the official guide explains the prefix sequence and command prompt. tmux Getting Started
Commands at the tmux prompt
Press Ctrl-b :, type a command, then press Enter.
new-window -n logssplit-window -h # Left/right panessplit-window -v # Top/bottom panesselect-window -t :2select-pane -L # Or -R, -U, -Dresize-pane -L 5 # Resize by 5 cells
Remember
- Session: a workspace that can keep running after you detach.
- Window: like a tab within a session.
- Pane: a split terminal within a window.
- Default prefix is
Ctrl-b; tmux settings can change it. tmux(1) manual