Cheat Sheet Library

tmux Cheat Sheet

A terminal multiplexer: split panes, several windows, and sessions that keep running after you disconnect (great over SSH). Every shortcut starts with the prefix Ctrl + b, then the key. Written below as prefix + key.

  • 37 entries
  • 7 sections
  • Updated
  • Click a command to see all its options

37 entries

On this page

Sessions #

Command / keyAction
Start a new session
New session called "work"
List sessions
/ Attach to the last / a named session
Kill a session
Kill everything
prefix dDetach (the session keeps running)
prefix sPick a session from a list
prefix $Rename the session
prefix ( / prefix )Previous / next session

Windows (tabs) #

KeyAction
prefix cNew window
prefix ,Rename window
prefix n / prefix pNext / previous window
prefix 0…9Go to window number
prefix wPick from a list of all windows
prefix &Kill window

Panes (splits) #

KeyAction
prefix %Split left / right
prefix "Split top / bottom
prefix ←/→/↑/↓Move to a pane
prefix oNext pane
prefix zZoom the pane to full size (again to restore)
prefix xKill the pane
prefix qShow pane numbers (press a number to jump)
prefix { / prefix }Swap pane left / right
prefix SpaceCycle layouts
prefix !Turn the pane into its own window
prefix Ctrl + ←/→/↑/↓Resize the pane

Copy Mode (scroll & copy) #

KeyAction
prefix [Enter copy mode (scroll with arrows / PgUp)
qExit copy mode
Ctrl + Space then move, Alt + wSelect and copy (default emacs keys)
Space then move, EnterSelect and copy (with mode-keys vi)
/ or ?Search (vi keys)
prefix ]Paste

Misc #

KeyAction
prefix ?List all keybindings
prefix :Command prompt (for example :kill-pane)
prefix tBig clock
prefix rReload the config (if you bound it, see below)

Starter ~/.tmux.conf #

set -g mouse on                 # click panes, drag to resize, scroll
set -g base-index 1             # windows start at 1
setw -g pane-base-index 1
setw -g mode-keys vi            # vi keys in copy mode
set -g history-limit 50000

# easier splits that open in the current folder
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# reload config
bind r source-file ~/.tmux.conf \; display "Reloaded"

# optional: use Ctrl+a as the prefix
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix

Apply with tmux source-file ~/.tmux.conf.

Tips #

  • Typical SSH workflow: ssh server → tmux a || tmux new → work → prefix d → log out. Your programs keep running.
  • With mouse on, hold Shift while selecting to use your terminal's normal copy.