Guide - tmux
Based on configuration: ~/.config/tmux/tmux.conf
Prefix
| Key |
Action |
C-Space |
Prefix — send commands to tmux |
C-b |
Secondary prefix (falls through to tmux if first app doesn't consume it) |
Prefix C-Space |
Send literal C-Space to the application inside the pane |
After prefix, release both keys, then press the command key.
Pane management
| Key |
Action |
Prefix h |
Split vertically (pane below) — opens in same working directory |
Prefix v |
Split horizontally (pane to the right) — opens in same working directory |
Prefix x |
Kill current pane |
Prefix z |
Zoom/unzoom pane (fullscreen toggle) |
Prefix ; |
Jump to last active pane |
Prefix o |
Cycle to next pane |
Prefix { / } |
Swap pane with previous/next |
Prefix Space |
Cycle through layouts |
Prefix M-1 through M-7 |
Select preset layout (even-horizontal, even-vertical, main-horizontal, main-vertical, tiled, mirrored variants) |
Prefix M-o |
Rotate window panes (backward) |
Prefix C-o |
Rotate window (forward) |
Prefix ! |
Break pane into its own window |
Prefix q |
Display pane numbers (type number to select) |
Direct pane navigation (no prefix needed)
| Key |
Action |
C-M-Left / Right / Up / Down |
Select pane in direction (no prefix) |
C-M-S-Left / Right / Up / Down |
Resize pane by 5 cells in direction (no prefix) |
Also works with Prefix + arrow keys (single-cell resize with C-arrow, 5-cell with M-arrow).
Window management
| Key |
Action |
Prefix c |
New window — opens in same working directory |
Prefix k |
Kill current window |
Prefix r |
Rename window — prompts for new name |
Prefix l |
Jump to last window |
Prefix n / p |
Next/previous window |
Prefix 0–9 |
Select window by index (0-based) |
Prefix , |
Rename window (via default binding; overridden to prompt form above) |
Prefix w |
Interactive window tree — fuzzy-find and switch |
Prefix & |
Confirm then kill window |
Prefix . |
Move window to another index/session |
Prefix f |
Find window by name — interactive search |
Direct window navigation (no prefix needed)
| Key |
Action |
M-1 through M-9 |
Select window by index (1-based) |
M-Left / M-Right |
Previous/next window |
M-S-Left / M-S-Right |
Swap window with previous/next (moves window + selection) |
Right-click on status bar or press Prefix < to open a menu with: swap left/right, kill, respawn, mark, rename, new after, new at end.
Session management
| Key |
Action |
Prefix C |
New session — opens in same working directory |
Prefix d |
Detach current client |
Prefix K |
Kill current session |
Prefix R |
Rename session |
Prefix N / P |
Next/previous session |
Prefix ( / ) |
Previous/next session |
Prefix s |
Interactive session tree — fuzzy-find sessions, windows, panes |
Prefix L |
Switch to last session |
Prefix D |
Choose client to detach |
Direct session navigation (no prefix needed)
| Key |
Action |
M-Up / M-Down |
Previous/next session |
Copy mode
Enter with Prefix [. Vi-style keybindings (setw -g mode-keys vi).
Entering and exiting
| Key |
Action |
Prefix [ |
Enter copy mode |
q / Escape / C-c |
Exit copy mode |
Motion (vi-style)
| Key |
Action |
h j k l |
Cursor left/down/up/right |
0 / $ |
Start/end of line |
^ |
Back to indentation |
w b e |
Next/previous/end of word |
W B E |
Next/previous/end of space-delimited word |
} { |
Next/previous paragraph |
M-f M-b |
Next word end / previous word (emacs fallback) |
% |
Matching bracket |
C-M-f / C-M-b |
Next/previous matching bracket |
g / G |
History top / bottom |
H / L / M |
Top / bottom / middle of visible screen |
M-< / M-> |
History top / bottom |
C-Up / C-Down |
Scroll up/down (line) |
M-Up / M-Down |
Scroll up/down (half page) |
PPage / NPage |
Page up/down |
Space / C-v |
Page down |
M-v / C-b |
Page up |
Searching
| Key |
Action |
/ |
Search forward (prompt at bottom) |
? |
Search backward (prompt at bottom) |
C-s |
Incremental search forward (live as you type) |
C-r |
Incremental search backward (live as you type) |
n / N |
Next / previous match |
# / * |
Search backward/forward for word under cursor |
Selection and copy
| Key |
Action |
v |
Begin selection (character-wise) |
V / Space |
Select line (vi) / Begin selection (emacs) |
C-Space |
Begin selection (emacs) |
y / Enter |
Copy selection and exit copy mode |
M-w / C-w |
Copy selection and exit (emacs) |
D / C-k |
Copy to end of line and exit |
C-g |
Clear selection |
A |
Append selection to existing buffer and exit |
X |
Set mark (for jump-back later) |
M-x |
Jump to mark |
Jumps
| Key |
Action |
f + char |
Jump forward to next occurrence of char |
F + char |
Jump backward to previous occurrence of char |
t + char |
Jump forward to before next occurrence of char |
T + char |
Jump backward to before previous occurrence of char |
; |
Repeat last jump |
, |
Reverse last jump |
o |
Jump to other end of selection |
Rectangle (block) selection
| Key |
Action |
R / C-v |
Toggle rectangle mode — selection becomes columnar block |
| Action |
Behaviour |
| Scroll wheel |
Scroll up/down 5 lines at a time (auto-enters copy mode) |
| Drag select |
Select text and auto-copy on release |
| Double-click |
Select word and auto-copy |
| Triple-click |
Select line and auto-copy |
Paste
| Key |
Action |
Prefix ] |
Paste from the tmux paste buffer |
Prefix = |
Choose buffer interactively |
Prefix # |
List buffers |
Middle-click to paste wherever mouse is supported.
Mouse support
Mouse is on by default (set -g mouse on).
| Action |
Behaviour |
| Click pane |
Select that pane |
| Click-drag pane border |
Resize pane interactively |
| Scroll wheel |
Scroll pane history (enters copy mode automatically) |
| Right-click pane |
Pane context menu — split, kill, swap, zoom, resize, search word, copy word/line/hyperlink |
| Right-click status bar (window) |
Window context menu — swap, kill, respawn, mark, rename, new after/before |
| Right-click status bar (left, session) |
Session context menu — switch, rename, renumber, new session/window |
| Click status bar (window name) |
Switch to that window |
Status bar
┌──────────────────────────────────────────────────────────────┐
│ [session] 1:~/project 2:~/docs ⚡ │
├──────────────────────────────────────────────────────────────┤
| Element |
Detail |
| Position |
Top of screen |
| Left |
Session name — #[fg=black,bg=blue,bold] |
| Center |
Window list — #I:#W (index:name), current in blue bold |
| Right |
Mode indicators + hostname — COPY PREFIX ZOOM shown when active |
| Interval |
Updates every 5 seconds |
| Window names |
Auto-renamed to basename of current working directory |
| Separator |
None (windows abut) |
| Scrollbar |
Click to scroll up/down |
Status bar mode indicators
| Indicator |
Meaning |
PREFIX |
You've pressed the prefix key, waiting for command |
COPY |
Currently in copy mode |
ZOOM |
Current pane is zoomed (fullscreen) |
General settings
| Setting |
Value |
Effect |
default-terminal |
tmux-256color |
True-colour-aware terminal type |
terminal-overrides |
*,:RGB |
Enable RGB colour in all terminals |
base-index |
1 |
Windows start at index 1, not 0 |
pane-base-index |
1 |
Panes start at index 1 |
renumber-windows |
on |
No gaps when windows are closed |
history-limit |
50000 |
50k lines of scrollback per pane |
escape-time |
0 |
No delay after Escape (vim-friendly) |
focus-events |
on |
Pass focus events to applications (e.g. vim autowrite) |
set-clipboard |
on |
Integrate with system clipboard |
allow-passthrough |
on |
Allow OSC 52 sequences (e.g. remote clipboard via SSH) |
aggressive-resize |
on |
Resize window to smallest attached client |
detach-on-destroy |
off |
Don't detach when the last pane/window is killed |
extended-keys |
on |
CSI-u extended key protocol (better modifier support) |
mouse |
on |
Mouse support enabled |
Configuration reload
| Key |
Action |
Prefix q |
Reload ~/.config/tmux/tmux.conf and show confirmation |
Cheatsheet for tmux defaults (not in config but commonly useful)
| Key |
Action |
Prefix t |
Clock mode — shows a big clock in the pane |
Prefix ~ |
Show messages — recent tmux messages/log |
Prefix ? |
List all key bindings |
Prefix : |
Command prompt — enter any tmux command |
Prefix M-n / M-p |
Next/previous window with alert (activity/bell) |
Prefix C-z |
Suspend tmux client |