learntmux.dev
CHEAT SHEET

Every key, and where you learned it.

100 bindings and commands, grouped by the level that teaches them. Each row links back to its lesson, so a key you have forgotten is one click from the terminal where it makes sense again.

The prefix is C-b throughout: press Ctrl and b together, let go, then press the second key.

Open the playground to try any of these in a real tmux, with nothing graded.

Level 1 · Basics

Practise these →
tmux keys taught in level 1, Basics
Keytmux commandWhat it does
tmux newnew-session (new)Start the server if needed, create a session called 0 and attach to it Start your first session
tmux new -s namenew-session -sCreate a session with a name and attach to it Start your first session
tmux new -n namenew-session -nName the first window instead of naming it after its program Start your first session
C-bthencnew-window (neww)Create a new window at the first free index and make it current The prefix key and new windows
C-bthenC-bsend-prefixSend a literal C-b to the program in the active pane The prefix key and new windows
C-bthen?list-keys -NShow every key binding with its description in view mode (Up, Down, C-Up, C-Down scroll; q exits) Find any key with the help list
C-bthen/command-prompt -k ... list-keys -1NPrompt for one key and show its description in the status line Find any key with the help list
C-bthentclock-modeShow a clock in the active pane; q exits Find any key with the help list
C-bthen:command-promptOpen the tmux command prompt in place of the status line (Enter runs, Escape cancels) Run commands from the command prompt
:neww -d -n namenew-window -d -nCreate a named window without making it current Run commands from the command prompt
:neww commandnew-window <command>Create a window running a program instead of a shell Run commands from the command prompt
C-bthenddetach-clientDetach this client and return to the outside shell Detach and come back
tmux attach -t nameattach-session -t (attach)Attach to a session by name; plain tmux attach picks the most recent unattached one Detach and come back
tmux lslist-sessions (ls)List sessions with their window counts and whether they are attached Read the session list and juggle sessions
tmux new -s name -n name commandnew-session [shell-command]Run a program in the first window instead of a shell (one argument goes through the shell) Read the session list and juggle sessions
tmux new -A -s namenew-session -A -sAttach to the named session if it exists, otherwise create it Read the session list and juggle sessions
C-bthen%split-window -hSplit the active pane into left and right Split the window into panes
C-bthen"split-window -vSplit the active pane into top and bottom Split the window into panes
:splitw -fvsplit-window -f -vNew pane spans the full width of the window, not just the pane being split Split with flags
:splitw -fhbsplit-window -f -h -bFull-height pane placed to the left of the pane being split Split with flags
:splitw -dsplit-window -dSplit without making the new pane the active pane Split with flags
C-bthenUpselect-pane -U (also Down -D, Left -L, Right -R)Make the pane above, below, left or right the active pane; wraps around Move between panes
C-bthenoselect-pane -t :.+Move to the next pane by number Move between panes
C-bthenqdisplay-panesShow pane numbers briefly; press a number to jump to that pane Move between panes
:kill-serverkill-serverKill the tmux server and every session, window and pane in it Kill the server

Level 2 · Intermediate

