tmux Cheat Sheet

Default prefix key: C-b (Ctrl+b). Shown below as PREFIX.

Authoritative references:


Sessions

Command Action Docs
tmux Start a new unnamed session new-session
tmux new -s <name> Start a new named session new-session
tmux ls List sessions list-sessions
tmux attach -t <name> Attach to an existing session attach-session
tmux kill-session -t <name> Kill a session kill-session
PREFIX d Detach from current session detach-client
PREFIX s Interactive session switcher choose-tree
PREFIX $ Rename current session rename-session
PREFIX ( / PREFIX ) Previous / next session switch-client

Windows

Command Action Docs
PREFIX c Create a new window new-window
PREFIX , Rename current window rename-window
PREFIX n / PREFIX p Next / previous window next-window
PREFIX <N> Select window by number select-window
PREFIX w Interactive window list choose-tree
PREFIX & Kill current window kill-window
PREFIX f Find window by name find-window
PREFIX . Move window (change index) move-window

Panes

Command Action Docs
PREFIX % Split pane vertically (left/right) split-window
PREFIX " Split pane horizontally (top/bottom) split-window
PREFIX <arrow> Move between panes select-pane
PREFIX o Cycle to next pane select-pane
PREFIX q Show pane numbers (press to select) display-panes
PREFIX x Kill current pane kill-pane
PREFIX z Zoom / unzoom current pane resize-pane
PREFIX { / PREFIX } Swap pane with previous / next swap-pane
PREFIX ! Break pane into its own window break-pane
PREFIX C-<arrow> Resize pane by 1 cell resize-pane
PREFIX M-<arrow> Resize pane by 5 cells resize-pane
PREFIX <space> Cycle through built-in layouts next-layout

Copy Mode & Scrollback

Copy mode is tmux’s scrollback viewer: enter it to scroll past the visible screen, search, and copy text to paste buffers.

Command Action Docs
PREFIX [ Enter copy mode (scroll back, search, select) copy-mode
PREFIX ] Paste the most recent buffer paste-buffer
PREFIX = Choose a buffer to paste choose-buffer
PREFIX # List all paste buffers list-buffers

tmux defaults to emacs key bindings; set set -g mode-keys vi in ~/.tmux.conf to switch to vi.

Action emacs (default) vi
Move cursor Up / Down / Left / Right k / j / h / l
Scroll one line C-Up / C-Down C-y / C-e
Half page up / down M-Up / M-Down C-u / C-d
Page up / down PageUp / PageDown C-b / C-f
Top / bottom of history M-< / M-> g / G
Start / end of line C-a / C-e 0 / $
Search forward / backward C-s / C-r (incremental) / / ?
Begin selection C-Space Space
Copy selection and exit M-w Enter
Exit copy mode Escape q

Bindings come from the copy-mode key table in tmux(1) — WINDOWS AND PANES.

See also: tmux wiki — Clipboard.


Command Mode & Config

Command Action Docs
PREFIX : Open the tmux command prompt command-prompt
:source-file ~/.tmux.conf Reload config without restarting source-file
:set -g <option> <value> Set a global option set-option
:bind <key> <command> Create a key binding bind-key
:show-options -g Show current global options show-options
PREFIX ? List all key bindings list-keys

Miscellaneous

Command Action Docs
PREFIX t Show a large clock clock-mode
PREFIX ~ Show recent tmux messages show-messages
tmux kill-server Kill the tmux server and all sessions kill-server
tmux source-file <path> Load a config file from the shell source-file