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)

CommandDescription
tmuxStart new session
tmux new -s nameStart named session
tmux lsList sessions
tmux attachAttach to last session
tmux attach -t nameAttach to named session
tmux kill-session -t nameKill named session
tmux kill-serverKill all sessions
tmux switch -t nameSwitch to session

Sessions (Key Bindings)

KeyDescription
dDetach from session
sList and switch sessions
$Rename current session
(Previous session
)Next session
LSwitch to last session

Windows

KeyDescription
cCreate new window
,Rename current window
wList and select windows
nNext window
pPrevious window
0-9Switch to window by number
lToggle last active window
&Kill current window
.Move window (enter new index)
fFind window by name

Panes

Creating & Closing

KeyDescription
%Split vertically (left/right)
"Split horizontally (top/bottom)
xKill current pane
!Convert pane to window
KeyDescription
Arrow keysSwitch to pane in direction
qShow pane numbers (press number to switch)
oCycle to next pane
;Toggle last active pane
{Move pane left
}Move pane right

Resizing

KeyDescription
Ctrl+ArrowResize pane in direction (1 cell)
Alt+ArrowResize pane in direction (5 cells)
zToggle pane zoom (fullscreen)
SpaceCycle through layouts

Layouts

Key / CommandDescription
Alt+1Even horizontal
Alt+2Even vertical
Alt+3Main horizontal
Alt+4Main vertical
Alt+5Tiled
SpaceCycle through layouts

Copy Mode

KeyDescription
[Enter copy mode
qExit copy mode
SpaceStart selection (in copy mode)
EnterCopy selection and exit
]Paste buffer
=Choose buffer to paste
#List all paste buffers

Copy Mode Navigation (vi mode)

KeyDescription
h j k lMove cursor
w / bNext / previous word
f / FFind character forward / backward
/ / ?Search forward / backward
n / NNext / previous search match
g / GGo to top / bottom
0 / $Beginning / end of line

Command Mode

KeyDescription
:Enter command mode
:source ~/.tmux.confReload config
:setw synchronize-panes onSync input to all panes
:setw synchronize-panes offUnsync panes
:swap-window -t NSwap window to position N
:join-pane -t :NMove pane to window N
:break-paneConvert 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

KeyDescription
tShow clock
?List key bindings
iDisplay window information
~Show previous messages