TMUX(1)

πŸ“¦ version 0.1, in epel 10, fedora 43, fedora 44

πŸ’– TMUX(1) β€” the terminal multiplexer, bestie edition πŸ’–

okay so real talk: this is the manual page for tmux from the General Commands Manual section. It's long, it's iconic, and we're gonna get through it together. Grab a snack. πŸ“


✨ NAME ✨

tmux β€” terminal multiplexer πŸ¦‹


🌸 SYNOPSIS 🌸

tmux [-2CDhlNuVv] [-c shell-command] [-f file] [-L socket-name]
     [-S socket-path] [-T features] [command [flags]]

πŸ‘‘ DESCRIPTION πŸ‘‘

Bestie. Listen. tmux is a terminal multiplexer. What that means, no cap, is that it lets a whole bunch of terminals get created, accessed, and controlled from one single screen. And the way it does it? You can detach from a screen and it just… keeps running in the background. Living its life. Then later you reattach whenever you want. Main character energy fr. πŸ’…

When tmux starts up, it creates a new session with a single window, and shows it on your screen. Down at the bottom there's a status line showing info about the current session β€” that's also where you go to enter interactive commands. Lowkey the most useful strip of pixels you'll ever meet.

So here's the vocabulary, because it matters:

  • A session is a single collection of pseudo terminals under the management of tmux.
  • Each session has one or more windows linked to it.
  • A window takes up the entire screen and may be split into rectangular panes.
  • Each pane is its own separate pseudo terminal. (If you want the technical deets on pseudo terminals, that's the pty(4) manual page's whole thing. Not our problem today. 🫢)

Any number of tmux instances may connect to the same session, and any number of windows may be present in the same session. Once all sessions are killed, tmux exits. That's it. That's the whole lifecycle. 😭

