tmux
Terminal multiplexer — sessions, windows, panes & copy mode
default prefix
Ctrl + b
Core concepts
Sessions
| $ tmux | Start new session |
| $ tmux new -s name | New named session |
| $ tmux ls | List sessions |
| $ tmux attach | Attach to last session |
| $ tmux a -t name | Attach to named session |
| $ tmux kill-session -t name | Kill named session |
| prefix›d | Detach from session |
| prefix›s | List & switch sessions |
| prefix›$ | Rename current session |
| prefix›( ) | Previous / next session |
Panes (splits)
| prefix›% | Split pane vertically |
| prefix›" | Split pane horizontally |
| prefix›← → ↑ ↓ | Navigate panes |
| prefix›o | Cycle through panes |
| prefix›; | Last active pane |
| prefix›x | Kill current pane |
| prefix›z | Toggle zoom (fullscreen) |
| prefix›! | Break pane → new window |
| prefix›q | Show pane numbers |
| prefix›q 0–9 | Jump to pane # |
Copy mode (vi)
| prefix›[ | Enter copy mode |
| prefix›] | Paste buffer |
| prefix›PgUp | Enter scroll mode |
| prefix›= | List paste buffers |
| Space | Start selection |
| Enter | Copy selection & exit |
| q / Esc | Exit copy mode |
| h j k l | Move cursor |
| w / b | Forward / back word |
| g / G | Top / bottom of history |
| / | Search forward |
| ? | Search backward |
| n / N | Next / prev match |
| Ctrl+u / d | Scroll half page up/down |
Windows, resizing & config
Windows (tabs)
| prefix›c | Create new window |
| prefix›, | Rename current window |
| prefix›w | List & switch windows |
| prefix›n | Next window |
| prefix›p | Previous window |
| prefix›0–9 | Switch to window # |
| prefix›& | Kill current window |
| prefix›l | Last (previous) window |
| prefix›f | Find window by name |
| prefix›. | Move window to index # |
Pane resizing
| prefix›Ctrl+← | Resize left |
| prefix›Ctrl+→ | Resize right |
| prefix›Ctrl+↑ | Resize up |
| prefix›Ctrl+↓ | Resize down |
| prefix›Alt+← | Resize left ×5 |
| prefix›Alt+→ | Resize right ×5 |
| prefix›Alt+↑ | Resize up ×5 |
| prefix›Alt+↓ | Resize down ×5 |
| prefix›Space | Cycle pane layouts |
| prefix›Alt+1–5 | Set preset layout # |
Command & config
| prefix›: | Open command prompt |
| prefix›? | Show all key bindings |
| prefix›t | Show clock |
| :source ~/.tmux.conf | Reload config |
| :set -g prefix C-a | Change prefix key |
| :set -g mouse on | Enable mouse support |
| :set -g history-limit N | Set scrollback size |
| :setw synchronize-panes on | Type in all panes |
| $ tmux new-session -d -s bg | Detached background session |
| $ tmux send-keys -t s "cmd" Enter | Run cmd in session |
Power tips
Pro tips
⚡
Persistent sessions — tmux survives terminal closes. Detach prefix d, reattach tmux a.
🖱️
Mouse support — Add
set -g mouse on to ~/.tmux.conf for click-to-focus and drag-to-resize.
🎨
Remap prefix — Many prefer Ctrl+a. Set with
set -g prefix C-a + unbind C-b.
📋
Vi copy mode — Add
setw -g mode-keys vi for hjkl & search navigation inside copy mode.
🔄
Session managers — tmuxinator and tmux-resurrect save & restore full session layouts automatically.
📁
Scripting — Use
tmux send-keys, split-window, and select-pane in shell scripts to build repeatable workspaces.