Cheat Sheet

tmux Cheat Sheet

tmux is a terminal multiplexer: one SSH connection, many windows and panes, and sessions that keep running after you disconnect. The prefix is Ctrl+b unless you remapped it. Press it, let go, then press the key.

Last updated September 11, 2026

Sessions

CommandWhat it does
Start a new unnamed session
Start a session named work
Attach to work if it exists, otherwise create it
Create a session detached (scripts)
List sessions
Attach to work
Attach to the most recent session
Attach and detach any other client (after a dropped connection)
Rename a session
Switch sessions from inside tmux
Kill one session
Kill every session except the current one
Kill everything
KeyAction
Detach, leaving the session running
Pick a session from a list
Rename the current session
and Previous and next session
Choose which client to detach

Windows

Windows are tabs. The status bar at the bottom lists them by number.

KeyAction
New window
Rename the current window
and Next and previous window
to Jump to a window by number
Last used window
Pick a window from a list
Find a window by name
Move the window to another number
Kill the window (asks first)
CommandWhat it does
New window named logs
Rename the current window
Kill window 2
Swap windows 2 and 1
Renumber the current window to 0
Switch by name

Panes

opens a command prompt inside tmux; the commands below go there.

KeyAction
Split left and right
Split top and bottom
, , , Move to the pane in that direction
Next pane
Last used pane
Show pane numbers; press one to jump
Zoom the pane to fill the window; again to unzoom
, , , Resize by one cell (hold to repeat)
, , , Resize by five cells
and Swap the pane with the previous or next one
Cycle through the built-in layouts
Break the pane out into its own window
Rotate the panes in the window
Kill the pane (asks first)
CommandWhat it does
Resize 10 cells left (, , for the others)
Zoom, same as
Equal columns (, , also exist)
Move the pane from window 2 into window 1
Type into every pane at once ( to stop)
Swap with the pane above
Kill every pane except the current one

Copy Mode and Scrolling

enters copy mode, which is also how you scroll back. Keys depend on : emacs by default, vi after .

Actionemacs (default)vi
Enter copy mode
Scroll, , , Same, plus , , ,
Top and bottom of history and and
Start and end of line and and
Search backward
Search forward
Next and previous match and and
Start selecting
Toggle rectangle selection
Copy the selection and exit
Exit without copying or
CommandWhat it does
Paste the last copied text
Pick from earlier copies
Print the last copy
Write the last copy to a file
Put text into the paste buffer from a script
Wheel scrolls, drag selects, click switches panes (in )
Lines of scrollback per pane (default 2000; applies to new panes)

Copies land in tmux's buffer, not the system clipboard. The config below pipes them to ; on Linux use or .

Prefix Key and Keybindings

KeyAction
List every keybinding
Command prompt
Send a literal Ctrl+b to the program in the pane
Big clock (any key dismisses it)
Suspend the tmux client ( resumes)
CommandWhat it does
Remap the prefix to Ctrl+a (screen style)
Free the old prefix
Let reach the program in the pane
Reload config with
Bind without the prefix (), here Alt+Left moves left
Remove a binding
Show the vi copy-mode bindings
Type into a session from outside (scripts)

Config

The file is . tmux 3.1 and newer also read (or ), and a system-wide loads first when it exists. Changes apply to the running server after a reload.

CommandWhat it does
Reload the config
Same, from inside tmux
Print the global options
Show the current prefix
Start with a different config file
Version; binding syntax changed in 2.4, so check this when a snippet fails

A minimal :

# Prefix on Ctrl+a, like screen
set -g prefix C-a
unbind C-b
bind C-a send-prefix

set -g mouse on
set -g history-limit 50000
set -g base-index 1
setw -g pane-base-index 1
setw -g mode-keys vi
set -g default-terminal "tmux-256color"
set -sg escape-time 10

# Splits that open in the current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

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

# vi-style select and copy to the system clipboard
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"

Swap for on X11 or on Wayland.

Status Bar

The bar at the bottom is configured with options, in or live from .

CommandWhat it does
Show the bar ( hides it, toggles)
Move the bar to the top of the screen
Redraw every 5 seconds (default 15)
Centre the window list (, )
Left side; is the session name
Widen the left side (default 10, it truncates)
Right side; formats work
Colours for the bar itself
Style for the active window
Colours for the command prompt line
Print one format variable, to test it

Anything in is a format variable (, ); runs a shell command and shows its output. Colours accept names, to , or , and 256-colour styles only render once is set.

Plugins

Most tmux plugins are installed through TPM, the tmux Plugin Manager. Clone it once:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Then list plugins in , keeping the line last:

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'

run '~/.tmux/plugins/tpm/tpm'
Key or commandWhat it does
Install everything listed in the config (capital I)
Update plugins, with a picker
Remove plugins no longer listed in the config
Add a plugin; any GitHub repo works
tmux-resurrect: save the current layout to disk
tmux-resurrect: restore the saved layout
tmux-continuum: restore automatically when the server starts