Every session is persistent β€” it survives accidental disconnection (like an ssh(1) connection timeout, we've all been there) and it survives intentional detaching (with the C-b d key strokes). To come back, you just do:

$ tmux attach

In tmux, a session is displayed on screen by a client, and all sessions are managed by a single server. The server and each client are separate processes, and they communicate through a socket in /tmp. So it's giving… tiny little family of processes passing notes. Obsessed.

The options are as follows:

  • -2 β€” Force tmux to assume the terminal supports 256 colours. This is equivalent to -T 256. ✨
  • -C β€” Start in control mode (peep the β€œCONTROL MODE” section for that whole situation). Given twice (-CC) it disables echo.
  • -c shell-command β€” Execute shell-command using the default shell. If necessary, the tmux server will be started to retrieve the default-shell option. This option is for compatibility with sh(1) when tmux is used as a login shell.
  • -D β€” Do not start the tmux server as a daemon. This also turns the exit-empty option off. With -D, command may not be specified.
  • -f file β€” Specify an alternative configuration file. By default, tmux loads the system configuration file from /etc/tmux.conf, if present, then looks for a user configuration file at ~/.tmux.conf or $XDG_CONFIG_HOME/tmux/tmux.conf.

The configuration file is a set of tmux commands which are executed in sequence when the server is first started. tmux loads configuration files once when the server process has started. The source-file command may be used to load a file later.

tmux shows any error messages from commands in configuration files in the first session created, and continues to process the rest of the configuration file. (So yes bestie, one typo in your config won't nuke the whole thing. She's forgiving. πŸ’œ)

  • -h β€” Print usage information and exit.
  • -L socket-name β€” tmux stores the server socket in a directory under TMUX_TMPDIR, or /tmp if it is unset. The default socket is named default. This option allows a different socket name to be specified, allowing several independent tmux servers to be run. Unlike -S, a full path is not necessary: the sockets are all created in a directory tmux-UID under the directory given by TMUX_TMPDIR or in /tmp. The tmux-UID directory is created by tmux and must not be world readable, writable or executable.

If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it (note that this will fail if any parent directories are missing). πŸ™ˆ

  • -l β€” Behave as a login shell. This flag currently has no effect and is for compatibility with other shells when using tmux as a login shell. It's giving decorative. πŸŽ€
  • -N β€” Do not start the server even if the command would normally do so (for example new-session or start-server).
  • -S socket-path β€” Specify a full alternative path to the server socket. If -S is specified, the default socket directory is not used and any -L flag is ignored.
  • -T features β€” Set terminal features for the client. This is a comma-separated list of features. See the terminal-features option.
  • -u β€” Write UTF-8 output to the terminal even if the first environment variable of LC_ALL, LC_CTYPE, or LANG that is set does not contain "UTF-8" or "UTF8". 😀 (we are not letting locale hold us back)
  • -V β€” Report the tmux version.
  • -v β€” Request verbose logging. Log messages will be saved into tmux-client-PID.log and tmux-server-PID.log files in the current directory, where PID is the PID of the server or client process. If -v is specified twice, an additional tmux-out-PID.log file is generated with a copy of everything tmux writes to the terminal.

The SIGUSR2 signal may be sent to the tmux server process to toggle logging between on (as if -v was given) and off. πŸ”₯

  • command [flags] β€” This specifies one of a set of commands used to control tmux, as described in the following sections. If no commands are specified, the command in default-client-command is assumed, which defaults to new-session.

πŸŽ€ DEFAULT KEY BINDINGS πŸŽ€

You can control tmux from an attached client with a prefix key β€” C-b (Ctrl-b) by default β€” followed by a command key. So it's like a little secret handshake: prefix, then the thing. πŸ’…

The default command key bindings are:

  • C-b β€” Send the prefix key (C-b) through to the application.
  • C-o β€” Rotate the panes in the current window forwards.
  • C-z β€” Suspend the tmux client.
  • ! β€” Break the current pane out of the window.
  • " β€” Split the current pane into two, top and bottom.
  • # β€” List all paste buffers.
  • $ β€” Rename the current session.
  • % β€” Split the current pane into two, left and right.
  • & β€” Kill the current window.
  • ' β€” Prompt for a window index to select.
  • ( β€” Switch the attached client to the previous session.
  • ) β€” Switch the attached client to the next session.
  • , β€” Rename the current window.
  • - β€” Delete the most recently copied buffer of text.
  • . β€” Prompt for an index to move the current window.
  • 0 to 9 β€” Select windows 0 to 9.
  • : β€” Enter the tmux command prompt.
  • ; β€” Move to the previously active pane.
  • = β€” Choose which buffer to paste interactively from a list.
  • ? β€” List all key bindings.
  • D β€” Choose a client to detach.
  • L β€” Switch the attached client back to the last session.
  • [ β€” Enter copy mode to copy text or view the history.
  • ] β€” Paste the most recently copied buffer of text.
  • c β€” Create a new window.
  • d β€” Detach the current client.
  • f β€” Prompt to search for text in open windows.
  • i β€” Display some information about the current window.
  • l β€” Move to the previously selected window.
  • m β€” Mark the current pane (see select-pane -m).
  • M β€” Clear the marked pane.
  • n β€” Change to the next window.
  • o β€” Select the next pane in the current window.
  • p β€” Change to the previous window.
  • q β€” Briefly display pane indexes.
  • r β€” Force redraw of the attached client.
  • s β€” Select a new session for the attached client interactively.
  • t β€” Show the time.
  • w β€” Choose the current window interactively.
  • x β€” Kill the current pane.
  • z β€” Toggle zoom state of the current pane.
  • { β€” Swap the current pane with the previous pane.
  • } β€” Swap the current pane with the next pane.
  • ~ β€” Show previous messages from tmux, if any.
  • Page Up β€” Enter copy mode and scroll one page up.
  • Up, Down, Left, Right β€” Change to the pane above, below, to the left, or to the right of the current pane.
  • M-1 to M-7 β€” Arrange panes in one of the seven preset layouts: even-horizontal, even-vertical, main-horizontal, main-horizontal-mirrored, main-vertical, main-vertical-mirrored, or tiled. 🌈
  • Space β€” Arrange the current window in the next preset layout.
  • M-n β€” Move to the next window with a bell or activity marker.
  • M-o β€” Rotate the panes in the current window backwards.
  • M-p β€” Move to the previous window with a bell or activity marker.
  • C-Up, C-Down, C-Left, C-Right β€” Resize the current pane in steps of one cell.
  • M-Up, M-Down, M-Left, M-Right β€” Resize the current pane in steps of five cells.

Key bindings may be changed with the bind-key and unbind-key commands. 🫢


✨ COMMAND PARSING AND EXECUTION ✨

okay so bestie, tmux has a TON of commands that control literally everything it does. πŸ’… Every command has a name and can take zero or more flags and arguments. You can bind them to a key with the bind-key command, or run them from your shell prompt, a shell script, a config file, or the command prompt. For example, the same set-option command run from the shell prompt, from ~/.tmux.conf, and bound to a key might look like:

$ tmux set-option -g status-style bg=cyan

set-option -g status-style bg=cyan

bind-key C set-option -g status-style bg=cyan

Here, the command name is set-option, -g is a flag, and status-style and bg=cyan are arguments. No cap. 🧒

tmux is lowkey obsessed with the difference between command parsing and execution. To execute a command, tmux needs it split up into its name and arguments. That's command parsing. If you run a command from the shell, the shell parses it; from inside tmux or from a config file, tmux does the parsing. Examples of when tmux parses commands are:

  • in a configuration file;
  • typed at the command prompt (see command-prompt);
  • given to bind-key;
  • passed as arguments to if-shell or confirm-before.

To execute commands, each client has a β€˜command queue’. A global command queue not attached to any client is used on startup for config files like ~/.tmux.conf. Parsed commands added to the queue are executed in order. Some commands, like if-shell and confirm-before, parse their argument to create a new command which is inserted immediately after themselves. This means arguments can be parsed twice or more β€” once when the parent command (like if-shell) is parsed, and again when it parses and executes its command. Commands like if-shell, run-shell, and display-panes stop execution of subsequent commands on the queue until something happens β€” if-shell and run-shell until a shell command finishes, and display-panes until a key is pressed. For example, the following commands:

new-session; new-window
if-shell "true" "split-window"
kill-session

Will execute new-session, new-window, if-shell, the shell command true(1), split-window, and kill-session in that order. Periodt. πŸ’…

The β€œCOMMANDS” section lists the tmux commands and their arguments.


🌸 PARSING SYNTAX 🌸

This section describes the syntax of commands parsed by tmux, for example in a configuration file or at the command prompt. Note that when commands are entered into the shell, they are parsed by the shell β€” see for example ksh(1) or csh(1). iykyk. πŸ¦‹

Each command is terminated by a newline or a semicolon (;). Commands separated by semicolons together form a β€˜command sequence’ β€” if a command in the sequence encounters an error, no subsequent commands are executed. So it's giving "one bad apple spoils the whole bunch". πŸ’€

It is recommended that a semicolon used as a command separator should be written as an individual token, for example from sh(1):

$ tmux neww \; splitw

Or:

$ tmux neww ';' splitw

Or from the tmux command prompt:

neww ; splitw

However, a trailing semicolon is also interpreted as a command separator, for example in these sh(1) commands:

$ tmux neww\; splitw

Or:

$ tmux 'neww;' splitw

As in these examples, when running tmux from the shell extra care must be taken to properly quote semicolons:

  1. Semicolons that should be interpreted as a command separator should be escaped according to the shell conventions. For sh(1) this typically means quoted (such as neww ';' splitw) or escaped (such as neww \; splitw).
  2. Individual semicolons or trailing semicolons that should be interpreted as arguments should be escaped twice: once according to the shell conventions and a second time for tmux; for example:
$ tmux neww 'foo\;' bar
$ tmux neww foo\\\; bar
  1. Semicolons that are not individual tokens or trailing another token should only be escaped once according to shell conventions; for example:
$ tmux neww 'foo-;-bar'
$ tmux neww foo-\;-bar

Comments are marked by the unquoted # character β€” any remaining text after a comment is ignored until the end of the line. So # is like the "not me" of syntax. πŸ™ˆ

If the last character of a line is \, the line is joined with the following line (the \ and the newline are completely removed). This is called line continuation and applies both inside and outside quoted strings and in comments, but not inside braces. Slay. ✨

Command arguments may be specified as strings surrounded by single (') quotes or double quotes ("), or as command lists surrounded by braces ({}). This is required when the argument contains any special character. Single and double quoted strings cannot span multiple lines except with line continuation. Braces can span multiple lines. Iconic. πŸ‘‘

Outside of quotes and inside double quotes, these replacements are performed:

  • Environment variables preceded by $ are replaced with their value from the global environment (see the β€œGLOBAL AND SESSION ENVIRONMENT” section).
  • A leading ~ or ~user is expanded to the home directory of the current or specified user.
  • \uXXXX or \uXXXXXXXX is replaced by the Unicode codepoint corresponding to the given four or eight digit hexadecimal number.
  • When preceded (escaped) by a \, the following characters are replaced: \e by the escape character; \r by a carriage return; \n by a newline; and \t by a tab.
  • \ooo is replaced by a character of the octal value ooo. Three octal digits are required, for example \001. The largest valid character is \377.
  • Any other characters preceded by \ are replaced by themselves (that is, the \ is removed) and are not treated as having any special meaning β€” so for example \; will not mark a command sequence and \$ will not expand an environment variable.

Braces are parsed as a configuration file (so conditions such as %if are processed) and then converted into a string. They are designed to avoid the need for additional escaping when passing a group of tmux commands as an argument (for example to if-shell). These two examples produce an identical command β€” note that no escaping is needed when using {}:

if-shell true {
    display -p 'brace-dollar-foo: }$foo'
}

if-shell true "display -p 'brace-dollar-foo: }\$foo'"

Braces may be enclosed inside braces, for example:

bind x if-shell "true" {
    if-shell "true" {
        display "true!"
    }
}

Environment variables may be set by using the syntax name=value, for example HOME=/home/user. Variables set during parsing are added to the global environment. A hidden variable may be set with %hidden, for example:

%hidden MYVAR=42

Hidden variables are not passed to the environment of processes created by tmux. See the β€œGLOBAL AND SESSION ENVIRONMENT” section. So secretive, main character energy. πŸ‘‘

Commands may be parsed conditionally by surrounding them with %if, %elif, %else and %endif. The argument to %if and %elif is expanded as a format (see β€œFORMATS”) and if it evaluates to false (zero or empty), subsequent text is ignored until the closing %elif, %else or %endif. For example:

%if "#{==:#{host},myhost}"
set -g status-style bg=red
%elif "#{==:#{host},myotherhost}"
set -g status-style bg=green
%else
set -g status-style bg=blue
%endif

Will change the status line to red if running on myhost, green if running on myotherhost, or blue if running on another host. Conditionals may be given on one line, for example:

%if #{==:#{host},myhost} set -g status-style bg=red %endif

πŸ’– COMMANDS πŸ’–

okay so bestie, welcome to the command section β€” it's literally the whole tmux menu, and it's iconic. Most commands accept the optional -t argument (and sometimes -s too) with one of target-client, target-session, target-window, or target-pane. These specify the client, session, window or pane that a command should affect. vibe check passed. ✨


target-client β€” okay so this one should be the name of the client, typically the pty(4) file to which the client is connected, for example either of /dev/ttyp1 or ttyp1 for the client attached to /dev/ttyp1. If no client is specified, tmux attempts to work out the client currently in use; if that fails, an error is reported. Clients may be listed with the list-clients command. no cap. πŸ’…

target-session is tried as, in order:

  1. A session ID prefixed with a $.
  2. An exact name of a session (as listed by the list-sessions command).
  3. The start of a session name, for example β€˜mysess’ would match a session named β€˜mysession’.
  4. A glob(7) pattern which is matched against the session name.

If the session name is prefixed with an β€˜=’, only an exact match is accepted (so β€˜=mysess’ will only match exactly β€˜mysess’, not β€˜mysession’). periodt.

If a single session is found, it is used as the target session; multiple matches produce an error. If a session is omitted, the current session is used if available; if no current session is available, the most recently used is chosen. lowkey useful. πŸ¦‹

target-window (or src-window or dst-window) specifies a window in the form session:window. The session follows the same rules as for target-session, and window is looked for in order as:

  1. A special token, listed below.
  2. A window index, for example β€˜mysession:1’ is window 1 in session β€˜mysession’.
  3. A window ID, such as @1.
  4. An exact window name, such as β€˜mysession:mywindow’.
  5. The start of a window name, such as β€˜mysession:mywin’.
  6. As a glob(7) pattern matched against the window name.

Like sessions, a β€˜=’ prefix will do an exact match only. An empty window name specifies the next unused index if appropriate (for example the new-window and link-window commands) otherwise the current window in session is chosen. it's giving precision. πŸŽ€

The following special tokens are available to indicate particular windows. Each has a single-character alternative form. πŸ‘‘

  • {start}, ^ β€” The lowest-numbered window
  • {end}, $ β€” The highest-numbered window
  • {last}, ! β€” The last (previously current) window
  • {next}, + β€” The next window by number
  • {previous}, - β€” The previous window by number

target-pane (or src-pane or dst-pane) may be a pane ID or takes a similar form to target-window but with the optional addition of a period followed by a pane index or pane ID, for example: β€˜mysession:mywindow.1’. If the pane index is omitted, the currently active pane in the specified window is used. The following special tokens are available for the pane index: 🌸

  • {last}, ! β€” The last (previously active) pane
  • {next}, + β€” The next pane by number
  • {previous}, - β€” The previous pane by number
  • {top} β€” The top pane
  • {bottom} β€” The bottom pane
  • {left} β€” The leftmost pane
  • {right} β€” The rightmost pane
  • {top-left} β€” The top-left pane
  • {top-right} β€” The top-right pane
  • {bottom-left} β€” The bottom-left pane
  • {bottom-right} β€” The bottom-right pane
  • {up-of} β€” The pane above the active pane
  • {down-of} β€” The pane below the active pane
  • {left-of} β€” The pane to the left of the active pane
  • {right-of} β€” The pane to the right of the active pane

The tokens β€˜+’ and β€˜-’ may be followed by an offset, for example:

select-window -t:+2

In addition, target-session, target-window or target-pane may consist entirely of the token β€˜{mouse}’ (alternative form β€˜=’) to specify the session, window or pane where the most recent mouse event occurred (see the β€œMOUSE SUPPORT” section) or β€˜{marked}’ (alternative form β€˜~’) to specify the marked pane (see select-pane -m). mouse girlies rise 🐭

Sessions, window and panes are each numbered with a unique ID; session IDs are prefixed with a β€˜$’, windows with a β€˜@’, and panes with a β€˜%’. These are unique and are unchanged for the life of the session, window or pane in the tmux server. The pane ID is passed to the child process of the pane in the TMUX_PANE environment variable. IDs may be displayed using the β€˜session_id’, β€˜window_id’, or β€˜pane_id’ formats (see the β€œFORMATS” section) and the display-message, list-sessions, list-windows or list-panes commands. iykyk ⭐

shell-command arguments are sh(1) commands. This may be a single argument passed to the shell, for example:

new-window 'vi ~/.tmux.conf'

Will run:

/bin/sh -c 'vi ~/.tmux.conf'

Additionally, the new-window, new-session, split-window, respawn-window and respawn-pane commands allow shell-command to be given as multiple arguments and executed directly (without β€˜sh -c’). This can avoid issues with shell quoting. For example:

$ tmux new-window vi ~/.tmux.conf

Will run vi(1) directly without invoking the shell. slay πŸ’–

command [argument ...] refers to a tmux command, either passed with the command and arguments separately, for example:

bind-key F1 set-option status off

Or passed as a single string argument in .tmux.conf, for example:

bind-key F1 { set-option status off }

Example tmux commands include:

refresh-client -t/dev/ttyp2

rename-session -tfirst newname

set-option -wt:0 monitor-activity on

new-window ; split-window -d

bind-key R source-file ~/.tmux.conf \; \
    display-message "source-file done"

Or from sh(1):

$ tmux kill-window -t :1

$ tmux new-window \; split-window -d

$ tmux new-session -d 'vi ~/.tmux.conf' \; split-window -d \; attach

✨ CLIENTS AND SESSIONS ✨

The tmux server manages clients, sessions, windows and panes. Clients are attached to sessions to interact with them, either when they are created with the new-session command, or later with the attach-session command. Each session has one or more windows linked into it. Windows may be linked to multiple sessions and are made up of one or more panes, each of which contains a pseudo terminal. Commands for creating, linking and otherwise manipulating windows are covered in the β€œWINDOWS AND PANES” section. main character energy πŸ‘‘

The following commands are available to manage clients and sessions:

attach-session [-dErx] [-c working-directory] [-f flags] [-t
        target-session]
        (alias: attach)

If you run it from outside tmux, it attaches you to target-session in whatever terminal you're sitting in rn. target-session has to already exist β€” if you wanna make a brand new session, go look at the new-session command (use -A to create-or-attach, that's the move). And if you're already inside tmux? It just switches your currently attached session over to target-session. πŸ’…

  • If -d is given, every other client attached to that session gets detached.
  • If -x is given, tmux sends SIGHUP to the parent process of the client as well as detaching the client, which typically makes it exit.
  • -f sets a comma-separated list of client flags.

The flags are:

  • active-pane β€” the client has an independent active pane
  • ignore-size β€” the client does not affect the size of other clients
  • no-detach-on-destroy β€” do not detach the client when the session it is attached to is destroyed if there are any other sessions
  • no-output β€” the client does not receive pane output in control mode
  • pause-after=seconds β€” output is paused once the pane is seconds behind in control mode
  • read-only β€” the client is read-only
  • wait-exit β€” wait for an empty line input before exiting in control mode

A leading ! turns a flag off if the client is already attached. And -r is literally just an alias for -f read-only,ignore-size, bestie. When a client is read-only, only keys bound to the detach-client or switch-client commands have any effect. A client with the active-pane flag lets the active pane be selected independently of the window's active pane that clients without the flag use β€” and ngl this only affects the cursor position and the commands issued from that client; other features like hooks and styles keep using the window's active pane. 🫢

If no server is started, attach-session will attempt to start it β€” but that's gonna fail unless sessions are created in the configuration file. 😭

The target-session rules for attach-session are slightly adjusted too: if tmux needs to select the most recently used session, it prefers the most recently used unattached session. ✨

-c sets the session working directory (the one used for new windows) to working-directory.

And if -E is used, the update-environment option will not be applied.


detach-client πŸ’…

detach-client [-aP] [-E shell-command] [-s target-session] [-t target-client]

(alias: detach)

Detaches the current client if you bound it to a key, or the client you name with -t, or all clients currently attached to the session you name with -s.

  • -a β€” kills all clients except the one given with -t
  • -P β€” send SIGHUP to the parent process of the client, typically causing it to exit
  • -E β€” run shell-command to replace the client

has-session πŸ•΅οΈ

has-session [-t target-session]

(alias: has)

Reports an error and exits with 1 if the specified session does not exist. If it does exist? Exits with 0. That's it, that's the whole vibe check. 🌸


kill-server πŸ’€

kill-server

Kills the tmux server and the clients, and destroys all sessions. Absolutely nuclear. No survivors. πŸ”₯


kill-session 😭

kill-session [-aC] [-t target-session]

Destroys the given session, closing any windows linked to it (and no other sessions), and detaching all clients attached to it.

  • -a β€” all sessions but the specified one get killed
  • -C β€” clears alerts (bell, activity, or silence) in all windows linked to the session

list-clients πŸ‘‘

list-clients [-F format] [-f filter] [-t target-session]

(alias: lsc)

Lists all clients attached to the server. -F specifies the format of each line and -f a filter β€” only clients for which the filter is true are shown. See the β€œFORMATS” section for the deets. If target-session is specified, it lists only clients connected to that session.


list-commands πŸ“œ

list-commands [-F format] [command]

(alias: lscm)

Lists the syntax of command, or β€” if you omit it β€” of all commands supported by tmux. Every single one. Iconic.


list-sessions πŸ¦‹

list-sessions [-F format] [-f filter]

(alias: ls)

Lists all sessions managed by the server. -F specifies the format of each line and -f a filter β€” only sessions for which the filter is true are shown. See the β€œFORMATS” section.


lock-client πŸ”’

lock-client [-t target-client]

(alias: lockc)

Locks target-client β€” see the lock-server command.


lock-session πŸ”

lock-session [-t target-session]

(alias: locks)

Locks all clients attached to target-session.


new-session βœ¨πŸ‘Ά

new-session [-AdDEPX] [-c start-directory] [-e environment] [-f flags] [-F format] [-n window-name] [-s session-name] [-t group-name] [-x width] [-y height] [shell-command [argument ...]]

(alias: new)

Creates a new session with name session-name. πŸ’–

The new session is attached to the current terminal unless -d is given. window-name and shell-command are the name of and the shell command to execute in the initial window. With -d, the initial size comes from the global default-size option β€” -x and -y can specify a different size. A - uses the size of the current client, if any. If -x or -y is given, the default-size option is set for the session. -f sets a comma-separated list of client flags (go read attach-session).

If run from a terminal, any termios(4) special characters are saved and used for new windows in the new session.

The -A flag makes new-session behave like attach-session if session-name already exists β€” and if -A is given, -D behaves like -d to attach-session, and -X behaves like -x to attach-session. πŸŽ€

If -t is given, it specifies a session group. Sessions in the same group share the same set of windows β€” new windows get linked to all sessions in the group, and any windows closed get removed from all sessions. The current and previous window and any session options stay independent, and any session in a group may be killed without affecting the others. The group-name argument may be:

  1. the name of an existing group, in which case the new session is added to that group;
  2. the name of an existing session β€” the new session is added to the same group as that session, creating a new group if necessary;
  3. the name for a new group containing only the new session.
Heads up bestie: -n and shell-command are invalid if -t is used.

The -P option prints information about the new session after it has been created. By default it uses the format β€˜#{session_name}:’ but a different format may be specified with -F. 🫢

If -E is used, the update-environment option will not be applied. -e takes the form β€˜VARIABLE=value’ and sets an environment variable for the newly created session β€” and yes, it may be specified multiple times. πŸ’…


refresh-client 🌈

refresh-client [-cDLRSU] [-A pane:state] [-B name:what:format] [-C size] [-f flags] [-l [target-pane]] [-r pane:report] [-t target-client] [adjustment]

(alias: refresh)

Refreshes the current client if bound to a key, or a single client if one is given with -t. If -S is specified, only the client's status line gets updated. ✨

The -U, -D, -L, -R, and -c flags let you change the visible portion of a window that's larger than the client. -U moves the visible part up by adjustment rows and -D down, -L left by adjustment columns and -R right. -c returns to tracking the cursor automatically. If adjustment is omitted, 1 is used. And ngl, note that the visible position is a property of the client, not of the window β€” so changing the current window in the attached session will reset it. πŸ™ˆ

-C sets the width and height of a control mode client or of a window for a control mode client. size must be one of β€˜widthxheight’ or β€˜window ID:widthxheight’, for example β€˜80x24’ or β€˜@0:80x24’. -A allows a control mode client to trigger actions on a pane β€” the argument is a pane ID (with a leading β€˜%’), a colon, then one of β€˜on’, β€˜off’, β€˜continue’ or β€˜pause’. If β€˜off’, tmux will not send output from the pane to the client and, if all clients have turned the pane off, will stop reading from the pane. If β€˜continue’, tmux will return to sending output to the pane if it was paused (manually or with the pause-after flag). If β€˜pause’, tmux will pause the pane. -A may be given multiple times for different panes. πŸ‘‘

-B sets a subscription to a format for a control mode client. The argument is split into three items by colons: name is a name for the subscription; what is a type of item to subscribe to; format is the format. After a subscription is added, changes to the format are reported with the %subscription-changed notification, at most once a second. If only the name is given, the subscription is removed. what may be empty to check the format only for the attached session, or one of: a pane ID such as β€˜%0’; β€˜%*’ for all panes in the attached session; a window ID such as β€˜@0’; or β€˜@*’ for all windows in the attached session. πŸ¦‹

-f sets a comma-separated list of client flags β€” see attach-session. -r allows a control mode client to provide information about a pane via a report (such as the response to OSC 10). The argument is a pane ID (with a leading β€˜%’), a colon, then a report escape sequence. πŸ’œ

-l requests the clipboard from the client using the xterm(1) escape sequence. If target-pane is given, the clipboard is sent (in encoded form), otherwise it is stored in a new paste buffer. πŸŽ€

-L, -R, -U and -D move the visible portion of the window left, right, up or down by adjustment, if the window is larger than the client. -c resets so that the position follows the cursor. See the window-size option.


rename-session 🏷️

rename-session [-t target-session] new-name

(alias: rename)

Renames the session to new-name. Glow-up complete. πŸ’…


server-access πŸšͺ

server-access [-adlrw] [user]

Changes the access or read/write permission of user. The user running the tmux server (its owner) and the root user cannot be changed and are always permitted access. Periodt. πŸ”₯

  • -a and -d β€” these give or revoke access for the specified user. And if that user is already attached, the -d flag makes their clients get detached. bye bestie πŸ’…
  • -r and -w β€” change the permissions for user: -r makes their clients read-only, -w makes them writable.
  • -l β€” lists the current access permissions.

By default, the access list is empty and tmux creates sockets with file system permissions that prevent access by any user other than the owner (and root, obviously). Those permissions have to be changed manually β€” so like, you gotta go do it yourself.

⚠️ Great care should be taken not to allow access to untrusted users, even read-only. Fr fr, do not let the sketchy ones in. 🚫

πŸ’¬ show-messages

(alias: showmsgs)

Show server messages or information. Messages are stored, up to a maximum of the limit set by the message-limit server option. -J and -T show debugging information about jobs and terminals. πŸ›

show-messages [-JT] [-t target-client]

πŸ—‚οΈ source-file

(alias: source)

Execute commands from one or more files specified by path β€” and yes, path can be glob(7) patterns, so you can be fancy with it. ✨

  • If -F is present, then path is expanded as a format.
  • If -q is given, no error will be returned if path does not exist. (quiet queen energy, we love her)
  • With -n, the file is parsed but no commands are executed.
  • -v shows the parsed commands and line numbers if possible.
source-file [-Fnqv] [-t target-pane] path ...

πŸš€ start-server

(alias: start)

Start the tmux server, if it isn't already running, without creating any sessions.

⚠️ Note that as by default the tmux server will exit with no sessions, this is only useful if a session is created in ~/.tmux.conf, exit-empty is turned off, or another command is run as part of the same command sequence. Like… otherwise you just start it and it immediately ghosts you. πŸ’€

For example:

$ tmux start \; show -g

😴 suspend-client

(alias: suspendc)

Suspend a client by sending SIGTSTP (tty stop). Nap time bestie πŸ›Œ

suspend-client [-t target-client]

πŸ”€ switch-client

(alias: switchc)

Switch the current session for client target-client to target-session. As a special case, -t may refer to a pane (a target that contains β€˜:’, β€˜.’ or β€˜%’), to change session, window and pane. In that case, -Z keeps the window zoomed if it was zoomed. πŸ‘‘

If -l, -n or -p is used, the client is moved to the last, next or previous session respectively. -r toggles the client read-only and ignore-size flags (see the attach-session command).

If -E is used, the update-environment option will not be applied.

-T sets the client's key table; the next key from the client will be interpreted from key-table. This may be used to configure multiple prefix keys, or to bind commands to sequences of keys. For example, to make typing β€˜abc’ run the list-keys command:

bind-key -Ttable2 c list-keys
bind-key -Ttable1 b switch-client -Ttable2
bind-key -Troot   a switch-client -Ttable1
switch-client [-ElnprZ] [-c target-client] [-t target-session] [-T key-table]

πŸͺŸ WINDOWS AND PANES πŸͺŸ

Each window displayed by tmux may be split into one or more panes; each pane takes up a certain area of the display and is a separate terminal. A window may be split into panes using the split-window command. Windows may be split horizontally (with the -h flag) or vertically. Panes may be resized with the resize-pane command (bound to β€˜C-Up’, β€˜C-Down’ β€˜C-Left’ and β€˜C-Right’ by default), the current pane may be changed with the select-pane command and the rotate-window and swap-pane commands may be used to swap panes without changing their position. Panes are numbered beginning from zero in the order they are created. πŸ”’

By default, a tmux pane permits direct access to the terminal contained in the pane. A pane may also be put into one of several modes:

  • Copy mode β€” which permits a section of a window or its history to be copied to a paste buffer for later insertion into another window. This mode is entered with the copy-mode command, bound to β€˜[’ by default. Copied text can be pasted with the paste-buffer command, bound to β€˜]’. πŸ“‹
  • View mode β€” which is like copy mode but is entered when a command that produces output, such as list-keys, is executed from a key binding. πŸ‘€
  • Choose mode β€” which allows an item to be chosen from a list. This may be a client, a session or window or pane, or a buffer. This mode is entered with the choose-buffer, choose-client and choose-tree commands. 🎯

In copy mode an indicator is displayed in the top-right corner of the pane with the current position and the number of lines in the history.

Commands are sent to copy mode using the -X flag to the send-keys command. When a key is pressed, copy mode automatically uses one of two key tables, depending on the mode-keys option: copy-mode for emacs, or copy-mode-vi for vi. Key tables may be viewed with the list-keys command. 🧠

The following commands are supported in copy mode:

  • append-selection β€” Append the selection to the top paste buffer.
  • append-selection-and-cancel β€” (vi: A) Append the selection to the top paste buffer and exit copy mode.
  • back-to-indentation β€” (vi: ^) (emacs: M-m) Move the cursor back to the indentation.
  • begin-selection β€” (vi: Space) (emacs: C-Space) Begin selection.
  • bottom-line β€” (vi: L) Move to the bottom line.
  • cancel β€” (vi: q) (emacs: Escape) Exit copy mode.
  • clear-selection β€” (vi: Escape) (emacs: C-g) Clear the current selection.
  • copy-end-of-line [-CP] [prefix] β€” Copy from the cursor position to the end of the line. prefix is used to name the new paste buffer.
  • copy-end-of-line-and-cancel [-CP] [prefix] β€” Copy from the cursor position and exit copy mode.
  • copy-pipe-end-of-line [-CP] [command] [prefix] β€” Copy from the cursor position to the end of the line and pipe the text to command. prefix is used to name the new paste buffer.
  • copy-pipe-end-of-line-and-cancel [-CP] [command] [prefix] β€” Same as copy-pipe-end-of-line but also exit copy mode.
  • copy-line [-CP] [prefix] β€” Copy the entire line.
  • copy-line-and-cancel [-CP] [prefix] β€” Copy the entire line and exit copy mode.
  • copy-pipe-line [-CP] [command] [prefix] β€” Copy the entire line and pipe the text to command. prefix is used to name the new paste buffer.
  • copy-pipe-line-and-cancel [-CP] [command] [prefix] β€” Same as copy-pipe-line but also exit copy mode.
  • copy-pipe [-CP] [command] [prefix] β€” Copy the selection, clear it and pipe its text to command. prefix is used to name the new paste buffer.
  • copy-pipe-no-clear [-CP] [command] [prefix] β€” Same as copy-pipe but do not clear the selection.
  • copy-pipe-and-cancel [-CP] [command] [prefix] β€” Same as copy-pipe but also exit copy mode.
  • copy-selection [-CP] [prefix] β€” Copies the current selection.
  • copy-selection-no-clear [-CP] [prefix] β€” Same as copy-selection but do not clear the selection.
  • copy-selection-and-cancel [-CP] [prefix] β€” (vi: Enter) (emacs: M-w) Copy the current selection and exit copy mode.
  • cursor-down β€” (vi: j) (emacs: Down) Move the cursor down.
  • cursor-down-and-cancel β€” Same as cursor-down but also exit copy mode if reaching the bottom.
  • cursor-left β€” (vi: h) (emacs: Left) Move the cursor left.
  • cursor-right β€” (vi: l) (emacs: Right) Move the cursor right.
  • cursor-up β€” (vi: k) (emacs: Up) Move the cursor up.
  • cursor-centre-vertical β€” (emacs: C-l) Moves the cursor to the vertical centre of the pane.
  • cursor-centre-horizontal β€” (emacs: M-l) Moves the cursor to the horizontal centre of the pane.
  • end-of-line β€” (vi: $) (emacs: C-e) Move the cursor to the end of the line.
  • goto-line line β€” (vi: :) (emacs: g) Move the cursor to a specific line.
  • halfpage-down β€” (vi: C-d) (emacs: M-Down) Scroll down by half a page.
  • halfpage-down-and-cancel β€” Same as halfpage-down but also exit copy mode if reaching the bottom.
  • halfpage-up β€” (vi: C-u) (emacs: M-Up) Scroll up by half a page.
  • history-bottom β€” (vi: G) (emacs: M->) Scroll to the bottom of the history.
  • history-top β€” (vi: g) (emacs: M-<) Scroll to the top of the history.
  • jump-again β€” (vi: ;) (emacs: ;) Repeat the last jump.
  • jump-backward to β€” (vi: F) (emacs: F) Jump backwards to the specified text.
  • jump-forward to β€” (vi: f) (emacs: f) Jump forward to the specified text.
  • jump-reverse β€” (vi: ,) (emacs: ,) Repeat the last jump in the reverse direction (forward becomes backward and backward becomes forward).
  • jump-to-backward to β€” (vi: T) Jump backwards, but one character less, placing the cursor on the character after the target.
  • jump-to-forward to β€” (vi: t) Jump forward, but one character less, placing the cursor on the character before the target.
  • jump-to-mark β€” (vi: M-x) (emacs: M-x) Jump to the last mark.
  • middle-line β€” (vi: M) (emacs: M-r) Move to the middle line.
  • next-matching-bracket β€” (vi: %) (emacs: M-C-f) Move to the next matching bracket.
  • next-paragraph β€” (vi: }) (emacs: M-}) Move to the next paragraph.
  • next-prompt [-o] β€” Move to the next prompt.
  • next-word β€” (vi: w) Move to the next word.
  • next-word-end β€” (vi: e) (emacs: M-f) Move to the end of the next word.
  • next-space β€” (vi: W) Same as next-word but use a space alone as the word separator.
  • next-space-end β€” (vi: E) Same as next-word-end but use a space alone as the word separator.
  • other-end β€” (vi: o) Switch at which end of the selection the cursor sits.
  • page-down β€” (vi: C-f) (emacs: PageDown) Scroll down by one page.
  • page-down-and-cancel β€” Same as page-down but also exit copy mode if reaching the bottom.
  • page-up β€” (vi: C-b) (emacs: PageUp) Scroll up by one page.
  • pipe [command] β€” Pipe the selected text to command and clear the selection.
  • pipe-no-clear [command] β€” Same as pipe but do not clear the selection.
  • pipe-and-cancel [command] [prefix] β€” Same as pipe but also exit copy mode.
  • previous-matching-bracket β€” (emacs: M-C-b) Move to the previous matching bracket.
  • previous-paragraph β€” (vi: {) (emacs: M-{) Move to the previous paragraph.
  • previous-prompt [-o] β€” Move to the previous prompt.
  • previous-word (vi: b) (emacs: M-b) β€” move the cursor back to the previous word πŸ¦‹
  • previous-space (vi: B) β€” literally the same as previous-word except it treats a lone space as the word separator πŸ’…
  • rectangle-on β€” turn rectangle selection mode ON ✨
  • rectangle-off β€” turn rectangle selection mode OFF πŸ™ˆ
  • rectangle-toggle (vi: v) (emacs: R) β€” flip rectangle selection mode on/off, no cap πŸŽ€
  • refresh-from-pane (vi: r) (emacs: r) β€” re-pull the content straight from the pane πŸ”„
  • scroll-bottom β€” scroll up until the line you're on is sitting at the bottom, while keeping the cursor parked on that same line πŸ‘‘
  • scroll-down (vi: C-e) (emacs: C-Down) β€” scroll down ⬇️
  • scroll-down-and-cancel β€” same as scroll-down but it also bails out of copy mode the moment the cursor hits the bottom πŸ’€
  • scroll-middle (vi: z) β€” scroll so the current line becomes the middle one, cursor stays put on that line 🌸
  • scroll-top β€” scroll down until the current line is at the top, again keeping the cursor on that line ⭐
  • scroll-up (vi: C-y) (emacs: C-Up) β€” scroll up ⬆️
  • search-again (vi: n) (emacs: n) β€” run that last search one more time πŸ”
  • search-backward text (vi: ?) β€” search backwards for the text you gave it πŸ”
  • search-backward-incremental text (emacs: C-r) β€” search backwards incrementally for text. It's meant to be used with the -i flag to the command-prompt command 🧚
  • search-backward-text text β€” search backwards for text as plain text, no regex nonsense πŸ’–
  • search-forward text (vi: /) β€” search forwards for text πŸ”Ž
  • search-forward-incremental text (emacs: C-s) β€” search forwards incrementally for text. Also expected to be paired with the -i flag to the command-prompt command ✨
  • search-forward-text text β€” search forwards for text as plain text πŸ“
  • search-reverse (vi: N) (emacs: N) β€” repeat the last search but flipped: forward becomes backward and backward becomes forward πŸ”„
  • select-line (vi: V) β€” select the whole current line πŸ‘‘
  • select-word β€” select the current word 🫢
  • selection-mode [char | word | line] β€” switch up the selection mode πŸ’…
  • set-mark (vi: X) (emacs: X) β€” drop a mark on the current line πŸ“
  • start-of-line (vi: 0) (emacs: C-a) β€” yeet the cursor to the start of the line ⬅️
  • stop-selection β€” stop selecting but do NOT clear the selection that's already there πŸ™ˆ
  • toggle-position (vi: P) (emacs: P) β€” toggle whether the position indicator shows in the top right πŸ‘€
  • top-line (vi: H) (emacs: M-R) β€” jump to the top line πŸ§—

okay so the search commands come in a whole little family, bestie, keep up 🌈 β€” search-forward and search-backward search for a regular expression; the -text variants search for a plain text string instead of a regex; the -incremental ones do an incremental search and expect to be used with the -i flag to the command-prompt command. Then search-again repeats the last search, and search-reverse does the same thing but flips the direction (forward becomes backward and backward becomes forward) πŸ’«

The default incremental search key bindings, C-r and C-s, are designed to emulate emacs(1) β€” when you first press them they let you type in a fresh search term, but if you press them with an empty search term they just repeat the search term you used last time πŸ”

The next-prompt and previous-prompt commands move between shell prompts, but here's the catch β€” they require the shell to emit an escape sequence (\033]133;A\033\\) to tell tmux where those prompts actually are. If your shell doesn't do that, these commands do literally nothing 😭. The -o flag jumps to the beginning of the command output instead of the shell prompt. Finding the beginning of command output requires the shell to emit an escape sequence (\033]133;C\033\\) to tell tmux where the output begins. And if the shell doesn't send these escape sequences at all, these commands do nothing. Periodt πŸ’€

Copy commands can take an optional buffer prefix argument, which is what generates the buffer name (the default is buffer, so buffers end up named buffer0, buffer1, and so on 🌸). Pipe commands take a command argument β€” that's the command the selected text gets piped into. The copy-pipe variants also copy the selection. The -and-cancel variants of some commands exit copy mode once they've finished (for copy commands) or when the cursor reaches the bottom (for scrolling commands). The -no-clear variants don't clear the selection. And all the copy commands can take the -C and -P flags: -C suppresses setting the terminal clipboard when copying, while -P suppresses adding a paste buffer with the text βœ‚οΈ

The next and previous word keys skip over whitespace and treat consecutive runs of either word separators or other letters as words. Word separators are customizable with the word-separators session option. Next word moves to the start of the next word, next word end moves to the end of the next word, and previous word moves to the start of the previous word. The three next and previous space keys work the same way but use a space alone as the word separator. And if you set word-separators to the empty string, next/previous word becomes equivalent to next/previous space 🫢

The jump commands are for quick movement within a line, and they ate πŸ’… β€” for example, typing f followed by / moves the cursor to the next / character on the current line, and then a ; jumps you to the next occurrence πŸ”₯

Commands in copy mode may be prefaced by an optional repeat count. With vi key bindings you enter a prefix using the number keys; with emacs, the Alt (meta) key plus a number begins prefix entry πŸ”’

The synopsis for the copy-mode command is:

copy-mode [-deHMqSu] [-s src-pane] [-t target-pane]

Enter copy mode πŸŽ€

  • -u enters copy mode and scrolls one page up, and -d scrolls one page down ⬆️⬇️
  • -H hides the position indicator in the top right πŸ™ˆ
  • -q cancels copy mode and any other modes 🚫
  • -M begins a mouse drag (only valid if it's bound to a mouse key binding, see β€œMOUSE SUPPORT”) πŸ–±οΈ
  • -S scrolls when bound to a mouse drag event; for example, copy-mode -Se is bound to MouseDrag1ScrollbarSlider by default ✨
  • -s copies from src-pane instead of target-pane 🫢
  • -e specifies that scrolling to the bottom of the history (to the visible screen) should exit copy mode. While in copy mode, pressing a key other than the ones used for scrolling will disable this behaviour. This is intended to allow fast scrolling through a pane's history, for example with:
bind PageUp copy-mode -eu
bind PageDown copy-mode -ed

A number of preset arrangements of panes are available β€” these are called layouts πŸ’–. You can pick one with the select-layout command or cycle through them with next-layout (bound to Space by default); once a layout is chosen, panes within it can be moved and resized like normal πŸ‘‘

The following layouts are supported:

  • even-horizontal β€” panes are spread out evenly from left to right across the window 🌈
  • even-vertical β€” panes are spread evenly from top to bottom πŸ¦‹
  • main-horizontal β€” a large (main) pane is shown at the top of the window, and the remaining panes are spread from left to right in the leftover space at the bottom. Use the main-pane-height window option to specify the height of the top pane πŸ‘‘
  • main-horizontal-mirrored β€” the same as main-horizontal but mirrored, so the main pane is at the bottom of the window πŸͺž
  • main-vertical β€” a large (main) pane is shown on the left of the window, and the remaining panes are spread from top to bottom in the leftover space on the right. Use the main-pane-width window option to specify the width of the left pane πŸ’…
  • main-vertical-mirrored β€” the same as main-vertical but mirrored, so the main pane is on the right of the window πŸͺž
  • tiled β€” panes are spread out as evenly as possible over the window in both rows and columns ⭐

In addition, select-layout may be used to apply a previously used layout β€” the list-windows command displays the layout of each window in a form suitable for use with select-layout. For example:

$ tmux list-windows
0: ksh [159x48]
    layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
$ tmux select-layout 'bb62,159x48,0,0{79x48,0,0,79x48,80,0}'

tmux automatically adjusts the size of the layout for the current window size ✨ Note that a layout cannot be applied to a window with more panes than the one from which the layout was originally defined β€” that's a hard no, bestie πŸ™…

Commands related to windows and panes are as follows:

break-pane

break-pane [-abdP] [-F format] [-n window-name] [-s src-pane] [-t dst-window]

(alias: breakp)

Break src-pane off from its containing window to make it the only pane in dst-window. With -a or -b, the window is moved to the next index after or before (existing windows are moved if necessary). If -d is given, the new window does not become the current window. The -P option prints information about the new window after it has been created. By default, it uses the format #{session_name}:#{window_index}.#{pane_index} but a different format may be specified with -F πŸ’–

capture-pane

capture-pane [-aepPqCJMN] [-b buffer-name] [-E end-line] [-S start-line] [-t target-pane]

(alias: capturep)

Capture the contents of a pane πŸ“Έ If -p is given, the output goes to stdout, otherwise to the buffer specified with -b or a new buffer if it's omitted. If -a is given, the alternate screen is used, and the history is not accessible. If no alternate screen exists, an error will be returned unless -q is given. Similarly, if the pane is in a mode, -M uses the screen for the mode. If -e is given, the output includes escape sequences for text and background attributes. -C also escapes non-printable characters as octal \xxx. -T ignores trailing positions that do not contain a character. -N preserves trailing spaces at each line's end and -J preserves trailing spaces and joins any wrapped lines; -J implies -T. -P captures only any output that the pane has received that is the beginning of an as-yet incomplete escape sequence πŸ‘€

  • -S β€” the starting line number. Zero is the first line of the visible pane, and negative numbers are lines up in the history. Passing - to -S means the start of the history. πŸ’–
  • -E β€” the ending line number. Same deal: zero is the first line of the visible pane, negatives reach back into the history, and - here means the end of the visible pane.

And the default, bestie, is to capture only the visible contents of the pane. No sneaky history, just the vibes you can literally see. ✨


🌸 choose-client 🌸

choose-client [-NryZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]

Okay so this one puts a pane into client mode, which lets you pick a client interactively from a list. Every client gets one line, no exceptions, and there's a shortcut key sitting on the left in brackets so you can just yolo your choice immediately. Orrr you can navigate the list and choose/manipulate stuff with the keys below. Main character behaviour. πŸ‘‘

  • -Z β€” zooms the pane. Bigger pane, bigger energy.
  • -y β€” disables any confirmation prompts. It's giving "no thoughts, just action".

Here's the key roster for client mode, memorise it iykyk:

  • Enter β€” Choose selected client
  • Up β€” Select previous client
  • Down β€” Select next client
  • C-s β€” Search by name
  • n β€” Repeat last search forwards
  • N β€” Repeat last search backwards
  • t β€” Toggle if client is tagged
  • T β€” Tag no clients
  • C-t β€” Tag all clients
  • d β€” Detach selected client
  • D β€” Detach tagged clients
  • x β€” Detach and HUP selected client
  • X β€” Detach and HUP tagged clients
  • z β€” Suspend selected client
  • Z β€” Suspend tagged clients
  • f β€” Enter a format to filter items
  • O β€” Change sort field
  • r β€” Reverse sort order
  • v β€” Toggle preview
  • q β€” Exit mode
Not me looking at x and X like… those detach and HUP the client, so don't tap them just to see what happens. πŸ’€

Once a client is chosen, %% gets replaced by the client name inside template, and the result runs as a command. And if template isn't given at all? Then "detach-client -t '%%'" is used. Simple as. πŸŽ€

Now the options, one by one:

  • -O β€” sets the initial sort field. It's one of name, size, creation (time), or activity (time). Pick your fighter. ⭐
  • -r β€” reverses the sort order. Flip it, flip it. πŸ”„
  • -f β€” sets an initial filter, and the filter is a format: if it evaluates to zero the item in the list is not shown, otherwise it is shown. And if a filter would lead to an empty list, it's just ignored β€” no drama, the list stays. πŸ’…
  • -F β€” sets the format for each item in the list.
  • -K β€” sets a format for each shortcut key.

Both -F and -K are evaluated once for each line, so yeah, per-line realness. ✨

  • -N β€” starts without the preview, or if you give it twice, starts with the larger preview. Double it for the big screen moment. 🌈
Heads up though: this command works only if at least one client is attached. No clients attached = no client mode, periodt. 😭
choose-tree [-GNrswyZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]

okay bestie, gather round, because choose-tree is genuinely one of the most underrated glow-ups in all of tmux πŸ’…

This one puts a pane into tree mode, where you get to pick a session, a window, or a pane interactively from a tree. Every session, window and pane gets its own little line β€” one line each, no crowding, we're not animals 🌸

And the way it's set up? There's a shortcut key sitting on the left in brackets so you can just smash that key and instantly grab the thing you want. Or, if you're feeling main character energy, you can navigate the whole tree and choose / manipulate items with the keys below. Both routes are valid, both are slay ✨

A couple of vibe-setting flags before we get into it:

  • -s starts with sessions collapsed
  • -w starts with windows collapsed
  • -Z zooms the pane
  • -y disables any confirmation prompts (no "are you sure" jumpscares πŸ™ˆ)

🌳 the tree mode keys 🌳

These are the keys that work once you're inside tree mode, bestie. Memorise them, screenshot them, tattoo them, whatever works for you πŸŽ€

  • Enter β€” Choose selected item
  • Up β€” Select previous item
  • Down β€” Select next item
  • S-Up β€” Swap the current window with the previous one
  • S-Down β€” Swap the current window with the next one
  • + β€” Expand selected item
  • - β€” Collapse selected item
  • M-+ β€” Expand all items
  • M-- β€” Collapse all items
  • x β€” Kill selected item
  • X β€” Kill tagged items
  • < β€” Scroll list of previews left
  • > β€” Scroll list of previews right
  • C-s β€” Search by name
  • m β€” Set the marked pane
  • M β€” Clear the marked pane
  • n β€” Repeat last search forwards
  • N β€” Repeat last search backwards
  • t β€” Toggle if item is tagged
  • T β€” Tag no items
  • C-t β€” Tag all items
  • : β€” Run a command for each tagged item
  • f β€” Enter a format to filter items
  • H β€” Jump to the starting pane
  • O β€” Change sort field
  • r β€” Reverse sort order
  • v β€” Toggle preview
  • q β€” Exit mode
lowkey X kills tagged items and x kills just the selected one β€” do not mix these up or you will be having a whole crisis 😭

Once a session, window or pane is chosen, the first instance of '%%' and all instances of '%1' are replaced by the target in template, and then the result gets executed as a command. Iconic. If template isn't given at all, this is what runs instead:

switch-client -t '%%'

Now the flags that shape your tree, bestie:

  • -O β€” specifies the initial sort field. Pick one of 'index', 'name', or 'time' (activity).
  • -r β€” reverses the sort order.
  • -f β€” specifies an initial filter. The filter is a format β€” if it evaluates to zero, that item in the list is not shown; otherwise it is shown. And if a filter would lead to an empty list, it's just ignored (no empty-tree tragedy here πŸ’–).
  • -F β€” specifies the format for each item in the tree.
  • -K β€” specifies a format for each shortcut key. Both -F and -K are evaluated once for each line.
  • -N β€” starts without the preview, or if you give it twice, with the larger preview.
  • -G β€” includes all sessions in any session groups in the tree, rather than only the first.
⚠️ heads up fr fr: this command works only if at least one client is attached. No client, no tree, no vibes πŸ¦‹


customize-mode</p> πŸ’…

customize-mode [-NZ] [-F format] [-f filter] [-t target-pane] [template]

okay bestie, this one is the glow-up station ✨ β€” it yeets a pane into customize mode, where you can browse and modify options and key bindings from a big list. The option values shown in that list are the ones for the active pane in the current window. -Z zooms the pane, because obviously.

Here's the keymap, and yes it's a whole vibe:

  • Enter β€” Set pane, window, session or global option value
  • Up β€” Select previous item
  • Down β€” Select next item
  • + β€” Expand selected item
  • - β€” Collapse selected item
  • M-+ β€” Expand all items
  • M-- β€” Collapse all items
  • s β€” Set option value or key attribute
  • S β€” Set global option value
  • w β€” Set window option value, if option is for pane and window
  • d β€” Set an option or key to the default
  • D β€” Set tagged options and tagged keys to the default
  • u β€” Unset an option (set to default value if global) or unbind a key
  • U β€” Unset tagged options and unbind tagged keys
  • C-s β€” Search by name
  • n β€” Repeat last search forwards
  • N β€” Repeat last search backwards
  • t β€” Toggle if item is tagged
  • T β€” Tag no items
  • C-t β€” Tag all items
  • f β€” Enter a format to filter items
  • v β€” Toggle option information
  • q β€” Exit mode

Now the flags, fr fr:

  • -f β€” specifies an initial filter. The filter is a format β€” if it evaluates to zero, that item in the list is not shown, otherwise it is shown. Sneaky detail: if a filter would lead to an empty list, it is ignored.
  • -F β€” specifies the format for each item in the tree.
  • -N β€” starts without the option information.
  • -t target-pane β€” the pane you're aiming at, obvi.
heads up 🫢 this command works only if at least one client is attached. no client, no customize mode, no slay.

display-panes</p> πŸ‘‘

display-panes [-bN] [-d duration] [-t target-client] [template]

alias: displayp

This pops up a visible indicator of every pane shown by target-client. Which colours? That's the display-panes-colour and display-panes-active-colour session options, look at them πŸ‘€

The indicator closes when:

  • a key is pressed (unless -N is given), or
  • duration milliseconds have passed.

If -d isn't given, display-panes-time is used instead. And a duration of zero means the indicator just stays there until a key is pressed. Patient king behavior πŸ’œ

While the indicator is on screen, you can pick a pane with the β€˜0’ to β€˜9’ keys β€” which causes template to be executed as a command with β€˜%%’ substituted by the pane ID. The default template is:

"select-pane -t '%%'"

With -b, other commands are not blocked from running until the indicator is closed. multitasking iconique ✨


find-window</p> πŸ”

find-window [-iCNrTZ] [-t target-pane] match-string

alias: findw

Search for a glob(7) pattern β€” or, with -r, a regular expression β€” in the form of match-string, looking through window names, titles, and visible content (but not history, bestie, don't get your hopes up 😭).

The flags control the matching behavior:

  • -C β€” matches only visible window contents
  • -N β€” matches only the window name
  • -T β€” matches only the window title
  • -i β€” makes the search ignore case
  • -r β€” treat match-string as a regular expression
  • -Z β€” zooms the pane

The default is -CNT. πŸ“Œ

this one also works only if at least one client is attached. same rule, every time 🫢

join-pane</p> 🧩

join-pane [-bdfhv] [-l size] [-s src-pane] [-t dst-pane]

alias: joinp

Like split-window, but plot twist πŸŽ€ β€” instead of splitting dst-pane and creating a new pane, it splits it and moves src-pane into the space. It's literally the reverse of break-pane, no cap.

  • -b β€” causes src-pane to be joined to the left of, or above, dst-pane.
  • -l size β€” the size, duh.
  • -s src-pane β€” the source.
  • -t dst-pane β€” the destination.
  • -d, -f, -h, -v β€” the usual suspects from split-window energy.

If -s is omitted and a marked pane is present (see select-pane -m), the marked pane is used rather than the current pane. so if you were wondering why your current pane isn't moving, that's why πŸ’€


kill-pane</p> πŸ’€

kill-pane [-a] [-t target-pane]

alias: killp

Destroys the given pane. And if no panes remain in the containing window, that window is also destroyed. bye bye, both of you 🫢

  • -a β€” kills all but the pane given with -t.

kill-window</p> πŸͺ¦

kill-window [-a] [-t target-window]

alias: killw

Kills the current window, or the window at target-window, removing it from any sessions to which it is linked. (yes, plural β€” it's linked, it's leaving all of them πŸ’…)

  • -a β€” kills all but the window given with -t.

last-pane</p> βͺ

last-pane [-deZ] [-t target-window]

alias: lastp

Selects the last (previously selected) pane. Time travel but make it panes πŸ¦‹

  • -Z β€” keeps the window zoomed if it was zoomed.
  • -e β€” enables input to the pane.
  • -d β€” disables input to the pane.

last-window</p> πŸͺŸ

last-window [-t target-session]

alias: last

Selects the last (previously selected) window. If no target-session is specified, it selects the last window of the current session. simple, iconic, does exactly what it says πŸ‘‘


link-window [-abdk] [-s src-window] [-t dst-window]

alias: linkw

Links the window at src-window to the specified dst-window. If dst-window is specified and no such window exists, the src-window is linked there. ✨

  • -a / -b β€” the window is moved to the next index after (-a) or before (-b) dst-window. Existing windows are moved if necessary. shuffling the deck, bestie πŸƒ
  • -k β€” if given and dst-window exists, it is killed; otherwise an error is generated. so -k is the "I meant it" flag πŸ’€
  • -d β€” the newly linked window is not selected.
  • -s src-window / -t dst-window β€” source and destination, you know the drill.

list-panes</p> πŸ“‹

list-panes [-as] [-F format] [-f filter] [-t target]

alias: lsp

  • If -a is given, target is ignored and all panes on the server are listed. all of them. every single one.
  • If -s is given, target is a session (or the current session).
  • If neither is given, target is a window (or the current window).
  • -F format β€” specifies the format of each line.
  • -f filter β€” a filter. Only panes for which the filter is true are shown.

See the β€œFORMATS” section, babe. πŸŽ€


list-windows</p> πŸ“‹βœ¨

list-windows [-a] [-F format] [-f filter] [-t target-session]

alias: lsw

  • If -a is given, list all windows on the server. Otherwise, list windows in the current session or in target-session.
  • -F format β€” specifies the format of each line.
  • -f filter β€” a filter. Only windows for which the filter is true are shown.

See the β€œFORMATS” section again. same section, different list 🫢


move-pane</p> 🚚

move-pane [-bdfhv] [-l size] [-s src-pane] [-t dst-pane]

alias: movep

Does the same as join-pane. that's it. that's the whole description. short queen behavior πŸ’…


move-window</p> πŸƒβ€β™€οΈ

move-window [-abrdk] [-s src-window] [-t dst-window]

alias: movew

This is similar to link-window, except the window at src-window is moved to dst-window (so it's not staying behind at the old spot, bestie, it packed its bags 🧳).

  • -r β€” all windows in the session are renumbered in sequential order, respecting the base-index option. number go up, order go clean ✨

new-window</p> 🌱

new-window [-abdkPS] [-c start-directory] [-e environment] [-F format]
           [-n window-name] [-t target-window]
           [shell-command [argument ...]]

alias: neww

…and hold that thought, because this one's description is rolling in with the next part πŸŽ€ don't go anywhere πŸ’–

okay so new windows, part two πŸ’– β€” you can drop a fresh window in exactly where you want it:

  • -a β€” new window slides in at the index right after the target-window
  • -b β€” new window slides in at the index right before the target-window

...and if that means other windows gotta shuffle up to make room, they shuffle. If you use neither of them, then target-window is just straight-up where the new window goes.

-d means the session does not make the new window the current window (so it stays lowkey in the background, no cap). target-window is the window you're creating; if it already exists you get an error 😭 β€” unless you pass -k, in which case the existing one gets destroyed. And if -S is given and a window named window-name already exists, that one just gets selected instead (unless -d is also chilling there, in which case the command does literally nothing, iconic).

shell-command is the command to execute. If you don't specify shell-command, tmux uses whatever the default-command option is set to. -c sets the working directory the new window gets created in.

When the shell command finishes, the window closes. See the remain-on-exit option if you want to change that behaviour 🫢

-e takes the form VARIABLE=value and sets an environment variable for the newly created window; you can use it as many times as you want.

The TERM environment variable must be set to screen or tmux for all programs running inside tmux. New windows automatically get TERM=screen added to their environment, but care must be taken not to reset this in shell start-up files or via the -e option.

-P prints info about the new window once it's been created. By default it uses the format #{session_name}:#{window_index}, but you can pick a different format with -F.


next-layout [-t target-window]

(alias: nextl)

Move a window to the next layout and rearrange the panes to fit. Slay, new arrangement unlocked ✨

next-window [-a] [-t target-session]

(alias: next)

Move to the next window in the session. If -a is used, move to the next window that has an alert πŸ’…

pipe-pane [-IOo] [-t target-pane] [shell-command]

(alias: pipep)

Pipe output sent by the program in target-pane to a shell command, or the other way around (vice versa, bestie). A pane can only be connected to one command at a time β€” any existing pipe is closed before shell-command runs. The shell-command string may contain the special character sequences supported by the status-left option. If no shell-command is given, the current pipe (if there is one) gets closed.

-I and -O pick which of the shell-command's output streams get connected to the pane:

  • -I β€” stdout is connected (so anything shell-command prints is written to the pane as if it were typed) ⌨️
  • -O β€” stdin is connected (so any output in the pane gets piped to shell-command)

Both can be used together, and if you specify neither, -O is used.

The -o option only opens a new pipe if no previous pipe exists β€” which lets you toggle a pipe with a single key, like this:

bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'

previous-layout [-t target-window]

(alias: prevl)

Move to the previous layout in the session. Going back in time, retro era πŸ¦‹

previous-window [-a] [-t target-session]

(alias: prev)

Move to the previous window in the session. With -a, move to the previous window that has an alert.

rename-window [-t target-window] new-name

(alias: renamew)

Rename the current window β€” or the window at target-window if you specified one β€” to new-name. Glow-up for your window title πŸ’–

resize-pane [-DLMRTUZ] [-t target-pane] [-x width] [-y height] [adjustment]

(alias: resizep)

Resize a pane up, down, left or right by adjustment using -U, -D, -L or -R β€” or to an absolute size with -x or -y. The adjustment is given in lines or columns (default is 1); -x and -y may be given as a number of lines or columns, or followed by % for a percentage of the window size (for example -x 10%). With -Z, the active pane toggles between zoomed (occupying the whole of the window) and unzoomed (its normal position in the layout).

-M begins mouse resizing β€” only valid if it's bound to a mouse key binding, see "MOUSE SUPPORT" 🐭

-T trims all lines below the current cursor position and moves lines out of the history to replace them.

resize-window [-aADLRU] [-t target-window] [-x width] [-y height] [adjustment]

(alias: resizew)

Resize a window up, down, left or right by adjustment using -U, -D, -L or -R β€” or to an absolute size with -x or -y. The adjustment is given in lines or cells (default is 1). -A sets the size to that of the largest session containing the window; -a sets it to the size of the smallest. This command will automatically set window-size to manual in the window options. No cap, it just does it πŸ’…

respawn-pane [-k] [-c start-directory] [-e environment] [-t target-pane] [shell-command [argument ...]]

(alias: respawnp)

Reactivate a pane in which the command has exited (see the remain-on-exit window option) β€” a lil resurrection moment ✨ If shell-command isn't given, the command used when the pane was created (or last respawned) is executed. The pane must already be inactive, unless -k is given, in which case any existing command gets killed. -c specifies a new working directory for the pane. The -e option has the same meaning as it does for the new-window command.

respawn-window [-k] [-c start-directory] [-e environment] [-t target-window] [shell-command [argument ...]]

(alias: respawnw)

Reactivate a window in which the command has exited (see the remain-on-exit window option). If shell-command isn't given, the command used when the window was created (or last respawned) is executed. The window must already be inactive, unless -k is given, in which case any existing command gets killed. -c specifies a new working directory for the window. The -e option has the same meaning as it does for the new-window command.

rotate-window [-DUZ] [-t target-window]

(alias: rotatew)

Rotate the positions of the panes within a window β€” either upward (numerically lower) with -U, or downward (numerically higher) with -D. -Z keeps the window zoomed if it was zoomed. Spinning them around like a carousel 🎠

select-layout [-Enop] [-t target-pane] [layout-name]

(alias: selectl)

Choose a specific layout for a window. If layout-name isn't given, the last preset layout used (if any) gets reapplied. -n and -p are equivalent to the next-layout and previous-layout commands. -o applies the last set layout if possible (so it undoes the most recent layout change). -E spreads the current pane and any panes next to it out evenly. aesthetic redistribution ✨

select-pane [-DdeLlMmRUZ] [-T title] [-t target-pane]

(alias: selectp)

Make pane target-pane the active pane in its window. If one of -D, -L, -R or -U is used, then respectively the pane below, to the left, to the right, or above the target pane is used. -Z keeps the window zoomed if it was zoomed. -l is the same as using the last-pane command. -e enables, and -d disables, input to the pane. -T sets the pane title.

-m and -M are used to set and clear the marked pane. There is only one marked pane at a time β€” setting a new marked pane clears the last one. The marked pane is the default target for -s to join-pane, move-pane, swap-pane and swap-window. Main character pane energy, honestly πŸ‘‘

select-window [-lnpT] [-t target-window]

(alias: selectw)

Select the window at target-window. -l, -n and -p are equivalent to the last-window, next-window and previous-window commands. If -T is given and the selected window is already the current window, the command behaves like last-window.

split-window [-bdfhIvPZ] [-c start-directory] [-e environment] [-F format] [-l size] [-t target-pane] [shell-command [argument ...]]

(alias: splitw)

Create a new pane by splitting target-pane:

  • -h β€” does a horizontal split
  • -v β€” does a vertical split
  • neither specified? -v is assumed πŸ’…

The -l option specifies the size of the new pane in lines (for a vertical split) or in columns (for a horizontal split); size may be followed by % to specify a percentage of the available space. The -b option causes the new pane to be created to the left of, or above, target-pane. The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane. -Z zooms if the window isn't zoomed, or keeps it zoomed if it already is.

An empty shell-command ('') will create a pane with no command running in it. Output can be sent to such a pane with the display-message command. The -I flag (if shell-command is not specified or is empty) will create an empty pane and forward any output from stdin to it. For example:

$ make 2>&1|tmux splitw -dI &

All other options have the same meaning as for the new-window command.

swap-pane [-dDUZ] [-s src-pane] [-t dst-pane]

(alias: swapp)

Swap two panes πŸ” If -U is used and no source pane is specified with -s, dst-pane is swapped with the previous pane (the one before it numerically); -D swaps with the next pane (the one after it numerically). -d instructs tmux not to change the active pane, and -Z keeps the window zoomed if it was zoomed.

If -s is omitted and a marked pane is present (see select-pane -m), the marked pane is used rather than the current pane.

swap-window [-d] [-s src-window] [-t dst-window]

(alias: swapw)

This is similar to link-window, except the source and destination windows get swapped instead. It's an error if no window exists at src-window. If -d is given, the new window does not become the current window.

If -s is omitted and a marked pane is present (see select-pane -m), the window containing the marked pane is used rather than the current window. πŸ‘€


unlink-window [-k] [-t target-window]

(alias: unlinkw)

Unlink target-window. πŸ’” Unless -k is given, a window may be unlinked only if it is linked to multiple sessions β€” windows may not be linked to no sessions, that's just not a thing bestie. But if -k is specified and the window is linked to only one session, it gets unlinked and destroyed. gone. reduced to atoms. πŸ’€


🎹 KEY BINDINGS 🎹

tmux lets a command be bound to pretty much most keys, with or without a prefix key. ✨ When you're specifying keys, most of them just represent themselves (like A to Z, cute and simple). Ctrl keys may be prefixed with C- or ^, Shift keys with S-, and Alt (meta) with M-. 🫢

And on top of that, these special key names are accepted, no cap:

  • Up, Down, Left, Right
  • BSpace, BTab
  • DC (Delete)
  • End, Enter, Escape
  • F1 to F12
  • Home
  • IC (Insert)
  • NPage/PageDown/PgDn
  • PPage/PageUp/PgUp
  • Space, and Tab
Heads up bestie: to bind the " or ' keys, quotation marks are necessary. 😭 Yes, quoting the quote. It's giving meta. For example:
bind-key '"' split-window
bind-key "'" new-window

A command bound to the Any key will execute for all keys which do not have a more specific binding. She's the understudy who knows every line. πŸ‘‘

Commands related to key bindings are as follows:

bind-key

bind-key [-nr] [-N note] [-T key-table] key [command [argument ...]]

(alias: bind)

Bind key to command. πŸ’… Keys are bound in a key table.

By default (so, without -T), the key is bound in the prefix key table. That table is what's used for keys pressed after the prefix key β€” for example, by default c is bound to new-window in the prefix table, so C-b c creates a new window. The root table is used for keys pressed without the prefix key: binding c to new-window in the root table (not recommended, bestie, I'm begging) means a plain c will create a new window. 😳

-n is an alias for -T root.

Keys may also be bound in custom key tables, and the switch-client -T command is used to switch to them from a key binding. πŸ¦‹

The -r flag indicates this key may repeat β€” see the initial-repeat-time and repeat-time options. -N attaches a note to the key (shown with list-keys -N), which can be cleared by passing an empty string. The -r and -N flags can be used without command to alter an existing binding. ✨

To view the default bindings and possible commands, see the list-keys command.

list-keys

list-keys [-1aN] [-P prefix-string] [-T key-table] [key]

(alias: lsk)

List key bindings. πŸ” There are two forms, okay so:

  • The default lists keys as bind-key commands.
  • -N lists only keys with attached notes, and shows only the key and note for each key.

With the default form, all key tables are listed by default. -T lists only keys in key-table.

With the -N form, only keys in the root and prefix key tables are listed by default; -T also lists only keys in key-table.

-P specifies a prefix to print before each key, and -1 lists only the first matching key. -a lists the command for keys that do not have a note, rather than skipping them. no key left behind fr fr 🫢

send-keys

send-keys [-FHKlMRX] [-c target-client] [-N repeat-count] [-t target-pane] [key ...]

(alias: send)

Send a key or keys to a window or client. πŸ“¨ Each argument key is the name of the key (such as C-a or NPage) to send; if the string is not recognised as a key, it is sent as a series of characters. If -K is given, keys are sent to target-client, so they are looked up in the client's key table, rather than to target-pane. All arguments are sent sequentially from first to last. If no keys are given and the command is bound to a key, then that key is used. 😌

The -l flag disables key name lookup and processes the keys as literal UTF-8 characters. The -H flag expects each key to be a hexadecimal number for an ASCII character. πŸ”’

The -R flag causes the terminal state to be reset. 🧼

-M passes through a mouse event (only valid if bound to a mouse key binding, see "MOUSE SUPPORT"). -X is used to send a command into copy mode β€” see the "WINDOWS AND PANES" section. -N specifies a repeat count and -F expands formats in arguments where appropriate. πŸ’–

send-prefix

send-prefix [-2] [-t target-pane]

Send the prefix key, or with -2 the secondary prefix key, to a window as if it was pressed. πŸŽ€

unbind-key

unbind-key [-anq] [-T key-table] key

(alias: unbind)

Unbind the command bound to key. -n and -T are the same as for bind-key. If -a is present, all key bindings are removed (clean slate bestie, total reset πŸŒͺ️). The -q option prevents errors being returned.


βš™οΈ OPTIONS βš™οΈ

The appearance and behaviour of tmux may be modified by changing the value of various options. ✨ Each option belongs to one or multiple scopes (server, session, window, and pane) and has a type (string, number, key, colour, flag, choice, or command).

Values of flag-type options may be one of: 1, on, yes, 0, off, or no. For possible choice values, see the respective option; for key options, the "KEY BINDINGS" section; and for colour options, the "STYLES" section. 🎨

The tmux server has a set of global server options which do not apply to any particular window or session or pane. These are altered with the set-option -s command, or displayed with the show-options -s command.

In addition, each individual session may have a set of session options, and there is a separate set of global session options. Sessions which do not have a particular option configured inherit the value from the global session options. 🌸 Session options are set or unset with the set-option command and may be listed with the show-options command. The available server and session options are listed under the set-option command.

Similarly, a set of window options is attached to each window and a set of pane options to each pane. Pane options inherit from window options. This means any pane option may be set as a window option to apply the option to all panes in the window without the option set β€” for example these commands will set the background colour to red for all panes except pane 0:

set -w window-style bg=red
set -pt:.0 window-style bg=blue

There is also a set of global window options from which any unset window or pane options are inherited. Window and pane options are altered with set-option -w and -p commands and displayed with show-option -w and -p.

tmux also supports user options which are prefixed with a @. πŸ’œ User options may have any name, so long as they are prefixed with @, and be set to any string. For example:

$ tmux set -wq @foo "abc123"
$ tmux show -wv @foo
abc123

Options are managed with these commands:

set-option

set-option [-aFgopqsuUw] [-t target-pane] option [value]

(alias: set)

Set a pane option with -p, a window option with -w, a server option with -s, otherwise a session option. If the option is not a user option, -w or -s may be unnecessary β€” tmux will infer the scope from the option name, assuming -w for pane options. If -g is given, the global session or window option is set. 🌍

-F expands formats in the option value. The -u flag unsets an option, so a session inherits the option from the global options (or with -g, restores a global option to the default). -U unsets an option (like -u) but if the option is a pane option, also unsets the option on any panes in the window. πŸ‘€

value depends on the option and its type, and can be omitted for flag and choice options to toggle its value (choice options toggle between the first two choices).

The -o flag prevents setting an option that is already set, and the -q flag suppresses errors about unknown or ambiguous options. 🀫

With -a, and if the option expects a string or a style, value is appended to the existing setting. For example:

set -g status-left "foo"
set -ag status-left "bar"

Will result in foobar. And:

set -g status-style "bg=red"
set -ag status-style "fg=blue"

Will result in a red background and blue foreground. Without -a, the result would be the default background and a blue foreground. ⚠️ yeah, no -a and you're starting from scratch, bestie.

show-options

show-options [-AgHpqsvw] [-t target-pane] [option]

(alias: show)

Show the pane options (or a single option if option is provided) with -p, the window options with -w, the server options with -s, otherwise the session options. If the option is not a user option, -w or -s may be unnecessary β€” tmux will infer the scope from the option name, assuming -w for pane options. Global session or window options are listed if -g is used. πŸ”

-v shows only the option value, not the name. If -q is set, no error will be returned if option is unset. -H includes hooks (omitted by default). -A includes options inherited from a parent set of options β€” such options are marked with an asterisk. ⭐


🌈 Available server options are:

backspace key

Set the key sent by tmux for backspace. ⌫

buffer-limit number

Set the number of buffers; as new buffers are added to the top of the stack, old ones are removed from the bottom if necessary to maintain this maximum length. πŸ“š it's giving a stack with boundaries.

command-alias[] name=value

This is an array of custom aliases for commands. If an unknown command matches name, it is replaced with value. For example, after:

set -s command-alias[100] zoom='resize-pane -Z'

Using:

zoom -t:.1

Is equivalent to:

resize-pane -Z -t:.1
Note that aliases are expanded when a command is parsed rather than when it is executed, so binding an alias with bind-key will bind the expanded form. 🫠 yes that matters, iykyk.

codepoint-widths[] string

An array option allowing widths of Unicode codepoints to be overridden. Note the new width applies to all clients. Each entry is of the form codepoint=width, where codepoint may be a UTF-8 character or an identifier of the form U+number where the number is a hexadecimal number. πŸ”’βœ¨

copy-command shell-command

Give the command to pipe to if the copy-pipe copy mode command is used without arguments. πŸ“‹

  • default-client-command command β€” the command tmux runs when you call it with no command at all. The default? new-session. periodt.
  • default-terminal terminal β€” sets the default terminal for new windows made in this session, aka the default value of the TERM environment variable. For tmux to actually work correctly, this has to be screen, tmux, or something derived from them. no random terminals bestie.
  • escape-time time β€” how long, in milliseconds, tmux waits after an escape gets input before it decides whether that escape is part of a function key or a meta key sequence.
  • editor shell-command β€” the command tmux uses when it runs an editor.
  • exit-empty [on | off] β€” if enabled (and yes, it's the default), the server dips out when there are no active sessions left.
  • exit-unattached [on | off] β€” if enabled, the server exits when there are no attached clients.
  • extended-keys [on | off | always] β€” controls how modified keys get reported, meaning keys pressed together with Control, Meta, or Shift. It's the equivalent of the modifyOtherKeys xterm(1) resource.

When set to on, the program inside the pane can request one of two modes: mode 1, which changes the sequence for only keys that don't already have a well-known representation; or mode 2, which changes the sequence for all keys. When set to always, modes 1 and 2 can still be requested by applications, but mode 1 gets forced instead of the standard mode. When set to off, this feature is disabled and only standard keys get reported.

tmux will always request extended keys itself if the terminal supports them. See also the extkeys feature for the terminal-features option, the extended-keys-format option and the pane_key_mode variable. iykyk πŸ’…

  • extended-keys-format [csi-u | xterm] β€” picks one of the two possible formats for reporting modified keys to applications. Equivalent of the formatOtherKeys xterm(1) resource. For example, C-S-a gets reported as ^[[27;6;65~ when set to xterm, and as ^[[65;6u when set to csi-u.
  • focus-events [on | off] β€” when enabled, focus events get requested from the terminal if supported and passed through to applications running inside tmux. Attached clients should be detached and attached again after you change this option, fr fr.
  • history-file path β€” if it's not empty, this is the file tmux writes command prompt history to on exit and loads it from on start.
  • input-buffer-size bytes β€” the max number of bytes allowed to be read in escape and control sequences. Once you hit it, the sequence gets discarded. gone. πŸ’€
  • message-limit number β€” how many error or information messages get saved in the message log for each client.
  • prompt-history-limit number β€” how many history items get saved in the history file for each type of command prompt.
  • set-clipboard [on | external | off] β€” attempts to set the terminal clipboard content using the xterm(1) escape sequence, if there's an Ms entry in the terminfo(5) description (check the β€œTERMINFO EXTENSIONS” section).

If set to on, tmux will both accept the escape sequence to create a buffer and attempt to set the terminal clipboard. If set to external, tmux will attempt to set the terminal clipboard but ignore attempts by applications to set tmux buffers. If off, tmux will neither accept the clipboard escape sequence nor attempt to set the clipboard.

Note that this feature needs to be enabled in xterm(1) by setting the resource: disallowedWindowOps: 20,21,SetXprop Or changing this property from the xterm(1) interactive menu when required.
  • terminal-features[] string β€” sets terminal features for terminal types read from terminfo(5). tmux has a whole set of named terminal features, and each one applies appropriate changes to the terminfo(5) entry in use. 🌈

tmux can detect features for a few common terminals; this option is here so you can easily tell tmux about features supported by terminals it can't detect. The terminal-overrides option lets you set individual terminfo(5) capabilities instead β€” terminal-features is intended for classes of functionality supported in a standard way but not reported by terminfo(5). Care must be taken to configure this only with features the terminal actually supports. don't lie to tmux bestie 😭

This is an array option where each entry is a colon-separated string made up of a terminal type pattern (matched using glob(7) patterns) followed by a list of terminal features. The available features are:

  • 256 β€” Supports 256 colours with the SGR escape sequences.
  • clipboard β€” Allows setting the system clipboard.
  • ccolour β€” Allows setting the cursor colour.
  • cstyle β€” Allows setting the cursor style.
  • extkeys β€” Supports extended keys.
  • focus β€” Supports focus reporting.
  • hyperlinks β€” Supports OSC 8 hyperlinks.
  • ignorefkeys β€” Ignore function keys from terminfo(5) and use the tmux internal set only.
  • margins β€” Supports DECSLRM margins.
  • mouse β€” Supports xterm(1) mouse sequences.
  • osc7 β€” Supports the OSC 7 working directory extension.
  • overline β€” Supports the overline SGR attribute.
  • rectfill β€” Supports the DECFRA rectangle fill escape sequence.
  • RGB β€” Supports RGB colour with the SGR escape sequences.
  • sixel β€” Supports SIXEL graphics.
  • strikethrough β€” Supports the strikethrough SGR escape sequence.
  • sync β€” Supports synchronized updates.
  • title β€” Supports xterm(1) title setting.
  • usstyle β€” Allows underscore style and colour to be set.
  • terminal-overrides[] string β€” lets terminal descriptions read using terminfo(5) get overridden. Each entry is a colon-separated string made up of a terminal type pattern (matched using glob(7) patterns) and a set of name=value entries.

For example, to set the clear terminfo(5) entry to \e[H\e[2J for all terminal types matching rxvt*:

rxvt*:clear=\e[H\e[2J

The terminal entry value gets passed through strunvis(3) before interpretation.

  • user-keys[] key β€” sets a list of user-defined key escape sequences. Each item is associated with a key named User0, User1, and so on.

For example:

set -s user-keys[0] "\e[5;30012~"
bind User0 resize-pane -L 3
  • variation-selector-always-wide [on | off] β€” always treats Unicode variation selector 16 as marking a wide character. This is a feature of some terminals as part of their Unicode 14 support.

Available session options are: πŸ¦‹

  • activity-action [any | none | current | other] β€” sets the action on window activity when monitor-activity is on. any means activity in any window linked to a session causes a bell or message (depending on visual-activity) in the current window of that session; none means all activity is ignored (same as monitor-activity being off); current means only activity in windows other than the current window is ignored; and other means activity in the current window is ignored but not the activity in other windows.
  • assume-paste-time milliseconds β€” if keys get entered faster than one per milliseconds, they're assumed to have been pasted rather than typed, and tmux key bindings are not processed. Default is one millisecond, and zero disables it.
  • base-index index β€” sets the base index from which an unused index gets searched when a new window is created. Default is zero.
  • bell-action [any | none | current | other] β€” sets the action on a bell in a window when monitor-bell is on. The values are the same as those for activity-action.
  • default-command shell-command β€” sets the command used for new windows (if it wasn't specified when the window was created) to shell-command, which may be any sh(1) command. The default is an empty string, which tells tmux to create a login shell using the value of the default-shell option.
  • default-shell path β€” specifies the default shell. This is used as the login shell for new windows when the default-command option is set to empty, and it must be the full path of the executable. When started, tmux tries to set a default value from the first suitable of the SHELL environment variable, the shell returned by getpwuid(3), or /bin/sh. This option should be configured when tmux is used as a login shell.
  • default-size XxY β€” sets the default size of new windows when the window-size option is set to manual, or when a session is created with new-session -d. The value is the width and height separated by an x character. Default is 80x24.
  • destroy-unattached [off | on | keep-last | keep-group] β€” if on, destroy the session after the last client has detached. If off (the default), leave the session orphaned. If keep-last, destroy the session only if it's in a group and has other sessions in that group. If keep-group, destroy the session unless it's in a group and is the only session in that group.
  • detach-on-destroy [off | on | no-detached | previous | next] β€” if on (the default), the client gets detached when the session it's attached to gets destroyed. If off, the client gets switched to the most recently active of the remaining sessions. If no-detached, the client gets detached only if there are no detached sessions; if detached sessions exist, the client gets switched to the most recently active. If previous or next, the client gets switched to the previous or next session in alphabetical order.
  • display-panes-active-colour colour β€” sets the colour used by the display-panes command to show the indicator for the active pane.
  • display-panes-colour colour β€” the colour that the display-panes command uses to paint the indicators for the panes you're not currently on (the inactive ones, the wallflowers πŸ’…).
  • display-panes-time time β€” how long, in milliseconds, those display-panes indicators stay on screen before they ghost πŸ‘».
  • display-time time β€” how long status line messages and other on-screen indicators hang around. Set it to 0 and they just... stay, until you press a key 😌. time is in milliseconds.
  • history-limit lines β€” the max number of lines kept in a window's history. > ⚠️ heads up bestie: this only applies to new windows. Existing window histories are not resized β€” they keep whatever limit they had at the moment they were created. no retroactive glow-ups here.
  • initial-repeat-time time β€” the time in milliseconds for the initial repeat when a key is bound with the -r flag. This is what lets you fire off multiple commands without smashing the prefix key again. See also repeat-time. If initial-repeat-time is zero, then repeat-time gets used for that very first key press.
  • key-table key-table β€” set the default key table to key-table instead of root. changing the whole vibe of your keys fr.
  • lock-after-time number β€” lock the session (like the lock-session command does) after number seconds of inactivity. The default is to not lock at all β€” that's a 0.
  • lock-command shell-command β€” the command to run when locking each client. The default is to run lock(1) with -np.
  • menu-style style β€” sets the menu style. Peep the β€œSTYLES” section for how to specify a style ✨
  • menu-selected-style style β€” sets the style of the selected menu item. Again, β€œSTYLES” section has the how-to.
  • menu-border-style style β€” sets the menu border style. β€œSTYLES” section, you know the drill πŸŽ€
  • menu-border-lines type β€” sets what kind of characters get used to draw menu borders. See popup-border-lines for the possible values of border-lines.
  • message-command-style style β€” sets the status line message command style. This one's for the command prompt with vi(1) keys while you're in command mode. How to specify a style? β€œSTYLES” section, bestie.
  • message-line [0 | 1 | 2 | 3 | 4] β€” which line the status line messages and the command prompt get shown on.
  • message-style style β€” sets the status line message style. This covers messages and the command prompt. β€œSTYLES” section for the deets.
  • mouse [on | off] β€” if on, tmux captures the mouse and lets mouse events be bound as key bindings πŸ–±οΈ. See the β€œMOUSE SUPPORT” section for the full scoop.
  • prefix key β€” sets the key accepted as the prefix key. On top of the standard keys described under β€œKEY BINDINGS”, prefix can be set to the special key None to set no prefix at all (chaos mode, respect).
  • prefix2 key β€” sets a secondary key accepted as a prefix key. Just like prefix, prefix2 can be set to None.
  • prefix-timeout time β€” the time in milliseconds that tmux waits after the prefix is input before it dismisses it. Can be set to zero to disable any timeout entirely.
  • prompt-cursor-colour colour β€” sets the colour of the cursor in the command prompt.
  • prompt-cursor-style style β€” sets the style of the cursor in the command prompt. Check the cursor-style options for the available styles.
  • renumber-windows [on | off] β€” if on, then when a window is closed in a session, tmux automatically renumbers the other windows in numerical order πŸ”’. This respects the base-index option if you've set it. If off, no renumbering β€” the numbers just stay where they are.
  • repeat-time time β€” lets you enter multiple commands without pressing the prefix key again, within the given time in milliseconds (default is 500). Whether a key actually repeats can be set when it's bound using the -r flag to bind-key. Repeat is enabled for the default keys bound to the resize-pane command. Also peep the initial-repeat-time option.
  • set-titles [on | off] β€” attempts to set the client terminal title using the tsl and fsl terminfo(5) entries, if they exist. tmux automatically sets these to the \e]0;...\007 sequence if the terminal appears to be xterm(1). This option is off by default.
  • set-titles-string string β€” the string used to set the client terminal title when set-titles is on. Formats get expanded, see the β€œFORMATS” section.
  • silence-action [any | none | current | other] β€” sets the action on window silence when monitor-silence is on. The values are the same as the ones for activity-action.
  • status [off | on | 2 | 3 | 4 | 5] β€” show or hide the status line, or specify how big it is πŸ“. Using on gives you a status line one row tall; 2, 3, 4 or 5 give you more rows.
  • status-format[] format β€” specify the format to be used for each line of the status line. The default builds the top status line from the various individual status options below.
  • status-interval interval β€” update the status line every interval seconds. By default updates happen every 15 seconds. A setting of zero disables redrawing at interval.
  • status-justify [left | centre | right | absolute-centre] β€” sets the position of the window list in the status line: left, centre or right. centre puts the window list in the relative centre of the available free space; absolute-centre uses the centre of the entire horizontal space. precision placement, iconic 🎯
  • status-keys [vi | emacs] β€” use vi or emacs-style key bindings in the status line, like at the command prompt. The default is emacs, unless the VISUAL or EDITOR environment variables are set and contain the string vi.
  • status-left string β€” the display string (by default the session name) shown to the left of the status line. string gets passed through strftime(3). Also see the β€œFORMATS” and β€œSTYLES” sections.

For details on how the names and titles can be set, see the β€œNAMES AND TITLES” section.

Examples are:

#(sysctl vm.loadavg)
#[fg=yellow,bold]#(apm -l)%%#[default] [#S]

The default is [#S].

  • status-left-length length β€” sets the maximum length of the left component of the status line. The default is 10.
  • status-left-style style β€” sets the style of the left part of the status line. How to specify a style? β€œSTYLES” section πŸŽ€
  • status-position [top | bottom] β€” sets the position of the status line.
  • status-right string β€” the display string for the right of the status line. By default, the current pane title in double quotes, plus the date and the time, are shown. Same as with status-left, string gets passed to strftime(3) and character pairs get replaced.
  • status-right-length length β€” sets the maximum length of the right component of the status line. The default is 40.
  • status-right-style style β€” sets the style of the right part of the status line. β€œSTYLES” section for how, bestie.
  • status-style style β€” sets the status line style. For how to specify a style, see the β€œSTYLES” section.
  • update-environment[] variable β€” sets the list of environment variables to be copied into the session environment when a new session is created or an existing session is attached. Any variables that don't exist in the source environment get set to be removed from the session environment (as if -r was given to the set-environment command).
  • visual-activity [on | off | both] β€” if on, display a message instead of sending a bell when activity happens in a window that has the monitor-activity window option enabled. If set to both, you get a bell and a message. double the drama, double the fun πŸ’–
  • visual-bell [on | off | both] β€” if on, a message is shown on a bell in a window that has the monitor-bell window option enabled, instead of the bell being passed through to the terminal (which would normally make a sound). If set to both, a bell and a message are produced. Also see the bell-action option.
  • visual-silence [on | off | both] β€” if monitor-silence is enabled, prints a message after the interval has expired on a given window, instead of sending a bell. If set to both, a bell and a message are produced.
  • word-separators string β€” sets the session's whole conception of which characters count as word separators, for the purposes of the next and previous word commands in copy mode.

✨ Available window options are ✨

  • aggressive-resize [on | off] β€” aggressively resize the chosen window 😀. What that means: tmux resizes the window to the size of the smallest or largest session (see the window-size option) for which it is the current window, rather than the session it's attached to. The window may resize when the current window is changed on another session. This option is good for full-screen programs that support SIGWINCH, and poor for interactive programs such as shells.
  • automatic-rename [on | off] β€” controls automatic window renaming. When this setting is enabled, tmux renames the window automatically using the format specified by automatic-rename-format. This flag is automatically disabled for an individual window when a name is specified at creation with new-window or new-session, or later with rename-window, or with a terminal escape sequence. It may be switched off globally with:
set-option -wg automatic-rename off
  • automatic-rename-format format β€” the format (see β€œFORMATS”) used when the automatic-rename option is enabled.
  • clock-mode-colour colour β€” sets the clock colour πŸ•°οΈ
  • clock-mode-style [12 | 24 | 12-with-seconds | 24-with-seconds] β€” sets the clock hour format.
  • fill-character character β€” sets the character used to fill areas of the terminal that a window isn't using.
  • main-pane-height height β€” ...and that's exactly where the manpage cuts us off mid-sentence bestie 😭 the rest of this one is coming in the next part, don't you worry 🫢
  • main-pane-width width β€” sets how wide (or tall) that main pane is in the main-horizontal, main-horizontal-mirrored, main-vertical, or main-vertical-mirrored layouts β€” y'know, the big left-or-top one that's lowkey the main character πŸ‘‘. Slap a % on the end and it's a percentage of the window size instead.
  • copy-mode-match-style style β€” the style of your search matches in copy mode ✨. Wanna know how to write a style? Go read the β€œSTYLES” section bestie.
  • copy-mode-mark-style style β€” styles the line that's holding your mark in copy mode πŸŽ€. Style syntax lives in β€œSTYLES”.
  • copy-mode-current-match-style style β€” the style for the current search match in copy mode (yes, it gets its own spotlight πŸ’…). See β€œSTYLES” for how to specify it.
  • copy-mode-position-format format β€” the format of that little position indicator in copy mode.
  • mode-keys [vi | emacs] β€” pick your copy mode keybinding flavor: vi or emacs. Default is emacs, unless VISUAL or EDITOR has vi in it, then it's not πŸ’€.
  • copy-mode-position-style style β€” styles the position indicator in copy mode. Style how-to: β€œSTYLES” section, always.
  • copy-mode-selection-style style β€” styles your selection in copy mode πŸ¦‹. β€œSTYLES” section has the deets.
  • mode-style style β€” sets the style for window modes in general. Yep, β€œSTYLES” section.
  • monitor-activity [on | off] β€” keeps an eye out for activity in the window πŸ‘€. Windows with activity get highlighted in the status line, periodt.
  • monitor-bell [on | off] β€” watches for a bell in the window πŸ””. Windows with a bell get highlighted in the status line too.
  • monitor-silence [interval] β€” watches for silence (no activity at all) in the window within interval seconds 🀫. Windows that have been quiet for that long get highlighted in the status line. Set the interval to zero and the monitoring is off.
  • other-pane-height height β€” sets the height of the other panes (so, not the main one) in the main-horizontal and main-horizontal-mirrored layouts. If it's set to 0 (which is the default), it does literally nothing πŸ™ˆ. If both main-pane-height and other-pane-height are set, the main pane grows taller to make the other panes the specified height β€” but it will never shrink to do it, no cap. Add a % suffix and it's a percentage of the window size.
  • other-pane-width width β€” exactly like other-pane-height but it sets the width of other panes in the main-vertical and main-vertical-mirrored layouts.
  • pane-active-border-style style β€” the pane border style for the pane that's currently active πŸ”₯. Style syntax: β€œSTYLES” section. Attributes are ignored, fyi.
  • pane-base-index index β€” like base-index, but it sets the starting index for pane numbers.
  • pane-border-format format β€” the text that shows up in pane border status lines.
  • pane-border-indicators [off | colour | arrows | both] β€” shows which pane is active by colouring only half the border (in windows with exactly two panes), by drawing arrow markers, by doing both, or by doing neither 🎯.
  • pane-border-lines type β€” picks the character type used to draw pane borders. type can be one of:
    • single β€” single lines using ACS or UTF-8 characters
    • double β€” double lines using UTF-8 characters
    • heavy β€” heavy lines using UTF-8 characters
    • simple β€” simple ASCII characters
    • number β€” the pane number
    • spaces β€” space characters

Also: double and heavy will fall back to standard ACS line drawing when UTF-8 isn't supported, jsyk.

  • pane-border-status [off | top | bottom] β€” turns pane border status lines off, or sets where they sit (top or bottom).
  • pane-border-style style β€” the pane border style for every pane except the active one. β€œSTYLES” section for syntax. Attributes are ignored.
  • popup-style style β€” sets the popup style πŸ’œ. Check the β€œSTYLES” section for how to specify it. Attributes are ignored.
  • popup-border-style style β€” sets the popup border style. β€œSTYLES” section again. Attributes ignored, always.
  • popup-border-lines type β€” the character type used for drawing popup borders. type can be one of:
    • single β€” single lines using ACS or UTF-8 characters (this is the default)
    • rounded β€” a variation of single with rounded corners using UTF-8 characters
    • double β€” double lines using UTF-8 characters
    • heavy β€” heavy lines using UTF-8 characters
    • simple β€” simple ASCII characters
    • padded β€” simple ASCII space character
    • none β€” no border at all πŸ™ˆ

And same as before: double and heavy fall back to standard ACS line drawing when UTF-8 isn't supported.

  • pane-scrollbars [off | modal | on] β€” when it's enabled, a character-based scrollbar shows up on the left or right of every pane. The filled section of that scrollbar, aka the β€œslider”, shows the position and size of the visible part of the pane content πŸ“œ.

Set it to on and the scrollbar is there all the time. Set it to modal and it only appears when the pane is in copy mode or view mode. Whenever the scrollbar is visible, the pane gets narrowed by the scrollbar's width and the text inside gets reflowed. If it's modal, the pane only gets narrowed while the scrollbar is visible.

Also peep pane-scrollbars-style while you're here.

  • pane-scrollbars-style style β€” sets the scrollbars style. β€œSTYLES” section, you know the drill. The foreground colour is used for the slider, the background for the rest of the scrollbar. The width attribute sets how wide the scrollbar is and the pad attribute sets the padding between the scrollbar and the pane. Every other attribute is ignored.
  • pane-scrollbars-position [left | right] β€” picks which side of the pane the scrollbars show up on.
  • pane-status-current-style style β€” status line style for the currently active pane. β€œSTYLES” section ✨.
  • pane-status-style style β€” status line style for a single pane. β€œSTYLES” section.
  • session-status-current-style style β€” status line style for the currently active session πŸ’…. β€œSTYLES” section.
  • session-status-style style β€” status line style for a single session. β€œSTYLES” section.
  • tiled-layout-max-columns number β€” caps how many columns the tiled layout can have. A value of 0 (the default) means no limit at all. When there is a limit, panes get arranged so they don't exceed that column count, with any extra panes stacked into additional rows 🧱.
  • window-status-activity-style style β€” status line style for windows with an activity alert. β€œSTYLES” section.
  • window-status-bell-style style β€” status line style for windows with a bell alert. β€œSTYLES” section.
  • window-status-current-format string β€” just like window-status-format, except it's the format used when the window is the current window.
  • window-status-current-style style β€” status line style for the currently active window πŸ‘‘. β€œSTYLES” section.
  • window-status-format string β€” sets the format the window is displayed with in the status line window list. Go read the β€œFORMATS” and β€œSTYLES” sections.
  • window-status-last-style style β€” status line style for the last active window. β€œSTYLES” section.
  • window-status-separator string β€” the separator drawn between windows in the status line. The default is a single space character.
  • window-status-style style β€” status line style for a single window. β€œSTYLES” section.
  • window-size largest | smallest | manual | latest β€” configures how tmux figures out the window size πŸ“. Set it to largest and it uses the size of the largest attached session; smallest and it uses the smallest. manual means a new window's size comes from the default-size option and windows get resized automatically. With latest, tmux uses the size of the client that had the most recent activity. Also go look at the resize-window command and the aggressive-resize option.
  • wrap-search [on | off] β€” if this is set, searches wrap around the end of the pane contents πŸ”„. Default is on.

Available pane options are: 🫢

  • allow-passthrough [on | off | all] β€” lets programs inside the pane bypass tmux using a terminal escape sequence (\ePtmux;...\e\\). If it's on, passthrough sequences are only allowed when the pane is visible. If it's all, they're allowed even when the pane is invisible πŸ‘».
  • allow-rename [on | off] β€” lets programs inside the pane change the window name using a terminal escape sequence (\ek...\e\\).
  • allow-set-title [on | off] β€” lets programs inside the pane change the title using the terminal escape sequences (\e]2;...\e\\ or \e]0;...\e\\).
  • alternate-screen [on | off] β€” configures whether programs running inside the pane can use the terminal alternate screen feature, which is what allows the smcup and rmcup terminfo(5) capabilities. The alternate screen feature preserves the window's contents when an interactive application starts and restores them on exit, so whatever output was visible before the app started reappears unchanged after it exits πŸͺ„.
  • cursor-colour colour β€” sets the colour of the cursor.
  • cursor-style style β€” sets the style of the cursor. The available styles are: default, blinking-block, block, blinking-underline, underline, blinking-bar, bar.
  • pane-colours[] colour β€” the default colour palette 🎨. Each entry in the array defines the colour tmux uses when the colour with that index is requested. The index can be anywhere from zero to 255.
  • remain-on-exit [on | off | failed] β€” bestie, when this is on, a pane does NOT get destroyed just because the program inside it exited. If you set it to failed, it only holds onto the pane when the program's exit status is not zero (aka it flopped 😭). Wanna bring the pane back to life? Hit it with the respawn-pane command. πŸ’«
  • remain-on-exit-format string β€” this sets the text that shows up at the bottom of exited panes, but only when remain-on-exit is enabled. It's giving little epitaph vibes. πŸͺ¦
  • scroll-on-clear [on | off] β€” when the whole screen gets cleared and this is on, tmux scrolls all the screen contents into the history before wiping it. So nothing gets lost, periodt. ✨
  • synchronize-panes [on | off] β€” duplicates your input into all the other panes in the same window that also have this option on. Lowkey a superpower. 🫢 Note: it only applies to panes that aren't in any mode.
  • window-active-style style β€” sets the pane style when that pane is the active one. Wanna know how to specify a style? Go read the β€œSTYLES” section, iykyk. πŸ’…
  • window-style style β€” sets the pane style, full stop. Same deal: how to specify it lives in the β€œSTYLES” section. πŸŽ€

πŸͺ HOOKS πŸͺ

Okay so this is the fun part. tmux lets you run commands on all kinds of triggers, and those triggers are called hooks. Most tmux commands have an after hook, and there are also a bunch of hooks that aren't tied to any command at all. ✨

Hooks are stored as array options, and when a hook fires, its members get executed in order. Just like options, different hooks can be global or belong to a session, window or pane. You configure hooks with the set-hook or set-option commands, and you look at them with show-hooks or show-options -H. These two commands are literally equivalent, no cap:

set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'

Setting a hook without specifying an array index clears the hook and sets the first member of the array. Fresh start energy. 🧼

A command's after hook runs once the command finishes β€” except when the command is being run as part of a hook itself (nested hooks don't trigger after hooks, noted πŸ“). They're named with an after- prefix. For example, this command adds a hook that selects the even-vertical layout after every split-window:

set-hook -g after-split-window "selectl even-vertical"

If a command fails, the command-error hook fires. For example, you could use it to write to a log file:

set-hook -g command-error "run-shell \"echo 'a tmux command failed' >>/tmp/log\""

All the notifications listed in the β€œCONTROL MODE” section are hooks too (without any arguments), with the exception of %exit. On top of those, here are the additional hooks available: πŸ‘‘

  • alert-activity β€” runs when a window has activity. See monitor-activity.
  • alert-bell β€” runs when a window has received a bell. See monitor-bell.
  • alert-silence β€” runs when a window has been silent. See monitor-silence.
  • client-active β€” runs when a client becomes the latest active client of its session.
  • client-attached β€” runs when a client is attached.
  • client-detached β€” runs when a client is detached.
  • client-focus-in β€” runs when focus enters a client.
  • client-focus-out β€” runs when focus exits a client.
  • client-resized β€” runs when a client is resized.
  • client-session-changed β€” runs when a client's attached session is changed.
  • client-light-theme β€” runs when a client switches to a light theme. β˜€οΈ
  • client-dark-theme β€” runs when a client switches to a dark theme. πŸŒ™
  • command-error β€” runs when a command fails. 😭
  • pane-died β€” runs when the program running in a pane exits, but remain-on-exit is on so the pane hasn't closed yet.
  • pane-exited β€” runs when the program running in a pane exits.
  • pane-focus-in β€” runs when the focus enters a pane, if the focus-events option is on.
  • pane-focus-out β€” runs when the focus exits a pane, if the focus-events option is on.
  • pane-set-clipboard β€” runs when the terminal clipboard is set using the xterm(1) escape sequence.
  • session-created β€” runs when a new session is created.
  • session-closed β€” runs when a session is closed.
  • session-renamed β€” runs when a session is renamed.
  • window-layout-changed β€” runs when a window layout is changed.
  • window-linked β€” runs when a window is linked into a session.
  • window-renamed β€” runs when a window is renamed.
  • window-resized β€” runs when a window is resized. Heads up: this may fire after the client-resized hook has run. ⏱️
  • window-unlinked β€” runs when a window is unlinked from a session.

Hooks are managed with these commands:

  • set-hook [-agpRuw] [-t target-pane] hook-name [command] β€” without -R, this sets (or, with -u, unsets) the hook hook-name to command. The flags are the same as the ones for set-option. With -R, it runs hook-name immediately. πŸ”₯
  • show-hooks [-gpw] [-t target-pane] [hook] β€” shows hooks. The flags are the same as for show-options. πŸ‘€

🐭 MOUSE SUPPORT 🐭

If the mouse option is on (and ngl, the default is off), tmux lets you bind mouse events as keys. Each key's name is made up of a mouse event (like MouseUp1) plus a location suffix. Here are all the location suffixes, bestie: ✨

  • Pane β€” the contents of a pane
  • Border β€” a pane border
  • Status β€” the status line window list
  • StatusLeft β€” the left part of the status line
  • StatusRight β€” the right part of the status line
  • StatusDefault β€” any other part of the status line
  • ScrollbarSlider β€” the scrollbar slider
  • ScrollbarUp β€” above the scrollbar slider
  • ScrollbarDown β€” below the scrollbar slider

And these are the mouse events you've got to work with:

  • WheelUp, WheelDown
  • MouseDown1, MouseUp1, MouseDrag1, MouseDragEnd1
  • MouseDown2, MouseUp2, MouseDrag2, MouseDragEnd2
  • MouseDown3, MouseUp3, MouseDrag3, MouseDragEnd3
  • SecondClick1, SecondClick2, SecondClick3
  • DoubleClick1, DoubleClick2, DoubleClick3
  • TripleClick1, TripleClick2, TripleClick3

Okay so the SecondClick events are fired for the second click of a double click, even if there might be a third click coming that will fire TripleClick instead of DoubleClick. The drama of it all. πŸ’€

Each event should be suffixed with a location, like MouseDown1Status for example. 🎯

The special token {mouse} or = can be used as target-window or target-pane in commands bound to mouse key bindings. It resolves to the window or pane the mouse event actually happened over. For example: the window in the status line that button 1 was released over for a MouseUp1Status binding, or the pane the wheel was scrolled over for a WheelDownPane binding. So smart, honestly. 🧠

The send-keys -M flag can be used to forward a mouse event to a pane. 🫰

The default key bindings let the mouse select and resize panes, copy text, and change windows using the status line. These take effect if the mouse option is turned on. Main character mouse energy, fr fr. πŸ­πŸ’–

✨ FORMATS ✨

Okay bestie, this is the part where tmux gets fancy. Some commands take a -F flag with a format argument β€” that's just a lil string that controls how the command's output gets printed. πŸ’…

Format variables live inside #{ and }, like #{session_name}. The full list of variables is in the table below, but you can also just drop in the name of a tmux option to get that option's value, or the name of an environment variable. Some variables have a shorter alias, like #S. And there's some escape-y business:

  • ## gets replaced by a single #
  • #, gets replaced by a ,
  • #} gets replaced by a }

πŸŽ€ Conditionals

Conditionals happen when you slap a ? on the front. For each pair of two arguments: if the variable in the first of the pair exists and is not zero, the second of the pair is chosen β€” otherwise it keeps going. If no condition from the paired arguments matches, the default value is chosen. If there's an unpaired final argument, that's the default. And if there isn't one, the default is the empty string. ✨

Some examples, fr:

  • #{?session_attached,attached,not attached} will include the string attached if the session is attached, and the string not attached if it's unattached
  • #{?automatic-rename,yes,no} will include yes if automatic-rename is enabled, or no if not
  • #{?#{n:window_name},#{window_name} - } will include the window name with a dash separator if there is a window name, or the empty string if the window name is empty
  • #{?session_format,format1,window_format,format2,format3} will include format1 for a session format, format2 for a window format, or format3 for neither a session nor a window format

Conditionals can be nested arbitrarily β€” go off. But heads up: inside a conditional, , and } must be escaped as #, and #}, unless they're part of a #{...} replacement. Like, for example:

#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W

πŸ’– Comparisons & boolean stuff

String comparisons? Easy. Just prefix two comma-separated alternatives with ==, !=, <, >, <= or >= and a colon. So #{==:#{host},myhost} gets replaced by 1 if you're running on myhost, otherwise by 0.

  • || and && evaluate to true if any or all of the comma-separated alternatives are true, e.g. #{||:#{pane_in_mode},#{alternate_on}}
  • ! evaluates to true if the value is false and vice versa, e.g. #{!:#{pane_in_mode}}
  • !! converts a value to a canonical boolean form β€” 1 for true, 0 for false. So #{!!:non-empty string} evaluates to 1

πŸ¦‹ Pattern matching

An m specifies a glob(7) pattern or regular expression comparison. First argument is the pattern, second is the string to compare. An optional argument specifies flags:

  • r means the pattern is a regular expression instead of the default glob(7) pattern
  • i means ignore case

For example: #{m:*foo*,#{host}} or #{m/ri:^A,MYVAR}.

A C performs a search for a glob(7) pattern or regular expression in the pane content and evaluates to zero if it's not found, or a line number if it is. Like m, an r flag means search for a regular expression, and i ignores case. For example: #{C/r:^Start}


πŸ”₯ Numeric operators

Math time, bestie. Numeric operators work by prefixing two comma-separated alternatives with an e and an operator. An optional f flag can go after the operator to use floating point numbers β€” otherwise integers are used. That can be followed by a number giving how many decimal places to use for the result.

The available operators are:

  • addition +
  • subtraction -
  • multiplication *
  • division /
  • modulus m or % (note that % must be escaped as %% in formats which are also expanded by strftime(3))
  • numeric comparison operators ==, !=, <, <=, > and >=

For example, #{e|*|f|4:5.5,3} multiplies 5.5 by 3 for a result with four decimal places, and #{e|%%:7,3} returns the modulus of 7 and 3.

  • a replaces a numeric argument by its ASCII equivalent, so #{a:98} results in b
  • c replaces a tmux colour by its six-digit hexadecimal RGB value

🌸 Slicing, padding, counting, repeating

You can cap how long the resulting string gets by prefixing it with =, a number and a colon. Positive numbers count from the start of the string, negative from the end.

  • #{=5:pane_title} will include at most the first five characters of the pane title
  • #{=-5:pane_title} will include the last five characters

A suffix or prefix can be given as a second argument β€” if provided, it gets appended or prepended to the string if the length has been trimmed. So #{=/5/...:pane_title} will append ... if the pane title is more than five characters. 🌈

Similarly, p pads the string to a given width: #{p10:pane_title} will result in a width of at least 10 characters. A positive width pads on the left, a negative one pads on the right.

  • n expands to the length of the variable, e.g. #{n:window_name}
  • w expands to its width when displayed
  • R repeats the first argument by a number of times given by the second argument, so #{R:a,3} will result in aaa

πŸ’œ Time, paths, escaping, expansion

Prefixing a time variable with t: converts it to a string. So if #{window_activity} gives 1445765102, then #{t:window_activity} gives Sun Oct 25 09:25:02 2015. Adding p (t/p) will use a shorter but less accurate time format for times in the past. A custom format may be given using an f suffix (note that % must be escaped as %% if the format is separately being passed through strftime(3), for example in the status-left option): #{t/f/%%H#:%%M:window_activity} β€” see strftime(3). ⭐

  • b: and d: prefixes are basename(3) and dirname(3) of the variable respectively
  • q: will escape sh(1) special characters, or with an h suffix, escape hash characters (so # becomes ##)
  • E: will expand the format twice β€” for example #{E:status-left} is the result of expanding the content of the status-left option rather than the option itself
  • T: is like E: but also expands strftime(3) specifiers
  • S:, W:, P: or L: will loop over each session, window, pane or client and insert the format once for each

L:, S: and W: can take an optional sort argument: /i, /n, /t to sort by index, name, or last activity time; additionally /r to sort in reverse order. /r can also be used with P: to reverse the sort order by pane index. For example, S/nr: sorts sessions by name in reverse order. πŸ‘‘

For each, two comma-separated formats may be given: the second is used for the current window, active pane, or active session. For example, to get a list of windows formatted like the status line:

#{W:#{E:window-status-format} ,#{E:window-status-current-format} }

N: checks if a window (without any suffix or with the w suffix) or a session (with the s suffix) name exists β€” for example N/w:foo is replaced with 1 if a window named foo exists.


🧚 Substitutions & stacking modifiers

A prefix of the form s/foo/bar/: will substitute foo with bar throughout. The first argument may be an extended regular expression, and a final argument may be i to ignore case β€” for example s/a(.)/\1x/i: would change abABab into bxBxbx. A different delimiter character may also be used, to avoid collisions with literal slashes in the pattern. For example, s|foo/|bar/|: will substitute foo/ with bar/ throughout. πŸ“

Multiple modifiers may be separated with a semicolon (;) as in #{T;=10:status-left}, which limits the resulting strftime(3)-expanded string to at most 10 characters.


πŸ’€ Shell commands in formats

In addition, the last line of a shell command's output may be inserted using #(). For example, #(uptime) will insert the system's uptime. 😭

When constructing formats, tmux does not wait for #() commands to finish; instead, the previous result from running the same command is used, or a placeholder if the command has not been run before. If the command hasn't exited, the most recent line of output will be used, but the status line will not be updated more than once a second. Commands are executed using /bin/sh and with the tmux global environment set (see the β€œGLOBAL AND SESSION ENVIRONMENT” section).


πŸ™ˆ Literal strings

An l specifies that a string should be interpreted literally and not expanded. For example #{l:#{?pane_in_mode,yes,no}} will be replaced by #{?pane_in_mode,yes,no}. No cap. πŸ’…

okay bestie, here's the big list of variables you can drop into your formats, where appropriate. Some of them have an alias too β€” none of the ones in this chunk do, but stay tuned. ✨

  • active_window_index β€” the index of the active window in the session πŸ‘‘
  • alternate_on β€” 1 if the pane is hanging out in the alternate screen
  • alternate_saved_x β€” saved cursor X in the alternate screen
  • alternate_saved_y β€” saved cursor Y in the alternate screen
  • buffer_created β€” when the buffer was created πŸŽ€
  • buffer_full β€” the full buffer content, the whole thing
  • buffer_name β€” name of the buffer
  • buffer_sample β€” a lil sample of the start of the buffer πŸ“
  • buffer_size β€” size of the specified buffer, in bytes
  • client_activity β€” the time the client last had activity
  • client_cell_height β€” height of each client cell, in pixels
  • client_cell_width β€” width of each client cell, in pixels
  • client_control_mode β€” 1 if the client is in control mode
  • client_created β€” the time the client was created 🌱
  • client_discarded β€” bytes discarded when the client fell behind 😭
  • client_flags β€” the list of client flags
  • client_height β€” height of the client
  • client_key_table β€” the current key table
  • client_last_session β€” name of the client's last session
  • client_name β€” name of the client
  • client_pid β€” PID of the client process
  • client_prefix β€” 1 if the prefix key has been pressed πŸ’…
  • client_readonly β€” 1 if the client is read-only
  • client_session β€” name of the client's session
  • client_termfeatures β€” the client's terminal features, if any
  • client_termname β€” terminal name of the client
  • client_termtype β€” terminal type of the client, if available
  • client_tty β€” the pseudo terminal of the client
  • client_uid β€” UID of the client process
  • client_user β€” user of the client process
  • client_utf8 β€” 1 if the client supports UTF-8 🌈
  • client_width β€” width of the client
  • client_written β€” bytes written to the client
  • command β€” name of the command in use, if any
  • command_list_alias β€” command alias if
  • command_list_name β€” the command's name, when you're listing commands πŸ’…
  • command_list_usage β€” the command's usage, also when you're listing commands
  • config_files β€” the list of configuration files that got loaded πŸ“‚
  • cursor_blinking β€” 1 if the cursor is blinking, bestie ✨
  • copy_cursor_hyperlink β€” the hyperlink sitting under the cursor in copy mode πŸ”—
  • copy_cursor_line β€” the line the cursor is on in copy mode
  • copy_cursor_word β€” the word under the cursor in copy mode
  • copy_cursor_x β€” cursor X position in copy mode
  • copy_cursor_y β€” cursor Y position in copy mode
  • current_file β€” the current configuration file πŸ“„
  • cursor_character β€” the character at the cursor in the pane
  • cursor_colour β€” the cursor colour in the pane 🎨
  • cursor_flag β€” the pane cursor flag
  • cursor_shape β€” the cursor shape in the pane
  • cursor_very_visible β€” 1 if the cursor is in very visible mode πŸ‘€
  • cursor_x β€” cursor X position in the pane
  • cursor_y β€” cursor Y position in the pane
  • history_bytes β€” number of bytes in the window history
  • history_limit β€” maximum window history lines
  • history_size β€” size of history in lines
  • hook β€” name of the running hook, if there is one πŸͺ
  • hook_client β€” name of the client where the hook was run, if any
  • hook_pane β€” ID of the pane where the hook was run, if any
  • hook_session β€” ID of the session where the hook was run, if any
  • hook_session_name β€” name of the session where the hook was run, if any
  • hook_window β€” ID of the window where the hook was run, if any
  • hook_window_name β€” name of the window where the hook was run, if any
  • host (#H) β€” hostname of the local host πŸ–₯️
  • host_short (#h) β€” hostname of the local host, minus the domain name
  • insert_flag β€” the pane insert flag
  • keypad_cursor_flag β€” the pane keypad cursor flag
  • keypad_flag β€” the pane keypad flag
  • last_session_index β€” index of the last session
  • last_window_index β€” index of the last window in the session
  • line β€” the line number in the list πŸ“‹
  • loop_last_flag β€” 1 if this is the last window, pane, session, or client in the W:, P:, S:, or L: loop πŸ”
  • mouse_all_flag β€” pane mouse all flag 🐭
  • mouse_any_flag β€” pane mouse any flag
  • mouse_button_flag β€” pane mouse button flag
  • mouse_hyperlink β€” the hyperlink under the mouse, if any πŸ”—
  • mouse_line β€” the line under the mouse, if any
  • mouse_sgr_flag β€” pane mouse SGR flag
  • mouse_standard_flag β€” pane mouse standard flag
  • mouse_status_line β€” which status line the mouse event took place on
  • mouse_status_range β€” the range type or argument of the mouse event on the status line
  • mouse_utf8_flag β€” pane mouse UTF-8 flag
  • mouse_word β€” the word under the mouse, if any πŸ”€
  • mouse_x β€” mouse X position, if any
  • mouse_y β€” mouse Y position, if any
  • next_session_id β€” the unique session ID that the next new session is gonna get πŸ†”
  • origin_flag β€” pane origin flag
  • pane_active β€” 1 if this is the active pane ✨
  • pane_at_bottom β€” 1 if the pane is chillin' at the bottom of the window
  • pane_at_left β€” 1 if the pane is at the left of the window
  • pane_at_right β€” 1 if the pane is at the right of the window
  • pane_at_top β€” 1 if the pane is at the top of the window
  • pane_bg β€” pane background colour 🎨
  • pane_bottom β€” the bottom of the pane
  • pane_current_command β€” the current command, if available
  • pane_current_path β€” the current path, if available πŸ“
  • pane_dead β€” 1 if the pane is dead πŸ’€
  • pane_dead_signal β€” the exit signal of the process in a dead pane
  • pane_dead_status β€” the exit status of the process in a dead pane
  • pane_dead_time β€” the exit time of the process in a dead pane ⏰
  • pane_fg β€” pane foreground colour
  • pane_format β€” 1 if the format is for a pane
  • pane_height β€” the height of the pane πŸ“
  • pane_id β€” the unique pane ID, and yes bestie it's got an alias: #D πŸ‘‘
  • pane_in_mode β€” the number of modes the pane is in

More format variables, bestie β€” same energy, no skips πŸ’–

  • pane_index (#P) β€” the index of the pane, like its little number in the lineup πŸ’…
  • pane_input_off β€” 1 if input to the pane is disabled (so it's just vibing, not taking orders) πŸ™ˆ
  • pane_key_mode β€” the extended key reporting mode in this pane
  • pane_last β€” 1 if it's the last pane
  • pane_left β€” the left of the pane
  • pane_marked β€” 1 if this is the marked pane ✨
  • pane_marked_set β€” 1 if a marked pane is set
  • pane_mode β€” the name of the pane mode, if there is one
  • pane_path β€” the path of the pane (and yes, the application can set it) πŸ“
  • pane_pid β€” the PID of the first process in the pane
  • pane_pipe β€” 1 if the pane is being piped
  • pane_right β€” the right of the pane
  • pane_search_string β€” the last search string in copy mode πŸ”
  • pane_start_command β€” the command the pane was started with
  • pane_start_path β€” the path the pane was started with
  • pane_synchronized β€” 1 if the pane is synchronized
  • pane_tabs β€” the pane's tab positions
  • pane_title (#T) β€” the title of the pane (the application can set this too) ✨
  • pane_top β€” the top of the pane
  • pane_tty β€” the pseudo terminal of the pane
  • pane_unseen_changes β€” 1 if there were changes in the pane while in mode
  • pane_width β€” the width of the pane
  • pid β€” the server PID
  • rectangle_toggle β€” 1 if rectangle selection is activated
  • scroll_position β€” the scroll position in copy mode
  • scroll_region_lower β€” the bottom of the scroll region in the pane
  • scroll_region_upper β€” the top of the scroll region in the pane
  • search_count β€” the count of search results
  • search_count_partial β€” 1 if the search count is a partial count
  • search_match β€” the search match, if there is one
  • search_present β€” 1 if a search started in copy mode
  • selection_active β€” 1 if a selection started and changes with the cursor in copy mode
  • selection_end_x β€” the X position of the end of the selection
  • selection_end_y β€” the Y position of the end of the selection
  • selection_present β€” 1 if selection
mid-table energy rn πŸ’€ β€” the row above got cut off, but its tail said "started in copy mode". carry on bestie ✨
  • selection_start_x β€” the X position where your selection starts
  • selection_start_y β€” the Y position where your selection starts
  • server_sessions β€” how many sessions the server has
  • session_active β€” 1 if the session is active
  • session_activity β€” the time the session was last active
  • session_activity_flag β€” 1 if any window in the session has activity
  • session_alerts β€” list of window indexes that have alerts
  • session_attached β€” number of clients this session is attached to
  • session_attached_list β€” list of clients this session is attached to
  • session_bell_flag β€” 1 if any window in the session has a bell
  • session_created β€” the time the session was created
  • session_format β€” 1 if the format is for a session
  • session_group β€” name of the session group
  • session_group_attached β€” number of clients that the sessions in the group are attached to
  • session_group_attached_list β€” list of clients that the sessions in the group are attached to
  • session_group_list β€” list of the sessions in the group
  • session_group_many_attached β€” 1 if multiple clients are attached to the sessions in the group
  • session_group_size β€” size of the session group
  • session_grouped β€” 1 if the session is in a group
  • session_id β€” the unique session ID πŸ†”
  • session_index β€” the index of the session
  • session_last_attached β€” the time the session was last attached
  • session_many_attached β€” 1 if multiple clients are attached
  • session_marked β€” 1 if this session contains the marked pane πŸ“Œ
  • session_name, #S β€” the name of the session ✨
  • session_path β€” the working directory of the session
  • session_silence_flag β€” 1 if any window in the session has a silence alert 🀫
  • session_stack β€” window indexes in most recent order
  • session_windows β€” number of windows in the session
  • socket_path β€” the server socket path
  • sixel_support β€” 1 if the server has support for SIXEL
  • start_time β€” the server start time
  • uid β€” the server UID
  • user β€” the server user

okay bestie, we're still in the format variable vault and the window ones are literally serving πŸ’… no cap, every single one matters.

  • version β€” Server version ✨
  • window_active β€” 1 if the window is active πŸ’–
  • window_active_clients β€” Number of clients viewing this window πŸ‘€
  • window_active_clients_list β€” List of clients viewing this window πŸ“‹
  • window_active_sessions β€” Number of sessions on which this window is active 🌸
  • window_active_sessions_list β€” List of sessions on which this window is active 🫢
  • window_activity β€” Time of window last activity ⏰
  • window_activity_flag β€” 1 if the window has activity πŸ”₯
  • window_bell_flag β€” 1 if the window has bell πŸ””
  • window_bigger β€” 1 if the window is larger than the client 😭
  • window_cell_height β€” Height of each cell in pixels πŸ“
  • window_cell_width β€” Width of each cell in pixels πŸ“
  • window_end_flag β€” 1 if the window has the highest index πŸ‘‘
  • window_flags (#F) β€” Window flags with # escaped as ## πŸ’€ yes, really
  • window_format β€” 1 if the format is for a window πŸͺŸ
  • window_height β€” Height of window 🌈
  • window_id β€” Unique window ID ⭐
  • window_index (#I) β€” Index of window πŸ”’
  • window_last_flag β€” 1 if the window is the last used πŸ•°οΈ
  • window_layout β€” Window layout description, ignoring zoomed window panes πŸ™ˆ
  • window_linked β€” 1 if the window is linked across sessions πŸ”—
  • window_linked_sessions β€” Number of sessions this window is linked to 🧚
  • window_linked_sessions_list β€” List of sessions this window is linked to πŸ“
  • window_marked_flag β€” 1 if the window contains the marked pane πŸŽ€
  • window_name (#W) β€” Name of window πŸ’œ
  • window_offset_x β€” X offset into window if larger than client ↔️
  • window_offset_y β€” Y offset into window if larger than client ↕️
  • window_panes β€” Number of panes in window 🧩
  • window_raw_flags β€” Window flags with nothing escaped 🫒
  • window_silence_flag β€” 1 if the window has silence alert 🀫
  • window_stack_index β€” Index in session most recent stack πŸ₯ž
  • window_start_flag β€” 1 if the window has the lowest index πŸ₯‡
  • window_visible_layout β€” Window layout description, respecting zoomed window panes πŸ‘οΈ
  • window_width β€” how wide the window is πŸ’–
  • window_zoomed_flag β€” 1 if the window is zoomed, 0 if not
  • wrap_flag β€” the pane wrap flag

✨ STYLES ✨

okay so tmux has a whole buffet of options to specify the colour and attributes of aspects of the interface β€” like status-style for the status line, bestie. πŸ’… And on top of that, embedded styles may be specified inside format options, such as status-left, by wrapping them in #[ and ]. cute, right?

A style may be the single term default to specify the default style (which may come from an option, for example status-style in the status line) or a space or comma separated list of the following:

  • fg=colour β€” sets the foreground colour. The colour is one of: black, red, green, yellow, blue, magenta, cyan, white; if supported the bright variants brightblack, brightred, ...; colour0 to colour255 from the 256-colour set; default for the default colour; terminal for the terminal default colour; or a hexadecimal RGB string such as #ffffff. 🎨
  • bg=colour β€” sets the background colour.
  • us=colour β€” sets the underscore colour.
  • none β€” set no attributes (turn off any active attributes). poof, gone ✨
  • acs, bright (or bold), dim, underscore, blink, reverse, hidden, italics, overline, strikethrough, double-underscore, curly-underscore, dotted-underscore, dashed-underscore β€” set an attribute. Any of the attributes may be prefixed with no to unset it. acs is the terminal alternate character set.
  • align=left (or noalign), align=centre, align=right β€” align text to the left, centre or right of the available space, if appropriate.
  • fill=colour β€” fill the available space with a background colour, if appropriate.
  • list=on, list=focus, list=left-marker, list=right-marker, nolist β€” mark the position of the various window list components in the status-format option. So: list=on marks the start of the list; list=focus is the part of the list that should be kept in focus if the entire list won't fit in the available space (typically the current window); and list=left-marker and list=right-marker mark the text to be used to mark that text has been trimmed from the left or right of the list if there is not enough space.
  • noattr β€” do not copy attributes from the default style. πŸ™ˆ
  • push-default, pop-default β€” store the current colours and attributes as the default, or reset to the previous default. A push-default affects any subsequent use of the default term until a pop-default. Only one default may be pushed (each push-default replaces the previous saved default). lowkey stack overflow vibes but make it fashion πŸ’€
  • range=left, range=right, range=session|X, range=window|X, range=pane|X, range=user|X, norange β€” mark a range for mouse events in the status-format option. When a mouse event occurs in the range=left or range=right range, the StatusLeft and StatusRight key bindings are triggered.

range=session|X, range=window|X and range=pane|X are ranges for a session, window or pane. These trigger the Status mouse key with the target session, window or pane given by the X argument. X is a session ID, window index in the current session or a pane ID. For these, the mouse_status_range format variable will be set to session, window or pane.

range=user|X is a user-defined range; it triggers the Status mouse key. The argument X will be available in the mouse_status_range format variable. X must be at most 15 bytes in length. πŸ‘‘

Examples are:

fg=yellow bold underscore blink
bg=black,fg=default,noreverse

🌸 NAMES AND TITLES 🌸

okay this one trips people up so listen up bestie 🫢 β€” tmux distinguishes between names and titles.

Windows and sessions have names, which may be used to specify them in targets and are displayed in the status line and various lists: the name is the tmux identifier for a window or session.

Only panes have titles. A pane's title is typically set by the program running inside the pane using an escape sequence (like it would set the xterm(1) window title in X(7)). Windows themselves do not have titles β€” a window's title is the title of its active pane. tmux itself may set the title of the terminal in which the client is running, see the set-titles option.

A session's name is set with the new-session and rename-session commands. A window's name is set with one of:

  1. A command argument (such as -n for new-window or new-session).
  2. An escape sequence (if the allow-rename option is turned on):
$ printf '\033kWINDOW_NAME\033\\'
  1. Automatic renaming, which sets the name to the active command in the window's active pane. See the automatic-rename option. ✨

When a pane is first created, its title is the hostname. A pane's title can be set via the title setting escape sequence, for example:

$ printf '\033]2;My Title\033\\'

It can also be modified with the select-pane -T command. πŸ’…


πŸ’œ GLOBAL AND SESSION ENVIRONMENT πŸ’œ

When the server is started, tmux copies the environment into the global environment; and in addition, each session has a session environment. When a window is created, the session and global environments are merged. If a variable exists in both, the value from the session environment is used. The result is the initial environment passed to the new process.

The update-environment session option may be used to update the session environment from the client when a new session is created or an old one reattached. tmux also initialises the TMUX variable with some internal information to allow commands to be executed from inside, and the TERM variable with the correct terminal setting of screen.

Variables in both session and global environments may be marked as hidden. Hidden variables are not passed into the environment of new processes and instead can only be used by tmux itself (for example in formats, see the β€œFORMATS” section). sneaky. iconic. πŸ™ˆ

Commands to alter and view the environment are:

  • set-environment [-Fhgru] [-t target-session] variable [value] (alias: setenv) β€” set or unset an environment variable. If -g is used, the change is made in the global environment; otherwise, it is applied to the session environment for target-session. If -F is present, then value is expanded as a format. The -u flag unsets a variable. -r indicates the variable is to be removed from the environment before starting a new process. -h marks the variable as hidden.
  • show-environment [-hgs] [-t target-session] [variable] (alias: showenv) β€” display the environment for target-session or the global environment with -g. If variable is omitted, all variables are shown. Variables removed from the environment are prefixed with -. If -s is used, the output is formatted as a set of Bourne shell commands. -h shows hidden variables (omitted by default). 🐚

πŸŽ€ STATUS LINE πŸŽ€

tmux includes an optional status line which is displayed in the bottom line of each terminal. 🌈

By default, the status line is enabled and one line in height (it may be disabled or made multiple lines with the status session option) and contains, from left-to-right: the name of the current session in square brackets; the window list; the title of the active pane in double quotes; and the time and date. ⭐


Each line of the status line is configured with the status-format option. The default is made of three parts: configurable left and right sections (which may contain dynamic content such as the time or output from a shell command, see the status-left, status-left-length, status-right, and status-right-length options below), and a central window list. By default, the window list shows the index, name and (if any) flag of the windows present in the current session in ascending numerical order. It may be customised with the window-status-format and window-status-current-format options. The flag is one of the following symbols appended to the window name:

  • * β€” denotes the current window πŸ’–
  • - β€” marks the last window (previously selected)
  • # β€” window activity is monitored and activity has been detected ✨
  • ! β€” window bells are monitored and a bell has occurred in the window πŸ””
  • ~ β€” the window has been silent for the monitor-silence interval 🀫
  • M β€” the window contains the marked pane
  • Z β€” the window's active pane is zoomed πŸ‘‘

The # symbol relates to the monitor-activity window option. The window name is printed in inverted colours if an alert (bell, activity or silence) is present. it's giving "your window is doing something, bestie, look at it" πŸ’…

The colour and attributes of the status line may be configured, the entire status line using the status-style session option and individual windows using the window-status-style window option.

The status line is automatically refreshed at interval if it has changed, the interval may be controlled with the status-interval session option. set and forget, she keeps herself fresh ✨

Commands related to the status line are as follows:


  • clear-prompt-history [-T prompt-type] β€” (alias: clearphist)

Clear status prompt history for prompt type prompt-type. If -T is omitted, then clear history for all types. See command-prompt for possible values for prompt-type. bye bye old prompts, we don't need you 🧹

  • command-prompt [-1bFiklN] [-I inputs] [-p prompts] [-t target-client] [-T prompt-type] [template]

Open the command prompt in a client. This may be used from inside tmux to execute commands interactively. the glow-up of just typing what you want πŸŽ€

If template is specified, it is used as the command. With -F, template is expanded as a format.

If -I is present, inputs is a comma-separated list of the initial text for each prompt. If -p is given, prompts is a comma-separated list of prompts which are displayed in order; otherwise a single prompt is displayed, constructed from template if it is present, or : if not. -l disables splitting of inputs and prompts at commas and treats them literally.

Before the command is executed, the first occurrence of the string %% and all occurrences of %1 are replaced by the response to the first prompt, all %2 are replaced with the response to the second prompt, and so on for further prompts. Up to nine prompt responses may be replaced (%1 to %9). %%% is like %% but any quotation marks are escaped. so many percent signs, but she's a template queen fr fr πŸ’œ

-1 makes the prompt only accept one key press, in this case the resulting input is a single character. -k is like -1 but the key press is translated to a key name. -N makes the prompt only accept numeric key presses. -i executes the command every time the prompt input changes instead of when the user exits the command prompt.

-T tells tmux the prompt type. This affects what completions are offered when Tab is pressed. Available types are: command, search, target and window-target.

The following keys have a special meaning in the command prompt, depending on the value of the status-keys option:

  • Cancel command prompt β€” vi: q, emacs: Escape
  • Delete from cursor to start of word β€” vi: (none), emacs: C-w
  • Delete entire command β€” vi: d, emacs: C-u
  • Delete from cursor to end β€” vi: D, emacs: C-k
  • Execute command β€” vi: Enter, emacs: Enter
  • Get next command from history β€” vi: (none), emacs: Down
  • Get previous command from history β€” vi: (none), emacs: Up
  • Insert top paste buffer β€” vi: p, emacs: C-y
  • Look for completions β€” vi: Tab, emacs: Tab
  • Move cursor left β€” vi: h, emacs: Left
  • Move cursor right β€” vi: l, emacs: Right
  • Move cursor to end β€” vi: $, emacs: C-e
  • Move cursor to next word β€” vi: w, emacs: M-f
  • Move cursor to previous word β€” vi: b, emacs: M-b
  • Move cursor to start β€” vi: 0, emacs: C-a
  • Transpose characters β€” vi: (none), emacs: C-t

With -b, the prompt is shown in the background and the invoking client does not exit until it is dismissed. she's multitasking, she's in the background, she's that girl πŸ’…

  • confirm-before [-by] [-c confirm-key] [-p prompt] [-t target-client] command β€” (alias: confirm)

Ask for confirmation before executing command. If -p is given, prompt is the prompt to display; otherwise a prompt is constructed from command. It may contain the special character sequences supported by the status-left option. With -b, the prompt is shown in the background and the invoking client does not exit until it is dismissed. -y changes the default behaviour (if Enter alone is pressed) of the prompt to run the command. -c changes the confirmation key to confirm-key; the default is y. are you SURE bestie? say yes 🫢

  • display-menu [-OM] [-b border-lines] [-c target-client] [-C starting-choice] [-H selected-style] [-s style] [-S border-style] [-t target-pane] [-T title] [-x position] [-y position] name key command [name key command ...] β€” (alias: menu)

Display a menu on target-client. target-pane gives the target for any commands run from the menu.

okay bestie, so a menu is passed as a series of arguments: first the menu item name, second the key shortcut (or empty for none), and third the command to run when the menu item is chosen. πŸ’… The name and command are formats, so peek at the β€œFORMATS” and β€œSTYLES” sections. If the name begins with a hyphen (-), then the item is disabled (shown dim) and may not be chosen. The name may be empty for a separator line, in which case both the key and command should be omitted. no cap.

  • -b β€” sets the type of characters used for drawing menu borders. See popup-border-lines for possible values for border-lines.
  • -H β€” sets the style for the selected menu item (see β€œSTYLES”).
  • -s β€” sets the style for the menu.
  • -S β€” sets the style for the menu border (see β€œSTYLES”).
  • -T β€” is a format for the menu title (see β€œFORMATS”).
  • -C β€” sets the menu item selected by default, if the menu is not bound to a mouse key binding.
  • -x and -y β€” give the position of the menu. Both may be a row or column number, or one of the following special values:
    • C β€” (Flag: Both) The centre of the terminal
    • R β€” (Flag: -x) The right side of the terminal
    • P β€” (Flag: Both) The bottom left of the pane
    • M β€” (Flag: Both) The mouse position
    • W β€” (Flag: Both) The window position on the status line
    • S β€” (Flag: -y) The line above or below the status line

Or a format, which is expanded including the following additional variables:

  • popup_centre_x β€” Centered in the client
  • popup_centre_y β€” Centered in the client
  • popup_height β€” Height of menu or popup
  • popup_mouse_bottom β€” Bottom of at the mouse
  • popup_mouse_centre_x β€” Horizontal centre at the mouse
  • popup_mouse_centre_y β€” Vertical centre at the mouse
  • popup_mouse_top β€” Top at the mouse
  • popup_mouse_x β€” Mouse X position
  • popup_mouse_y β€” Mouse Y position
  • popup_pane_bottom β€” Bottom of the pane
  • popup_pane_left β€” Left of the pane
  • popup_pane_right β€” Right of the pane
  • popup_pane_top β€” Top of the pane
  • popup_status_line_y β€” Above or below the status line
  • popup_width β€” Width of menu or popup
  • popup_window_status_line_x β€” At the window position in status line
  • popup_window_status_line_y β€” At the status line showing the window

Each menu consists of items followed by a key shortcut shown in brackets. If the menu is too large to fit on the terminal, it is not displayed. Pressing the key shortcut chooses the corresponding item. If the mouse is enabled and the menu is opened from a mouse key binding, releasing the mouse button with an item selected chooses that item and releasing the mouse button without an item selected closes the menu. -O changes this behaviour so that the menu does not close when the mouse button is released without an item selected β€” the menu is not closed and a mouse button must be clicked to choose an item. πŸ”₯

-M tells tmux the menu should handle mouse events; by default only menus opened from mouse key bindings do so.

The following keys are available in menus:

  • Enter β€” Choose selected item
  • Up β€” Select previous item
  • Down β€” Select next item
  • q β€” Exit menu

πŸ’¬ display-message

display-message [-aCIlNpv] [-c target-client] [-d delay] [-t target-pane] [message]
(alias: display)

Display a message. If -p is given, the output is printed to stdout, otherwise it is displayed in the target-client status line for up to delay milliseconds. If delay is not given, the display-time option is used; a delay of zero waits for a key press. -N ignores key presses and closes only after the delay expires. If -C is given, the pane will continue to be updated while the message is displayed. If -l is given, message is printed unchanged. Otherwise, the format of message is described in the β€œFORMATS” section; information is taken from target-pane if -t is given, otherwise the active pane.

-v prints verbose logging as the format is parsed and -a lists the format variables and their values.

-I forwards any input read from stdin to the empty pane given by target-pane.

🌸 display-popup 🌸

display-popup   [-BCEkN]   [-b   border-lines]  [-c  target-client]  [-d
        start-directory] [-e environment] [-h  height]  [-s  style]  [-S
        border-style]   [-t  target-pane]  [-T  title]  [-w  width]  [-x
        position] [-y position] [shell-command [argument ...]]
        (alias: popup)

okay bestie this one is iconic β€” it pops a whole rectangle of vibes right on top of your panes πŸ’… It runs shell-command (or default-command if you don't give it one) on target-client.

So like, what even is a popup? It's a rectangular box drawn over the top of any panes. And here's the important part: panes are not updated while a popup is present. They're just sitting there frozen behind it, being dramatic 🫢

And plot twist: if you run the command inside an existing popup, that popup gets modified instead of a new one appearing. But in that case only the -b, -B, -C, -E, -EE, -K, -N, -s, and -S options are accepted β€” everything else just gets ignored, no cap.


The flags, one by one, mwah:

  • -E β€” closes the popup automatically when shell-command exits. Two -Es (-EE) closes the popup only if shell-command exited with success. ✨
  • -k β€” lets any key dismiss the popup, instead of only β€˜Escape’ or β€˜C-c’. Literally any key. The power 😭
  • -x and -y β€” give the position of the popup, and they have the same meaning as for the display-menu command.
  • -w and -h β€” give the width and height. Both may be a percentage (followed by β€˜%’). If omitted, half of the terminal size is used β€” so a chill 50/50 situation πŸŽ€
  • -B β€” does not surround the popup by a border. Naked popup. Vulnerable popup. πŸ™ˆ
  • -b border-lines β€” sets the type of characters used for drawing popup borders. Careful tho: when -B is specified, the -b option is ignored. See popup-border-lines for possible values for border-lines.
  • -s style β€” sets the style for the popup, and -S border-style sets the style for the popup border (see β€œSTYLES”). πŸ’œ
  • -e environment β€” takes the form β€˜VARIABLE=value’ and sets an environment variable for the popup. You can specify it multiple times, so stack 'em like bracelets 🌈
  • -T title β€” a format for the popup title (see β€œFORMATS”).
  • -C β€” closes any popup on the client. Bye popup πŸ‘‹
  • -N β€” disables any previously specified -E, -EE, or -k option. It's the uno-reverse card πŸƒ
  • -c target-client, -d start-directory, -t target-pane, -K β€” these show up in the synopsis up there ☝️ and the page doesn't spell them out any further right here, so go peep the fuller docs if you need the tea on those.

πŸ¦‹ show-prompt-history πŸ¦‹

show-prompt-history [-T prompt-type]
        (alias: showphist)

Displays the status prompt history for prompt type prompt-type. If -T is omitted, then it shows the history for all types. See command-prompt for possible values for prompt-type.

basically it's your receipts for everything you've ever typed into a prompt πŸ’€ iconic behavior honestly.

πŸ’– BUFFERS πŸ’–

okay bestie so tmux keeps a whole lil collection of named paste buffers, like a stack of sticky notes but digital πŸ’… Each buffer can be either explicitly or automatically named.

  • Explicitly named buffers get their name when you create them with the set-buffer or load-buffer commands, OR when you rename an automatically named buffer with set-buffer -n.
  • Automatically named buffers just get handed a name like buffer0001, buffer0002 and so on, like the universe naming your Sims 🧚

When the buffer-limit option gets reached, the oldest automatically named buffer gets deleted, no cap. Explicitly named buffers? They are NOT subject to buffer-limit, they're literally main character energy πŸ‘‘ and you can delete them with the delete-buffer command.

Buffers can be added using copy-mode, or with the set-buffer and load-buffer commands, and pasted into a window using the paste-buffer command. If you use a buffer command and don't specify a buffer, tmux assumes the most recently added automatically named buffer β€” it just knows bestie ✨

There's also a configurable history buffer maintained for each window. By default, up to 2000 lines are kept, and you can change that with the history-limit option (peep the set-option command above, iykyk).

The buffer commands are as follows:


🌸 the buffer commands 🌸

  • choose-buffer [-NryZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]

Puts a pane into buffer mode, where a buffer may be chosen interactively from a list πŸŽ€ Each buffer is shown on one line. A shortcut key shows up on the left in brackets so you can pick immediately, or you can navigate the list and choose/manipulate an item with the keys below. -Z zooms the pane. -y disables any confirmation prompts.

The following keys may be used in buffer mode:

  • Enter β€” Paste selected buffer
  • Up β€” Select previous buffer
  • Down β€” Select next buffer
  • C-s β€” Search by name or content
  • n β€” Repeat last search forwards
  • N β€” Repeat last search backwards
  • t β€” Toggle if buffer is tagged
  • T β€” Tag no buffers
  • C-t β€” Tag all buffers
  • p β€” Paste selected buffer
  • P β€” Paste tagged buffers
  • d β€” Delete selected buffer
  • D β€” Delete tagged buffers
  • e β€” Open the buffer in an editor
  • f β€” Enter a format to filter items
  • O β€” Change sort field
  • r β€” Reverse sort order
  • v β€” Toggle preview
  • q β€” Exit mode

After a buffer is chosen, %% is replaced by the buffer name in template and the result executed as a command. If template is not given, "paste-buffer -p -b '%%'" is used.

-O specifies the initial sort field: one of time (creation), name or size. -r reverses the sort order. -f specifies an initial filter: the filter is a format β€” if it evaluates to zero, the item in the list is not shown, otherwise it is shown. If a filter would lead to an empty list, it is ignored. -F specifies the format for each item in the list and -K a format for each shortcut key; both are evaluated once for each line. -N starts without the preview. This command works only if at least one client is attached.

  • clear-history [-H] [-t target-pane] (alias: clearhist) β€” Remove and free the history for the specified pane. -H also removes all hyperlinks 🫢
  • delete-buffer [-b buffer-name] (alias: deleteb) β€” Delete the buffer named buffer-name, or the most recently added automatically named buffer if not specified. bye bestie πŸ’€
  • list-buffers [-F format] [-f filter] (alias: lsb) β€” List the global buffers. -F specifies the format of each line and -f a filter. Only buffers for which the filter is true are shown. See the β€œFORMATS” section.
  • load-buffer [-w] [-b buffer-name] [-t target-client] path (alias: loadb) β€” Load the contents of the specified paste buffer from path. If -w is given, the buffer is also sent to the clipboard for target-client using the xterm(1) escape sequence, if possible. If path is -, the contents are read from stdin.
  • paste-buffer [-dpr] [-b buffer-name] [-s separator] [-t target-pane] (alias: pasteb) β€” Insert the contents of a paste buffer into the specified pane. If not specified, paste into the current one. With -d, also delete the paste buffer. When output, any linefeed (LF) characters in the paste buffer are replaced with a separator, by default carriage return (CR). A custom separator may be specified using the -s flag. The -r flag means to do no replacement (equivalent to a separator of LF). If -p is specified, paste bracket control codes are inserted around the buffer if the application has requested bracketed paste mode ✨
  • save-buffer [-a] [-b buffer-name] path (alias: saveb) β€” Save the contents of the specified paste buffer to path. The -a option appends to rather than overwriting the file. If path is -, the contents are written to stdout.
  • set-buffer [-aw] [-b buffer-name] [-t target-client] [-n new-buffer-name] data (alias: setb) β€” Set the contents of the specified buffer to data. If -w is given, the buffer is also sent to the clipboard for target-client using the xterm(1) escape sequence, if possible. The -a option appends to rather than overwriting the buffer. The -n option renames the buffer to new-buffer-name πŸ’–
  • show-buffer [-b buffer-name] (alias: showb) β€” Display the contents of the specified buffer.

πŸ’« MISCELLANEOUS πŸ’«

okay so these are the little odds and ends of commands, the random side quests, and honestly some of them are lowkey iconic. here we go bestie:

  • clock-mode [-t target-pane] β€” shows a big ol' clock. just a giant clock. in your pane. time is fake but the clock is real πŸ•
  • if-shell [-bF] [-t target-pane] shell-command command [command] (alias: if) β€” runs the first command if shell-command (which gets run with /bin/sh) comes back successful, and the second command if it doesn't. before it even runs, shell-command gets expanded using the rules from the "FORMATS" section, including the ones that care about target-pane. with -b, shell-command runs in the background. and if you pass -F, then shell-command is not actually executed at all β€” instead it counts as success as long as it's neither empty nor zero (after the formats get expanded). wild, but okay ✨
  • lock-server (alias: lock) β€” locks every client individually by running whatever command the lock-command option says. πŸ”’
  • run-shell [-bCE] [-c start-directory] [-d delay] [-t target-pane] [shell-command] (alias: run) β€” runs shell-command using /bin/sh, or (with -C) runs a tmux command in the background without creating a window. before it runs, shell-command gets expanded with the "FORMATS" rules. -b means run it in the background. -d waits delay seconds before kicking the command off. -E redirects the command's stderr to stdout instead of just ignoring it. if you give -c, the current working directory gets set to start-directory. and if -C is not given, anything the command prints to stdout shows up in view mode (in the pane from -t, or the current pane if you didn't bother) once the command finishes. if the command fails, the exit status gets displayed too. πŸ’…
  • wait-for [-L | -S | -U] channel (alias: wait) β€” with no options, it stops the client from exiting until someone wakes it with wait-for -S on the same channel. with -L, the channel gets locked, and any client that tries to lock that same channel is made to wait until it's unlocked with wait-for -U. it's giving traffic controller energy 🚦

πŸ‘‹ EXIT MESSAGES πŸ‘‹

when a tmux client detaches, it prints a lil message on the way out. it's gonna be one of these:

  • detached (from session ...) β€” the client detached normally, no drama, all good. ✨
  • detached and SIGHUP β€” the client detached and its parent sent the SIGHUP signal (like, for example, with detach-client -P). 😭
  • lost tty β€” the client's tty(4) or pty(4) got unexpectedly destroyed. rip. πŸ’€
  • terminated β€” the client was killed with SIGTERM.
  • too far behind β€” the client is in control mode and couldn't keep up with the data coming from tmux. it's literally falling behind, bestie πŸƒβ€β™€οΈ
  • exited β€” the server exited when it had no sessions left.
  • server exited β€” the server exited because it got SIGTERM.
  • server exited unexpectedly β€” the server crashed or otherwise exited without telling the client why. rude. 😀

πŸŽ€ TERMINFO EXTENSIONS πŸŽ€

so tmux understands some unofficial extensions to terminfo(5). normally you do not need to set these by hand β€” instead you should be using the terminal-features option. but here's the full list anyway, because knowledge is power:

  • AX β€” an existing extension that tells tmux the terminal supports default colours.
  • Bidi β€” tells tmux the terminal supports the VTE bidirectional text extensions.
  • Cs, Cr β€” set the cursor colour. the first one takes a single string argument and uses it to set the colour; the second takes no arguments and restores the default cursor colour. if it's set, a sequence like this can change the cursor colour from inside tmux:
$ printf '\033]12;red\033\\'

the colour is an X(7) colour, see XParseColor(3). 🎨

  • Cmg, Clmg, Dsmg, Enmg β€” set, clear, disable or enable DECSLRM margins. these get set automatically if the terminal reports that it's VT420 compatible.
  • Dsbp, Enbp β€” disable and enable bracketed paste. these get set automatically if the XT capability is present.
  • Dseks, Eneks β€” disable and enable extended keys.
  • Dsfcs, Enfcs β€” disable and enable focus reporting. these get set automatically if the XT capability is present.
  • Hls β€” set or clear a hyperlink annotation.
  • Nobr β€” tells tmux the terminal does not use bright colors for bold display.
  • Rect β€” tells tmux the terminal supports rectangle operations.
  • Smol β€” enables the overline attribute.
  • Smulx β€” sets a styled underscore. the single parameter is one of: 0 for no underscore, 1 for normal underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted underscore and 5 for dashed underscore. underscore lore fr ✨
  • Setulc, Setulc1, ol β€” set the underscore colour or reset to the default. Setulc is for RGB colours and Setulc1 is for ANSI or 256 colours. the Setulc argument is (red * 65536) + (green * 256) + blue where each value is between 0 and 255.
  • Ss, Se β€” set or reset the cursor style. if it's set, a sequence like this can change the cursor to an underline:
$ printf '\033[4 q'

if Se is not set, Ss with argument 0 will be used to reset the cursor style instead.

  • Swd β€” sets the opening sequence for the working directory notification. the sequence gets terminated using the standard fsl capability.
  • Sxl β€” indicates that the terminal supports SIXEL. πŸ–ΌοΈ
  • Sync β€” start (parameter is 1) or end (parameter is 2) a synchronized update.
  • Tc β€” indicates the terminal supports the 'direct colour' RGB escape sequence (for example, \e[38;2;255;255;255m).

if supported, this is used for the initialize colour escape sequence (which can be enabled by adding the 'initc' and 'ccc' capabilities to the tmux terminfo(5) entry).

this is equivalent to the RGB terminfo(5) capability.

  • Ms β€” stores the current buffer in the host terminal's selection (clipboard). see the set-clipboard option above and the xterm(1) man page.
  • XT β€” this is an existing extension capability that tmux uses to mean the terminal supports the xterm(1) title set sequences, and to automatically set some of the capabilities listed above. the multitasker of capabilities πŸ’…

🌈 CONTROL MODE 🌈

tmux serves up a textual interface called control mode, and it's honestly so cool. it lets applications talk to tmux using a simple text-only protocol. main character energy for real.

in control mode, a client sends tmux commands or command sequences terminated by newlines on standard input. each command produces one block of output on standard output. an output block is a %begin line followed by the output (which may be empty). the output block ends with a %end or %error. %begin and its matching %end or %error each have three arguments: an integer time (as seconds from epoch), command number and flags (currently not used). for example:

%begin 1363006971 2 1
0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
%end 1363006971 2 1

the refresh-client -C command can be used to set the size of a client in control mode.

in control mode, tmux outputs notifications. a notification will never occur inside an output block. periodt.

the following notifications are defined, and yes, bestie, we're going through all of them:

  • %client-detached client β€” the client has detached.
  • %client-session-changed client session-id name β€” the client is now attached to the session with ID session-id, which is named name.
  • %config-error error β€” an error has happened in a configuration file.
  • %continue pane-id β€” the pane has been continued after being paused (if the pause-after flag is set, see refresh-client -A).
  • %exit [reason] β€” the tmux client is exiting immediately, either because it's not attached to any session or because an error occurred. if present, reason describes why the client exited.
  • %extended-output pane-id age ...: value β€” new form of %output sent when the pause-after flag is set. age is the time in milliseconds for which tmux had buffered the output before it was sent. any subsequent arguments up until a single ':' are for future use and should be ignored. iykyk 🫢
  • %layout-change window-id window-layout window-visible-layout window-flags β€” the layout of a window with ID window-id changed. the new layout is window-layout. the window's visible layout is window-visible-layout and the window flags are window-flags.
  • %message message β€” a message sent with the display-message command.
  • %output pane-id value β€” a window pane produced output. value escapes non-printable characters and backslash as octal \xxx.
  • %pane-mode-changed pane-id β€” the pane with ID pane-id has changed mode.
  • %paste-buffer-changed name β€” paste buffer name has been changed.
  • %paste-buffer-deleted name β€” paste buffer name has been deleted.
  • %pause pane-id β€” the pane has been paused (if the pause-after flag is set).
  • %session-changed session-id name β€” the client is now attached to the session with ID session-id, which is named name.
  • %session-renamed name β€” the current session was renamed to name.
  • %session-window-changed session-id window-id β€” the session with ID session-id changed its active window to the window with ID window-id.
  • %sessions-changed β€” a session was created or destroyed.
  • %subscription-changed name session-id window-id window-index pane-id ...: value β€” the value of the format associated with subscription name has changed to value. see refresh-client -B. any arguments after pane-id up until a single ':' are for future use and should be ignored.
  • %unlinked-window-add window-id β€” the window with ID window-id was created but is not linked to the current session.
  • %unlinked-window-close window-id β€” the window with ID window-id, which is not linked to the current session, was closed.
  • %unlinked-window-renamed window-id β€” the window with ID window-id, which is not linked to the current session, was renamed.
  • %window-add window-id β€” the window with ID window-id was linked to the current session.
  • %window-close window-id β€” the window with ID window-id closed.
  • %window-pane-changed window-id pane-id β€” the active pane in the window with ID window-id changed to the pane with ID pane-id.
  • %window-renamed window-id name β€” the window with ID window-id was renamed to name.

🌿 ENVIRONMENT 🌿

okay so when tmux boots up, it does a lil vibe check on these environment variables πŸ‘€ bestie they're lowkey important:

  • EDITOR β€” if whatever command lives in here has the string 'vi' in it and VISUAL is unset, tmux gives you vi-style key bindings πŸ’… but heads up, the mode-keys and status-keys options can override this, so they're the main characters here.
  • HOME β€” your login directory, the classic. if it's unset, tmux goes and consults the passwd(5) database instead, no cap.
  • LC_CTYPE β€” the character encoding locale(1) πŸ¦‹ and it's doing two whole separate jobs, she's booked and busy:
    • for output to the terminal, UTF-8 gets used if the -u option is given or if LC_CTYPE contains "UTF-8" or "UTF8". otherwise? only ASCII characters get written and any non-ASCII character gets replaced with underscores ('_') 😭
    • for input, tmux always runs with a UTF-8 locale. if en_US.UTF-8 is provided by the operating system, it gets used and LC_CTYPE is just ignored for input. otherwise LC_CTYPE tells tmux what the UTF-8 locale is called on your current system.
⚠️ and if the locale specified by LC_CTYPE isn't available, or isn't a UTF-8 locale, tmux exits with an error message. periodt, no session for you.
  • LC_TIME β€” the date and time format locale(1) ✨ it's used for locale-dependent strftime(3) format specifiers, that's the whole job.
  • PWD β€” the current working directory that gets set in the global environment. this one's useful if it contains symbolic links 🫢 but plot twist: if the value of the variable does not match the actual current working directory, the variable is ignored and the result of getcwd(3) is used instead. she's strict like that.
  • SHELL β€” the absolute path to the default shell for new windows 🌸 see the default-shell option for the details, iykyk.
  • TMUX_TMPDIR β€” the parent directory of the directory that contains the server sockets πŸ’œ see the -L option for details.
  • VISUAL β€” if the command specified in this variable contains the string 'vi', you get vi-style key bindings. overridden by the mode-keys and status-keys options, same deal as EDITOR.

πŸ“ FILES πŸ“

the sacred texts bestie, here's where tmux looks for its config:

  • ~/.tmux.conf
  • $XDG_CONFIG_HOME/tmux/tmux.conf
  • ~/.config/tmux/tmux.conf β€” the default tmux configuration file ✨
  • /etc/tmux.conf β€” the system-wide configuration file πŸ‘‘

✨ EXAMPLES ✨

okay bestie let's actually do something, here's the hands-on part πŸ’…

want a brand new tmux session running vi(1)? bet:

$ tmux new-session vi

most commands have a shorter form, aka an alias 🌈 for new-session, that alias is new:

$ tmux new vi

alternatively, the shortest unambiguous form of a command is accepted πŸ¦‹ and if there are several options that could match, tmux lists them for you:

$ tmux n
ambiguous command: n, could be: new-session, new-window, next-window

now, inside an active session, you can create a new window by typing 'C-b c' β€” that's Ctrl, then the 'b' key, then the 'c' key πŸŽ€

windows can be navigated with: 'C-b 0' (to select window 0), 'C-b 1' (to select window 1), and so on; 'C-b n' to select the next window; and 'C-b p' to select the previous window 🧚

a session can be detached using 'C-b d' (or by an external event, like ssh(1) disconnection, rude) and reattached with:

$ tmux attach-session

typing 'C-b ?' lists the current key bindings in the current window πŸ‘€ up and down navigate the list, or 'q' exits from it.

commands to be run when the tmux server is started may be placed in the ~/.tmux.conf configuration file 🌸 common examples include:

changing the default prefix key:

set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

turning the status line off, or changing its colour:

set-option -g status off
set-option -g status-style bg=blue

setting other options, such as the default command, or locking after 30 minutes of inactivity:

set-option -g default-command "exec /bin/ksh"
set-option -g lock-after-time 1800

creating new key bindings:

bind-key b set-option status
bind-key / command-prompt "split-window 'exec man %%'"
bind-key S command-prompt "new-window -n %1 'ssh %1'"

πŸ‘€ SEE ALSO πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

Nicholas Marriott < nicholas.marriott@gmail.com > β€” the icon, the legend, the moment fr fr 🫢


and that's the whole page bestie, you made it to the end, so proud of you πŸ˜­πŸ’– this beauty came from the Debian folks and is dated September 12, 2026 β€” go forth and multiplex, you absolute main character πŸŒˆβœ¨πŸ‘‘

πŸ“¦ where this page comes from
  • epel 10: opentmux 0.1-2.el10_3 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
  • fedora 43: opentmux 0.1-2.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
  • fedora 44: opentmux 0.1-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms