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 →| Key | tmux command | What it does |
|---|---|---|
| tmux new | new-session (new) | Start the server if needed, create a session called 0 and attach to it Start your first session |
| tmux new -s name | new-session -s | Create a session with a name and attach to it Start your first session |
| tmux new -n name | new-session -n | Name the first window instead of naming it after its program Start your first session |
| C-bthenc | new-window (neww) | Create a new window at the first free index and make it current The prefix key and new windows |
| C-bthenC-b | send-prefix | Send a literal C-b to the program in the active pane The prefix key and new windows |
| C-bthen? | list-keys -N | Show 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 -1N | Prompt for one key and show its description in the status line Find any key with the help list |
| C-bthent | clock-mode | Show a clock in the active pane; q exits Find any key with the help list |
| C-bthen: | command-prompt | Open the tmux command prompt in place of the status line (Enter runs, Escape cancels) Run commands from the command prompt |
| :neww -d -n name | new-window -d -n | Create a named window without making it current Run commands from the command prompt |
| :neww command | new-window <command> | Create a window running a program instead of a shell Run commands from the command prompt |
| C-bthend | detach-client | Detach this client and return to the outside shell Detach and come back |
| tmux attach -t name | attach-session -t (attach) | Attach to a session by name; plain tmux attach picks the most recent unattached one Detach and come back |
| tmux ls | list-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 command | new-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 name | new-session -A -s | Attach to the named session if it exists, otherwise create it Read the session list and juggle sessions |
| C-bthen% | split-window -h | Split the active pane into left and right Split the window into panes |
| C-bthen" | split-window -v | Split the active pane into top and bottom Split the window into panes |
| :splitw -fv | split-window -f -v | New pane spans the full width of the window, not just the pane being split Split with flags |
| :splitw -fhb | split-window -f -h -b | Full-height pane placed to the left of the pane being split Split with flags |
| :splitw -d | split-window -d | Split without making the new pane the active pane Split with flags |
| C-bthenUp | select-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-btheno | select-pane -t :.+ | Move to the next pane by number Move between panes |
| C-bthenq | display-panes | Show pane numbers briefly; press a number to jump to that pane Move between panes |
| :kill-server | kill-server | Kill the tmux server and every session, window and pane in it Kill the server |
Level 2 · Intermediate
Practise these →| Key | tmux command | What it does |
|---|---|---|
| C-bthen3 | select-window -t :=3 (C-b 0 to C-b 9) | Change to the window with that index Change the current window |
| C-bthenn | select-window -n (C-b p is -p) | Change to the next window by index; p goes to the previous Change the current window |
| C-bthenl | last-window | Change to the window that was current before this one Change the current window |
| C-bthen$ | rename-session | Prompt for a new name for the attached session Rename the session and a window |
| C-bthen, | rename-window | Prompt for a new name for the current window Rename the session and a window |
| C-bthenx | kill-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 name | kill-session -t | Kill a session and all its windows; without -t kills the attached session Kill a pane, a window and a session |
| C-bthenz | resize-pane -Z | Toggle zoom: the active pane fills the window, press again to restore Zoom a pane |
| C-bthenC-Left | resize-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-Left | resize-pane -L 5 (M-Right, M-Up, M-Down) | Resize the active pane by five cells in that direction Resize panes |
| :resize-pane -R 20 | resize-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-bthenSpace | next-layout | Rotate to the next preset layout Apply window layouts |
| :select-layout name | select-layout (selectl) | Apply a layout by name: even-horizontal, even-vertical, main-horizontal, main-vertical or tiled Apply window layouts |
| C-bthenM-1 | select-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-bthenm | select-pane -m (C-b M is select-pane -M) | Toggle the marked pane; M clears the mark entirely Mark and swap panes |
| :swap-pane | swap-pane | Swap 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-window | swap-window | Swap the window containing the marked pane with the current window Move and renumber windows |
| :movew -r | move-window -r | Renumber windows to remove gaps in the window list Move and renumber windows |
| C-bthens | choose-tree -s | Tree mode starting with sessions; the attached session is selected Browse in tree mode |
| C-bthenw | choose-tree -w | Tree 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 exits | Choose 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 all | Tagged items show bold with a * Tag and kill from the tree |
| X | (tree mode) kill tagged items; x kills only the selected item | Kill every tagged session, window or pane after confirming Tag and kill from the tree |
| : | (tree mode) command prompt for the selected or each tagged item | Run a command such as kill-session on every tagged item Tag and kill from the tree |
| C-bthenD | choose-client | Client mode: Enter or d detaches the selected client, D the tagged ones; q exits Kick out a stale client |
| :attach -d -t name | attach-session -d | Move this client to that session and detach every other client from it Kick out a stale client |
| :detach-client -a | detach-client -a | Detach all clients except the one running the command Kick out a stale client |
Level 3 · Advanced
Practise these →| Key | tmux command | What it does |
|---|---|---|
| C-bthen[ | copy-mode | Enter copy mode; arrows move, C-a and C-e go to line start and end, q exits Copy text in copy mode |
| C-Space | send-keys -X begin-selection | Start a selection at the cursor (copy mode); C-g cancels it Copy text in copy mode |
| M-w | send-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-Up | send-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-r | send-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-buffer | Paste the most recent buffer into the active pane Scroll, search the scrollback and paste |
| C-bthen= | choose-buffer | Enter 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-buffer | Delete the selected buffer without pasting it Choose and delete buffers in buffer mode |
| :setb -b old -n new | set-buffer -b -n | Rename a buffer, turning an automatic buffer into a named one; setb -b name text creates one Name, save and load buffers |
| :saveb -b name path | save-buffer -b | Write a buffer's contents to a file Name, save and load buffers |
| :loadb -b name path | load-buffer -b | Read a file into a buffer with the given name Name, save and load buffers |
| C-bthenf | find-window | Prompt 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 name | Type 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 search | Jump to the next match Find a window by its content or name |
| :set -g mouse on | set-option -g mouse on | Enable mouse support for every session Use the mouse |
| :bind MouseDown1Pane | select-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 MouseDown1Status | select-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-pane | Move the active pane into a new window Break out, join and send keys |
| :join-pane -s src | join-pane -s | Move a pane from another window into the current window as a new pane Break out, join and send keys |
| :send-keys -t target keys | send-keys -t | Send keystrokes to a pane, for example a command followed by Enter Break out, join and send keys |
Level 4 · Configure
Practise these →| Key | tmux command | What it does |
|---|---|---|
| :show -g option | show-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 value | set-option -g | Set a global session or window option (server options need no -g; -s marks them) Show, set and unset options |
| :set -gu option | set-option -gu | Unset 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 file | Build the file one command per line; # starts a comment Write the configuration file |
| :source ~/.tmux.conf | source-file | Run the commands in a file on the running server Write the configuration file |
| :bind M-0 selectw -t:=10 | bind-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-window | bind-key -n (same as -T root) | Bind a key that works without the prefix Add and remove key bindings |
| :unbind M-0 | unbind-key | Remove a binding completely Add and remove key bindings |
| :set -g prefix C-a | set-option -g prefix | Change the prefix key Change the prefix key |
| :bind C-a send-prefix | bind-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 top | set-option -g status-position | Put the status line at the top of the screen Customize the status line |
| :set -g status-style bg=red | set-option -g status-style | Style 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-right | Replace 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} conditionals | Formats expand attributes of the server, session, window or pane Formats and embedded styles |
| :#[fg=red] | embedded style inside an option value | Change the style of the following text until the next #[...]; #[default] resets Formats and embedded styles |
| :set -g status-left-length 40 | set-option -g status-left-length | Allow a longer status-left Formats and embedded styles |
| :set -g status-right '#(cmd)' | embedded shell command in a status option | Run a command and show its output, re-run at most every status-interval seconds Embedded shell commands |
| :set -g status-interval 5 | set-option -g status-interval | Maximum seconds between status line refreshes Embedded shell commands |
| :set -g pane-border-style fg=red | set-option -g pane-border-style | Style of inactive pane borders Configure the pane border |
| :set -g pane-active-border-style 'fg=red,bg=yellow' | set-option -g pane-active-border-style | Style of the active pane border Configure the pane border |
| :set -g pane-border-status top | set-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 vi | set-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-selection | bind-key -T copy-mode-vi | Rebind 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-clear | bind-key -T copy-mode MouseDragEnd1Pane | Copy on release but keep the selection highlighted and stay in copy mode Mouse copying behaviour |
| :unbind -Tcopy-mode MouseDragEnd1Pane | unbind-key -T copy-mode MouseDragEnd1Pane | Do nothing on release; copy with the keyboard instead Mouse copying behaviour |