CLI
tmux Cheatsheet
Quick reference for tmux commands including sessions, windows, panes, key bindings, copy mode, and configuration options.
Prefix Key
The default prefix is Ctrl+b. All key bindings below assume the prefix has been pressed first unless noted otherwise.
Sessions (Shell Commands)
| Command | Description |
|---|
tmux | Start new session |
tmux new -s name | Start named session |
tmux ls | List sessions |
tmux attach | Attach to last session |
tmux attach -t name | Attach to named session |
tmux kill-session -t name | Kill named session |
tmux kill-server | Kill all sessions |
tmux switch -t name | Switch to session |
Sessions (Key Bindings)
| Key | Description |
|---|
d | Detach from session |
s | List and switch sessions |
$ | Rename current session |
( | Previous session |
) | Next session |
L | Switch to last session |
Windows
| Key | Description |
|---|
c | Create new window |
, | Rename current window |
w | List and select windows |
n | Next window |
p | Previous window |
0-9 | Switch to window by number |
l | Toggle last active window |
& | Kill current window |
. | Move window (enter new index) |
f | Find window by name |
Panes
Creating & Closing
| Key | Description |
|---|
% | Split vertically (left/right) |
" | Split horizontally (top/bottom) |
x | Kill current pane |
! | Convert pane to window |
Navigation
| Key | Description |
|---|
| Arrow keys | Switch to pane in direction |
q | Show pane numbers (press number to switch) |
o | Cycle to next pane |
; | Toggle last active pane |
{ | Move pane left |
} | Move pane right |
Resizing
| Key | Description |
|---|
Ctrl+Arrow | Resize pane in direction (1 cell) |
Alt+Arrow | Resize pane in direction (5 cells) |
z | Toggle pane zoom (fullscreen) |
Space | Cycle through layouts |
Layouts
| Key / Command | Description |
|---|
Alt+1 | Even horizontal |
Alt+2 | Even vertical |
Alt+3 | Main horizontal |
Alt+4 | Main vertical |
Alt+5 | Tiled |
Space | Cycle through layouts |
Copy Mode
| Key | Description |
|---|
[ | Enter copy mode |
q | Exit copy mode |
| Space | Start selection (in copy mode) |
| Enter | Copy selection and exit |
] | Paste buffer |
= | Choose buffer to paste |
# | List all paste buffers |
Copy Mode Navigation (vi mode)
| Key | Description |
|---|
h j k l | Move cursor |
w / b | Next / previous word |
f / F | Find character forward / backward |
/ / ? | Search forward / backward |
n / N | Next / previous search match |
g / G | Go to top / bottom |
0 / $ | Beginning / end of line |
Command Mode
| Key | Description |
|---|
: | Enter command mode |
:source ~/.tmux.conf | Reload config |
:setw synchronize-panes on | Sync input to all panes |
:setw synchronize-panes off | Unsync panes |
:swap-window -t N | Swap window to position N |
:join-pane -t :N | Move pane to window N |
:break-pane | Convert pane to window |
Common Configuration (~/.tmux.conf)
# Change prefix to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Enable mouse support
set -g mouse on
# Start window numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# Vi key bindings in copy mode
setw -g mode-keys vi
# Easier split bindings
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Faster escape time
set -sg escape-time 0
# Increase history limit
set -g history-limit 50000
# 256 color support
set -g default-terminal "screen-256color"
# Status bar
set -g status-position top
set -g status-interval 5
# Reload config
bind r source-file ~/.tmux.conf \; display "Reloaded"
# Pane navigation with Alt+arrow (no prefix)
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
Miscellaneous
| Key | Description |
|---|
t | Show clock |
? | List key bindings |
i | Display window information |
~ | Show previous messages |