Prefix key is Ctrl+b by default — press it, release, then press the next key.
| Command | Action |
|---|---|
tmux |
Start new session |
tmux new -s name |
Start named session |
tmux ls |
List sessions |
tmux attach -t name |
Attach to session |
tmux kill-session -t name |
Kill session |
Ctrl+b d |
Detach from session |
| Shortcut | Action |
|---|---|
Ctrl+b c |
Create new window |
Ctrl+b , |
Rename window |
Ctrl+b n |
Next window |
Ctrl+b p |
Previous window |
Ctrl+b 0-9 |
Jump to window number |
Ctrl+b w |
List windows |
Ctrl+b & |
Kill window |
| Shortcut | Action |
|---|---|
Ctrl+b % |
Split vertically (side by side) |
Ctrl+b " |
Split horizontally (top/bottom) |
Ctrl+b arrow key |
Move between panes |
Ctrl+b o |
Cycle to next pane |
Ctrl+b z |
Zoom/unzoom current pane |
Ctrl+b x |
Kill current pane |
Ctrl+b space |
Cycle pane layouts |
Hold Ctrl+b + arrow |
Resize pane |
| Shortcut | Action |
|---|---|
Ctrl+b [ |
Enter copy mode (scroll with arrows) |
q |
Quit copy mode |
space |
Start selection (in copy mode) |
Enter |
Copy selection |
Ctrl+b ] |
Paste |
Detaching = leaving a tmux session running in the background while you step away from it, without closing it. Your programs (servers, SSH connections, editors, etc.) keep running exactly as they were.
Press Ctrl+b d to detach.
You're back at your normal terminal, but the session is still alive on the machine.
Attaching = reconnecting to that still-running session and picking up right where you left off — same panes, same windows, same running processes.
Run tmux attach -t name (or tmux a -t name) to attach.
Why it matters: the big use case is SSH. Say you're SSH'd into a remote server and running a long build or a script inside tmux. If your connection drops or you close your laptop, a normal terminal session would kill that process. But if it's inside tmux, you just detach (or even lose connection accidentally), and when you SSH back in later, you tmux attach and the process is still running like nothing happened.