tmux

tmux commands cheatsheet.

Manage terminal sessions, windows and panes with tmux — from the shell commands to the prefix key bindings.

Sessions (from the shell)
tmuxStart a new tmux session
tmux new -s workStart a named session
tmux lsList running sessions
tmux attach -t workRe-attach to a named session
tmux kill-session -t workEnd a named session
Windows (after prefix Ctrl+b)
cCreate a new window
n / pGo to the next / previous window
0–9Jump to a window by number
,Rename the current window
&Close the current window
Panes (after prefix Ctrl+b)
%Split the pane left/right
"Split the pane top/bottom
arrow keysMove between panes
zZoom the current pane in/out
xClose the current pane
Other (after prefix Ctrl+b)
dDetach from the session (it keeps running)
[Enter scroll/copy mode
?List all key bindings
Key bindings are pressed after the prefix, which is Ctrl+b by default: press Ctrl+b, release, then the key.

Why tmux is worth learning

tmux keeps your terminal sessions alive even when you disconnect — start a long job on a server, detach with prefix then d, close your laptop, and reattach later with everything still running. That alone makes it essential for remote work over SSH. Beyond persistence, it lets you split one terminal into multiple panes and juggle several windows, so you can edit, run and monitor side by side.

The prefix is the key idea

Almost every tmux shortcut starts with the prefix (Ctrl+b by default): you press it, let go, then press the action key. So a new window is prefix then c, splitting a pane is prefix then %, and detaching is prefix then d. Once that rhythm clicks, the rest is just learning which letters do what — and pairs naturally with Vim and the SSH commands.

FAQ

How do I reattach to a tmux session after disconnecting?
Run tmux ls to see sessions, then tmux attach -t name to reattach. Your programs keep running the whole time you're detached.
What is the tmux prefix key?
By default it's Ctrl+b. You press the prefix, release it, then press the command key — for example Ctrl+b then c to open a new window.

More cheatsheets