Practise these →
tmux keys taught in level 2, Intermediate
Keytmux commandWhat it does
C-bthen3select-window -t :=3 (C-b 0 to C-b 9)Change to the window with that index Change the current window
C-bthennselect-window -n (C-b p is -p)Change to the next window by index; p goes to the previous Change the current window
C-bthenllast-windowChange to the window that was current before this one Change the current window
C-bthen$rename-sessionPrompt for a new name for the attached session Rename the session and a window
C-bthen,rename-windowPrompt for a new name for the current window Rename the session and a window
C-bthenxkill-pane (confirm-before)Kill the active pane after a y/n prompt Kill a pane, a window and a session
C-bthen&kill-window (confirm-before)Kill the current window and all its panes after a y/n prompt Kill a pane, a window and a session
:kill-session -t namekill-session -tKill a session and all its windows; without -t kills the attached session Kill a pane, a window and a session
C-bthenzresize-pane -ZToggle zoom: the active pane fills the window, press again to restore Zoom a pane
C-bthenC-Leftresize-pane -L 1 (C-Right -R, C-Up -U, C-Down -D)Resize the active pane by one cell in that direction Resize panes
C-bthenM-Leftresize-pane -L 5 (M-Right, M-Up, M-Down)Resize the active pane by five cells in that direction Resize panes
:resize-pane -R 20resize-pane -L/-R/-U/-D <cells>Resize by any number of cells from the prompt; the fallback when Alt or Ctrl arrows do not reach tmux Resize panes
C-bthenSpacenext-layoutRotate to the next preset layout Apply window layouts
:select-layout nameselect-layout (selectl)Apply a layout by name: even-horizontal, even-vertical, main-horizontal, main-vertical or tiled Apply window layouts
C-bthenM-1select-layout even-horizontal (M-2 even-vertical, M-3 onward the rest; order varies by version)Apply a preset layout directly; confirm what each Meta key does with C-b / Apply window layouts
C-bthen}swap-pane -D (C-b { is swap-pane -U)Swap the active pane with the next (or previous) pane Mark and swap panes
C-bthenmselect-pane -m (C-b M is select-pane -M)Toggle the marked pane; M clears the mark entirely Mark and swap panes
:swap-paneswap-paneSwap the marked pane with the active pane Mark and swap panes
C-bthen.move-window (movew)Prompt for a new index for the current window Move and renumber windows
:swap-windowswap-windowSwap the window containing the marked pane with the current window Move and renumber windows
:movew -rmove-window -rRenumber windows to remove gaps in the window list Move and renumber windows
C-bthenschoose-tree -sTree mode starting with sessions; the attached session is selected Browse in tree mode
C-bthenwchoose-tree -wTree mode with windows shown and the current window selected Browse in tree mode
Enter(tree mode) choose; Up and Down move, Right and Left expand or collapse, q exitsChoose the selected session, window or pane; keys in tree mode need no prefix Browse in tree mode
t(tree mode) tag or untag the selected item; T untags all, C-t tags allTagged items show bold with a * Tag and kill from the tree
X(tree mode) kill tagged items; x kills only the selected itemKill every tagged session, window or pane after confirming Tag and kill from the tree
:(tree mode) command prompt for the selected or each tagged itemRun a command such as kill-session on every tagged item Tag and kill from the tree
C-bthenDchoose-clientClient mode: Enter or d detaches the selected client, D the tagged ones; q exits Kick out a stale client
:attach -d -t nameattach-session -dMove this client to that session and detach every other client from it Kick out a stale client
:detach-client -adetach-client -aDetach all clients except the one running the command Kick out a stale client

Level 3 · Advanced

Practise these →
tmux keys taught in level 3, Advanced
Keytmux commandWhat it does
C-bthen[copy-modeEnter copy mode; arrows move, C-a and C-e go to line start and end, q exits Copy text in copy mode
C-Spacesend-keys -X begin-selectionStart a selection at the cursor (copy mode); C-g cancels it Copy text in copy mode
M-wsend-keys -X copy-selection-and-cancel (C-w does the same)Copy the selection into a new buffer and leave copy mode Copy text in copy mode
C-Upsend-keys -X scroll-up (copy mode; C-Down scrolls down, PageUp and PageDown page)Scroll the history without moving the cursor line by line Scroll, search the scrollback and paste
C-rsend-keys -X search-backward-incremental (copy mode)Search backwards through the history as you type; Enter stops at the match, C-g cancels Scroll, search the scrollback and paste
C-bthen]paste-bufferPaste the most recent buffer into the active pane Scroll, search the scrollback and paste
C-bthen=choose-bufferEnter buffer mode: Enter or p pastes the selected buffer, d deletes it, q exits Choose and delete buffers in buffer mode
d(buffer mode) delete-bufferDelete the selected buffer without pasting it Choose and delete buffers in buffer mode
:setb -b old -n newset-buffer -b -nRename a buffer, turning an automatic buffer into a named one; setb -b name text creates one Name, save and load buffers
:saveb -b name pathsave-buffer -bWrite a buffer's contents to a file Name, save and load buffers
:loadb -b name pathload-buffer -bRead a file into a buffer with the given name Name, save and load buffers
C-bthenffind-windowPrompt for text and open tree mode filtered to panes whose visible content, title or window name matches Find a window by its content or name
C-s(tree mode) search by nameType a name and move to the first matching item in the tree Find a window by its content or name
n(tree mode) repeat the last searchJump to the next match Find a window by its content or name
:set -g mouse onset-option -g mouse onEnable mouse support for every session Use the mouse
:bind MouseDown1Paneselect-pane (mouse key binding)Left click a pane to activate it; drag a border to resize; drag over text to copy Use the mouse
:bind MouseDown1Statusselect-window (mouse key binding)Click a window name in the status line to switch to it; right click opens a menu Use the mouse
C-bthen!break-paneMove the active pane into a new window Break out, join and send keys
:join-pane -s srcjoin-pane -sMove a pane from another window into the current window as a new pane Break out, join and send keys
:send-keys -t target keyssend-keys -tSend keystrokes to a pane, for example a command followed by Enter Break out, join and send keys

Level 4 · Configure

Practise these →
tmux keys taught in level 4, Configure
Keytmux commandWhat it does
:show -g optionshow-options -g (show -s server, show -wg window)Show a global option; without a name lists all options of that type Show, set and unset options
:set -g option valueset-option -gSet a global session or window option (server options need no -g; -s marks them) Show, set and unset options
:set -gu optionset-option -guUnset a global option, restoring its default Show, set and unset options
:echo 'set -g mouse on' >> ~/.tmux.conf(shell) append a line to the configuration fileBuild the file one command per line; # starts a comment Write the configuration file
:source ~/.tmux.confsource-fileRun the commands in a file on the running server Write the configuration file
:bind M-0 selectw -t:=10bind-key (prefix table by default; -T names a table)Bind a key to a command; bind replaces an existing binding silently Add and remove key bindings
:bind -n M-n next-windowbind-key -n (same as -T root)Bind a key that works without the prefix Add and remove key bindings
:unbind M-0unbind-keyRemove a binding completely Add and remove key bindings
:set -g prefix C-aset-option -g prefixChange the prefix key Change the prefix key
:bind C-a send-prefixbind-key C-a send-prefix (with unbind C-b)Pressing the prefix twice sends it to the program Change the prefix key
:set -g status-position topset-option -g status-positionPut the status line at the top of the screen Customize the status line
:set -g status-style bg=redset-option -g status-styleStyle the whole status line (bg, fg, bold, underscore and so on) Customize the status line
:set -g status-right '%H:%M'set-option -g status-rightReplace the right side with a date format Customize the status line
:set -g status-left '#{session_name}'set-option -g status-left with #{...} formats and #{?cond,a,b} conditionalsFormats expand attributes of the server, session, window or pane Formats and embedded styles
:#[fg=red]embedded style inside an option valueChange the style of the following text until the next #[...]; #[default] resets Formats and embedded styles
:set -g status-left-length 40set-option -g status-left-lengthAllow a longer status-left Formats and embedded styles
:set -g status-right '#(cmd)'embedded shell command in a status optionRun a command and show its output, re-run at most every status-interval seconds Embedded shell commands
:set -g status-interval 5set-option -g status-intervalMaximum seconds between status line refreshes Embedded shell commands
:set -g pane-border-style fg=redset-option -g pane-border-styleStyle of inactive pane borders Configure the pane border
:set -g pane-active-border-style 'fg=red,bg=yellow'set-option -g pane-active-border-styleStyle of the active pane border Configure the pane border
:set -g pane-border-status topset-option -g pane-border-status (with pane-border-format)Show a status line in each pane border using pane-border-format Configure the pane border
:set -g mode-keys viset-option -g mode-keys vi (and status-keys vi)Use the copy-mode-vi key table in copy mode and vi keys at the prompt Use vi keys in copy mode
:bind -T copy-mode-vi v send -X begin-selectionbind-key -T copy-mode-viRebind a copy mode key by sending a copy mode command with -X Use vi keys in copy mode
:bind -Tcopy-mode MouseDragEnd1Pane send -X copy-selection-no-clearbind-key -T copy-mode MouseDragEnd1PaneCopy on release but keep the selection highlighted and stay in copy mode Mouse copying behaviour
:unbind -Tcopy-mode MouseDragEnd1Paneunbind-key -T copy-mode MouseDragEnd1PaneDo nothing on release; copy with the keyboard instead Mouse copying behaviour