Plugins land in , or if your config lives under , in which case clone TPM there instead. does nothing until the config with the lines has been sourced at least once.

Install

tmux is not preinstalled on macOS and is missing from most minimal images and containers.

CommandWhat it does
Debian, Ubuntu, Raspberry Pi OS
Fedora, RHEL, Rocky, AlmaLinux ( on CentOS 7)
Alpine
Arch
macOS
then Windows, inside a WSL distro
Confirm the version you ended up with
Show which copy is first in

Windows has no native tmux. Run it under WSL, or run it on the Linux host you connect to and let the client pass the keys through; the PuTTY cheat sheet covers that side. With no root on the remote box, check for screen first, since it is preinstalled more often, and fall back to building tmux from source with (it needs libevent and ncurses headers).

Gotchas

  • The prefix is a sequence, not a chord. Press Ctrl+b, release, then the key. Holding Ctrl through the whole thing sends Ctrl+c, Ctrl+d, and friends instead.
  • Copy mode copies to tmux's own buffer. Nothing reaches the system clipboard until you add a binding or turn on on a terminal that supports it.
  • A dropped SSH connection does not kill tmux. Reconnect and run ; if it says the session is attached, . This is the reason to start every long job inside tmux; see ssh broken pipe for stopping the drops themselves.
  • With , the terminal's native drag-select is taken over by tmux. Hold Shift (Option in iTerm2, Fn in Terminal.app) to select with the terminal instead.
  • Inside tmux over SSH inside another tmux, press the prefix twice to reach the inner one, or give the remote a different prefix.
  • Vim feels sluggish on Esc until is in the config.
  • Snippets using are for tmux 2.3 and older. Modern tmux wants .
  • A reboot kills the tmux server and every session in it. Dropped connections are survivable, power cycles are not; see the Plugins section for .
  • Coming from screen: the prefix is Ctrl+b instead of Ctrl+a, and is . The screen cheat sheet has the rest of the key mapping.

tmux FAQ

How do I scroll up in tmux?

Press Ctrl+b then [ to enter copy mode, scroll with PgUp, PgDn, or the arrow keys, and press q to get back to the prompt. The mouse wheel does nothing until you add set -g mouse on to ~/.tmux.conf and reload; after that the wheel scrolls and enters copy mode on its own. How far back you can go is history-limit, which defaults to 2000 lines per pane; set -g history-limit 50000 is cheap and only applies to panes created after the reload.

How do I exit tmux without closing the session?

Detach instead of exiting: Ctrl+b then d drops you back to the plain shell and leaves every program in the session running. Typing exit or pressing Ctrl+d does the opposite, closing the pane, then the window, and the session dies with its last window, taking the jobs with it. From another terminal, tmux detach -t work detaches a session you are not in, and Ctrl+b then D asks which client to kick off when several are attached. To check which happened, run tmux ls: a listed session is still alive, while "no server running" means everything really did exit.

Do tmux sessions survive a reboot?

No. The tmux server is an ordinary process, so a reboot or a shutdown ends it along with every session and every command inside. What it does survive is the client going away: a dropped SSH connection, a closed terminal, or a laptop going to sleep. For layouts you want back after a reboot, the tmux-resurrect plugin saves the windows, panes, and working directories to disk with prefix Ctrl+s and restores them with prefix Ctrl+r, and tmux-continuum saves every 15 minutes and can restore on its own at startup. Neither brings running programs back to where they were, so anything that genuinely must outlive a reboot belongs in a systemd unit, not in tmux.

Is tmux better than screen?

For most people, yes. tmux has real pane splitting, a scriptable command language, a status bar, and it is actively developed; screen is older and its pane support is an afterthought. screen still wins in two cases: it is preinstalled on more old or minimal systems, so it is what you get on a box you cannot install to, and it can attach to serial ports with screen /dev/ttyUSB0 115200, which tmux cannot do at all. The one thing that catches people switching is the prefix, Ctrl+a in screen against Ctrl+b in tmux; set -g prefix C-a moves it back. The screen cheat sheet on this site maps the rest of the keys.

Does tmux work on Windows?

There is no native Windows build and no official port, so tmux on Windows means one of two things. Either run it inside WSL, where sudo apt install tmux works exactly as it does on Ubuntu, or run it on the Linux server you connect to and let PuTTY or Windows Terminal simply carry the keystrokes, which is what most people actually want. Git Bash bundles an MSYS2 tmux that mostly works but has redraw and clipboard quirks. If all you want is split panes on the Windows side, Windows Terminal does that itself with Alt+Shift+plus and Alt+Shift+minus, no tmux involved.

Related cheat sheets