TMUX(1)

๐Ÿ’– TMUX(1) ๐Ÿ’–

okay bestie, sit down, hydrate, because we're about to talk about the General Commands Manual entry for tmux โ€” the terminal multiplexer โ€” and she is iconic. ๐ŸŽ€


โœจ NAME โœจ

tmux โ€” terminal multiplexer. that's it. that's the whole name. she's mysterious, she's powerful, she's the main character.


๐ŸŒธ SYNOPSIS ๐ŸŒธ

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

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so like. tmux is a terminal multiplexer. what that means (fr fr) is she lets you create, access, and control a whole bunch of terminals from one single screen. it's giving "one screen, infinite windows" energy. ๐Ÿ’…

and the way that she can be detached from a screen and just keep running in the background, minding her own business, and then later you reattach to her like nothing ever happened?? obsessed. โœจ

when tmux starts up, she creates a new session with a single window and puts it on your screen. at the bottom of the screen there's a status line showing info about the current session, and that's also where you go to type in interactive commands. ๐Ÿ’–

okay so definitions, because the terminology matters:

  • A session is one single collection of pseudo terminals that tmux is managing. every session has one or more windows linked to it.
  • A window takes up the entire screen and may be split into rectangular panes, and each pane is its own separate pseudo terminal. (if you want the technical nitty-gritty on pseudo terminals, the pty(4) manual page has you covered ๐Ÿงš)
  • Any number of tmux instances may connect to the same session, and any number of windows may live in the same session. no cap.
  • Once all sessions are killed, tmux exits. periodt.

each session is persistent โ€” she will survive an accidental disconnection (think your ssh(1) connection timing out ๐Ÿ˜ญ) or an intentional detach (that's the โ€˜C-b dโ€™ key strokes, iykyk). and you can reattach to her with:

$ tmux attach

in tmux, a session gets displayed on screen by a client, and all the sessions are managed by a single server. the server and each client are separate processes, and they talk to each other through a socket in /tmp. ๐Ÿ’…

the options are as follows:

  • -2 โ€” force tmux to assume the terminal supports 256 colours. this is equivalent to -T 256. bestie, it's the same thing. ๐ŸŽ€
  • -C โ€” start in control mode (peep the โ€œCONTROL MODEโ€ section). give it twice (-CC) and it disables echo.
  • -c shell-command โ€” execute shell-command using the default shell. if it's necessary, the tmux server will get started so it can retrieve the default-shell option. this one exists 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. heads up: 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 it's present, and then looks for a user configuration file at ~/.tmux.conf or $XDG_CONFIG_HOME/tmux/tmux.conf.

the configuration file is just a set of tmux commands that get executed in sequence when the server is first started. tmux loads configuration files once, when the server process has started. if you wanna load a file later, the source-file command is right there. ๐Ÿซถ

tmux shows any error messages from commands in configuration files in the first session created, and then just keeps on processing the rest of the configuration file. she doesn't stop for anybody.

  • -h โ€” print usage information and exit.
  • -L socket-name โ€” tmux stores the server socket in a directory under TMUX_TMPDIR, or /tmp if that's unset. the default socket is named default. this option lets you specify a different socket name, which means you can run several independent tmux servers. unlike -S, a full path is not necessary: the sockets all get 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, you can send the SIGUSR1 signal 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. ngl this flag currently has no effect and is only there for compatibility with other shells when using tmux as a login shell. ๐Ÿ’€
  • -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".
  • -V โ€” report the tmux version. โœจ
  • -v โ€” request verbose logging. log messages get 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 you specify -v twice, an additional tmux-out-PID.log file is generated, containing a copy of everything tmux writes to the terminal. ๐Ÿ“

you can send the SIGUSR2 signal 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 ๐Ÿ‘‘

tmux can be controlled from an attached client using a key combination of a prefix key โ€” โ€˜C-bโ€™ (Ctrl-b) by default โ€” followed by a command key. it's a little two-step, but she eats every time. ๐Ÿ’…

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.
  • * โ€” create a new floating pane.
  • , โ€” 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. โฐ
  • T โ€” change the current pane title.
  • w โ€” choose the current window interactively.
  • x โ€” kill the current pane.
  • z โ€” toggle zoom state of the current pane.
  • Tab โ€” choose a new window and session by fuzzy matching.
  • { โ€” swap the current pane with the previous pane.
  • } โ€” swap the current pane with the next pane.
  • g 1, 2, 3, 4 and g Up, Down, Left, Right โ€” move floating pane to corners or edges. Meta resizes the pane as well.
  • ~ โ€” 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. ๐ŸŽ€


and bestieโ€ฆ we are SO not done. there are 23 more parts of this whole entire saga coming your way. ๐Ÿ’–โœจ

โœจ COMMAND PARSING AND EXECUTION โœจ

okay bestie, so tmux has a whole library of commands it uses to control itself. Each one 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 straight from your shell prompt, a shell script, a configuration file, or the command prompt. ๐Ÿซถ

Like, the exact same set-option command run from the shell prompt, from ~/.tmux.conf, and bound to a key can look like this:

$ 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

So here the command name is set-option, -g is a flag, and status-style and bg=cyan are arguments. no cap ๐ŸŽ€

Now โ€” tmux is lowkey a huge nerd and it splits "command parsing" from "execution". To actually execute a command, tmux needs it broken up into its name + arguments first. That first bit is command parsing. And here's the vibe check: if you run a command from the shell, your shell parses it. If it comes from inside tmux or from a config file, tmux does the parsing. ๐Ÿ’…

Times when tmux is the one parsing:

  • 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, every client has its own โ€˜command queueโ€™. There's also a global command queue that isn't attached to any client, and it gets used on startup for config files like ~/.tmux.conf. Parsed commands get added to the queue and run in order. ๐Ÿฆ‹

Some commands โ€” looking at you, if-shell and confirm-before โ€” parse their argument to make a new command, and that new command is inserted immediately after themselves. Which means arguments can get parsed twice or even more: once when the parent command (like if-shell) is parsed, and again when it parses and executes its own command. iconic behaviour honestly ๐Ÿ˜ญ

And some commands โ€” if-shell, run-shell and display-panes โ€” will literally stop execution of the subsequent commands on the queue until something happens. For if-shell and run-shell that something is a shell command finishing; for display-panes it's a key being pressed. โธ๏ธ

Example time! These 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. โœจ

The โ€œCOMMANDSโ€ section lists the tmux commands and their arguments.


๐Ÿ” PARSING SYNTAX ๐Ÿ”

This section is all about the syntax of commands parsed by tmux โ€” so like, in a configuration file or at the command prompt. Heads up though: when commands are entered into the shell, they get parsed by the shell instead โ€” see for example ksh(1) or csh(1). ๐ŸŒธ

Every command gets terminated by a newline or a semicolon (;). Commands separated by semicolons together form a โ€˜command sequenceโ€™ โ€” and if one command in that sequence hits an error, none of the following commands run. periodt ๐Ÿ›‘

It's 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

So like the examples show, when you're running tmux from the shell you have to be extra careful with quoting 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 โ€” anything left on the line after a comment is ignored until the end of the line. ๐Ÿ’ฌ

If the last character of a line is \, that line gets joined with the following line (the \ and the newline are completely removed). This is called line continuation and it applies both inside and outside quoted strings and in comments โ€” but not inside braces. ๐Ÿงš

Command arguments can be written as strings surrounded by single (') quotes or double (") quotes, or as command lists surrounded by braces ({}). You need this when the argument contains any special character. Single and double quoted strings can't span multiple lines except with line continuation. Braces, though? Braces can totally span multiple lines. slay ๐Ÿ’…

Outside of quotes, and inside double quotes, these replacements happen:

  • 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 get parsed as a configuration file (so conditions such as โ€˜%ifโ€™ are processed) and then converted into a string. They're designed to avoid needing extra escaping when you pass a group of tmux commands as an argument (for example to if-shell). These two examples produce an identical command โ€” and 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 can be set 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. ๐Ÿ™ˆ

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 too, for example:

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

โœจ COMMANDS โœจ

okay bestie this is the big one ๐Ÿ’– this whole section is the commands tmux supports. Most of them take an optional -t argument (and sometimes -s too) with one of target-client, target-session, target-window, or target-pane โ€” those are just fancy ways of saying which client, session, window or pane the command should mess with ๐Ÿ’…


target-client should be the name of the client, usually the pty(4) file the client is connected to โ€” so like /dev/ttyp1 or ttyp1 for the client attached to /dev/ttyp1, either one works. If you don't specify a client, tmux tries to figure out which one you're currently using, and if that fails it just reports an error ๐Ÿ˜ญ. You can list clients with the list-clients command.

target-session gets tried in this 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 โ€” so like 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 counts, periodt. So =mysess will only match exactly mysess, not mysession, no exceptions ๐ŸŒธ

If a single session is found, that's your target session. Multiple matches = error, bestie ๐Ÿ’€. And if a session is omitted entirely, the current session is used if there is one; if there's no current session available, the most recently used one gets picked ๐Ÿ‘‘

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

  1. A special token, listed below.
  2. A window index โ€” so 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.

Same as with sessions, a = prefix means exact match only ๐ŸŽ€. An empty window name specifies the next unused index if that's appropriate (like for the new-window and link-window commands), otherwise the current window in session is chosen.

These special tokens are available to point at particular windows. Each one has a single-character alternative form too ๐Ÿฆ‹

  • {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
  • {current} / @ โ€” the current window
  • {mouse} / = โ€” the window where the mouse event happened

target-pane (or src-pane or dst-pane) can be a pane ID, or it takes a similar form to target-window but with the optional addition of a period followed by a pane index or pane ID, like for example mysession:mywindow.1 ๐Ÿ’–. If you leave the pane index out, the currently active pane in the specified window is used. These special tokens work 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
  • {active} / @ โ€” the active pane
  • {marked} / ~ โ€” the marked pane
  • {mouse} / = โ€” the pane where the mouse event happened

The tokens + and - may be followed by an offset, like this bestie:

select-window -t:+2

Also!! target-session, target-window or target-pane can consist entirely of the token {mouse} (alternative form =) to specify the session, window or pane where the most recent mouse event occurred (check the โ€œMOUSE SUPPORTโ€ section), or {marked} (alternative form ~) to specify the marked pane (check select-pane -m) ๐Ÿญโœจ


Sessions, windows 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 stay unchanged for the whole life of the session, window or pane in the tmux server, fr fr. The pane ID gets passed to the child process of the pane in the TMUX_PANE environment variable ๐ŸŒˆ. IDs can 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.

target-session, target-window or target-pane each denote the โ€˜typeโ€™ of target the command needs to work on. If a target isn't explicitly qualified using : and ., tmux will pick whatever seems like the best choice available ๐Ÿ‘‘. For example, if a target-pane of 1 is used with a current window that has only one pane, tmux knows that the 1 can't mean a pane, so it'll look for the active pane in window 1, or the active pane in the current window in session 1. Only if none of those are there will it report an error ๐Ÿ’€. If it really matters that a specific pane, window or session always gets used โ€” like from a script โ€” the target should be fully qualified (for example a target-pane of -t:.1), or else pane, window or session IDs should be used. Don't be sloppy, bestie ๐Ÿซถ

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'

Unless specified, tmux uses the value of default-shell in place of /bin/sh ๐ŸŒธ

Also, the new-window, new-session, split-window, respawn-window, respawn-pane and display-popup commands allow shell-command to be given as multiple arguments and executed directly (without sh -c) ๐ŸŽ€. This can dodge issues with shell quoting, iconic honestly. For example:

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

Will run vi(1) directly without invoking the shell โœจ

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, bestie ๐Ÿ’–. Clients are attached to sessions to interact with them โ€” either when they're 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 they're made up of one or more panes, each of which contains a pseudo terminal ๐Ÿ‘‘. Commands for creating, linking and otherwise manipulating windows live in the โ€œWINDOWS AND PANESโ€ section.

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, attach to target-session in the current terminal. target-session must already exist โ€” to create a new session, see the new-session command (with -A to create or attach) ๐Ÿ˜Œ. If used from inside, it switches the currently attached session over to target-session. If -d is specified, any other clients attached to the session get detached ๐Ÿ’€. If -x is given, it sends SIGHUP to the parent process of the client as well as detaching the client, which typically causes it to exit. -f sets a comma-separated list of client flags. The flags are:
    • ignore-size โ€” the client does not affect the size of other clients
    • new-layouts โ€” use the new layout string format
    • 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 ๐ŸŽ€. -r is an alias for -f read-only,ignore-size. When a client is read-only, only keys bound to the detach-client or switch-client commands have any effect. That's it. Nothing else works. Respect the read-only era ๐Ÿ’…

If no server is started, attach-session will attempt to start it โ€” but this will fail unless sessions are created in the configuration file ๐Ÿ˜ญ

The target-session rules for attach-session are slightly adjusted: if tmux needs to select the most recently used session, it will prefer the most recently used unattached session ๐Ÿซถ

-c will set the session working directory (used for new windows) to working-directory.

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


  • detach-client [-aP] [-E shell-command] [-s target-session] [-t target-client] โ€” (alias: detach) Detach the current client if it's bound to a key, the client specified with -t, or all clients currently attached to the session specified by -s ๐ŸŒธ. The -a option kills all but the client given with -t. If -P is given, it sends SIGHUP to the parent process of the client, typically causing it to exit ๐Ÿ’€. With -E, run shell-command to replace the client โœจ

has-session ๐Ÿ’…

has-session [-t target-session]
              (alias: has)

Bestie, this one is a straight-up vibe check on a session. If the session you named with -t target-session does not exist, it yells at you and bails with exit status 1. If it does exist? Chill, exits 0. That's it, that's the whole job. โœจ


kill-server ๐Ÿ’€

kill-server

No flags, no mercy โ€” this one takes out the entire tmux server, every client hanging off it, and destroys all the sessions. It's giving scorched earth, fr fr. ๐Ÿ˜ญ


kill-session ๐Ÿ”ฅ

kill-session [-aCg] [-f filter] [-t target-session]

This destroys the session you point at with -t target-session โ€” closes any windows linked to it (and only it), and detaches every client attached to it. Other sessions get to live another day. Slay.

  • -a โ€” nuke all the sessions except the one you specified. Bye besties ๐Ÿ‘‹
  • -f filter โ€” when you're using -a, this sets a filter. Only the sessions where the filter comes back true get killed. So it's a targeted takedown, not a bloodbath.
  • -g โ€” if that session is part of a session group, then the whole group goes down, not just the one.
  • -C โ€” clears alerts (that's bell, activity, or silence) in every window linked to the session. Peace and quiet, periodt.

list-clients ๐Ÿ“‹

list-clients [-r] [-F format] [-f filter] [-O sort-order] [-t target-session]
      (alias: lsc)

Shows you every client currently attached to the server. The whole roster.

  • -F format โ€” picks the format of each line.
  • -f filter โ€” only clients where the filter is true show up. Filter deets live in the โ€œFORMATSโ€ section, iykyk.
  • -O sort-order โ€” how to sort them. Pick one of: 'name', 'size', 'creation' (that's time), or 'activity' (also time).
  • -r โ€” reverses the sort order. Flip it and reverse it. ๐Ÿ”„
  • -t target-session โ€” if you give this, it only lists clients connected to that session. So specific.

list-commands ๐ŸŽ€

list-commands [-F format] [command]
      (alias: lscm)

Lists the syntax of command โ€” or, if you leave it out, of every single command tmux supports. It's the full menu. The -F format flag lets you control the format of what comes back.


list-sessions ๐ŸŒธ

list-sessions [-r] [-F format] [-f filter] [-O sort-order]
      (alias: ls)

Lists all the sessions the server is managing. Your whole collection, bestie. ๐Ÿ’–

  • -F format โ€” sets the format of each line.
  • -f filter โ€” only sessions where the filter is true show up. Check the โ€œFORMATSโ€ section for how filters work.
  • -O sort-order โ€” sorting time. Choose one of: 'index', 'name', 'creation' (time), or 'activity' (time).
  • -r โ€” reverses the sort order. The way that flips the whole list around, iconic.

lock-client ๐Ÿ”’

lock-client [-t target-client]
      (alias: lockc)

Locks target-client. Need the deets on what locking actually does? Go read the lock-server command, girlie.


lock-session ๐Ÿ”’โœจ

lock-session [-t target-session]
      (alias: locks)

Locks all the clients attached to target-session. Every one of them. No entry without the key. ๐Ÿ‘‘


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)

Creating a whole new session called session-name. Main character origin story. โœจ

So the tea: the new session attaches itself to your current terminal unless you pass -d. window-name and shell-command are the name of, and the shell command to run in, that very first window. With -d, the starting size comes from the global default-size option โ€” and you can override that size with -x and -y. Passing '-' means "use the size of the current client, if there is one." And heads up: if you give -x or -y, the default-size option gets set for the session. -f sets a comma-separated list of client flags (peep attach-session for those).

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

Now the -A flag: it makes new-session behave like attach-session whenever session-name already exists. And if -A is in play, then -D behaves like -d does to attach-session, and -X behaves like -x does 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 are linked into every session in the group, and any windows closed get removed from all of them. But the current and previous window, and any session options, stay independent. Any session in a group can be killed without it affecting the others. Group chat, but make it windows. ๐Ÿซถ

The group-name argument can be:

  1. the name of an existing group โ€” in which case the new session gets added to that group;
  2. the name of an existing session โ€” the new session joins the same group as that session, and a new group gets created if one's needed;
  3. the name for a brand new group containing only the new session.
-n and shell-command are invalid if -t is used. Don't do it. ๐Ÿšซ

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

If -E is used, the update-environment option will not be applied. And -e takes the form 'VARIABLE=value' and sets an environment variable for the newly created session โ€” you can use it multiple times if you're feeling extra. ๐Ÿ’…


refresh-client ๐Ÿงš

refresh-client [-cDlLRSU] [-A pane:state] [-B name:what:format] [-C
      size] [-f flags] [-r pane:report] [-t target-client]
      [adjustment]
      (alias: refresh)

Refreshes the current client if you've bound this to a key, or refreshes a single client if you point at one with -t. And if -S is specified, it only updates the client's status line โ€” nothing else, just the glow-up on the bar.

Now here's where it gets spicy. The -U, -D, -L, -R, and -c flags let you change the visible portion of a window that's bigger than the client:

  • -U moves the visible part up by adjustment rows
  • -D moves it down
  • -L moves it left by adjustment columns
  • -R moves it right
  • -c snaps back to tracking the cursor automatically

If adjustment is left out, 1 is used. โš ๏ธ Important caveat bestie: the visible position is a property of the client, not of the window โ€” so changing the current window in the attached session resets it. Rude, but that's the rule.

  • -C size โ€” sets the width and height of a control mode client, or of a window for a control mode client. size has to be either 'widthxheight' or 'window ID:widthxheight', like '80x24' or '@0:80x24'.
  • -A pane:state โ€” lets a control mode client trigger actions on a pane. The argument is a pane ID (with that leading '%'), then 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, it'll stop reading from the pane.
    • If 'continue', tmux goes back to sending output to the pane if it was paused (whether that was manually or via the pause-after flag).
    • If 'pause', tmux pauses the pane.
    • -A can be given multiple times for different panes. Stack 'em.
  • -B name:what:format โ€” sets a subscription to a format for a control mode client. The argument gets split into three items by colons: name is a name for the subscription, what is a type of item to subscribe to, and format is the format. Once a subscription is added, changes to the format get reported with the %subscription-changed notification, at most once a second. If you only give the name, the subscription is removed. And what can be empty to check the format only for the attached session, or it can be one of: a pane ID like '%0'; '%*' for all panes in the attached session; a window ID like '@0'; or '@*' for all windows in the attached session.
  • -f flags โ€” sets a comma-separated list of client flags. See attach-session.
  • -r pane:report โ€” lets a control mode client give info about a pane via a report (like 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 and stashes it in a new paste buffer. ๐Ÿ“‹
  • -L, -R, -U, -D โ€” move the visible portion of the window left, right, up or down by adjustment, if the window is bigger than the client.
  • -c โ€” resets so the position follows the cursor. Also peep 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 [-adglrw] [user | group]

Changes the access, or the read/write permission, of a user or group. The user running the tmux server (its owner) and the root user cannot be changed and are always permitted access. -g changes a group rather than a user.

  • -a and -d โ€” give or revoke access for the specified user or group. And if a client is already attached, -d causes it to be detached unless it's still permitted by another entry. Sneaky but fair.
  • -r and -w โ€” change the permissions for user or group. -r makes matching clients read-only, -w makes them writable.
  • -l โ€” lists the current access permissions. User entries show with 'U', group entries with 'G', and read-only or writable entries with 'R' or 'W' โ€” for example 'user1 (U,W)' or 'testgroup (G,R)'. If both a user entry and a group entry match a client, the user entry takes precedence. And heads up: only the effective group ID of the client is used, not its supplementary groups.

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). Those permissions have to be changed manually. And bestie, listenโ€”

Great care should be taken not to allow access to untrusted users even read-only. โš ๏ธ

show-messages ๐Ÿ“จ

show-messages [-JT] [-t target-client]
      (alias: showmsgs)

Shows server messages or info. Messages get stored, up to a maximum โ€” that max is set by the message-limit server option. -J and -T show debugging information about jobs and terminals. ๐Ÿ› ๏ธ


source-file ๐Ÿ“‚

source-file [-Fnqv] [-t target-pane] path ...
      (alias: source)

Runs commands from one or more files given by path โ€” and yes, path can be glob(7) patterns. ๐ŸŒˆ

  • -F โ€” if present, path gets expanded as a format.
  • -q โ€” if given, no error is returned when path doesn't exist. No yelling, just vibes.
  • -n โ€” the file is parsed but no commands are executed. Window shopping only.
  • -v โ€” shows the parsed commands and line numbers, if possible.

start-server โญ

start-server
      (alias: start)

Starts the tmux server โ€” if it isn't already running โ€” without creating any sessions. Just the server, standing there, ready.

Note that since by default the tmux server will exit with no sessions, this is only useful if a session is created in ~/.tmux.conf, if exit-empty is turned off, or if another command is run as part of the same command sequence.

For example:

$ tmux start \; show -g

suspend-client ๐Ÿ˜ด

suspend-client [-t target-client] (alias: suspendc)

Suspend a client by sending SIGTSTP (tty stop). Like, it literally tells the client to take a lil nap, bestie. ๐Ÿ’ค


switch-client ๐Ÿ”

switch-client [-ElnprZ] [-c target-client] [-O sort-order] [-t target-session] [-T key-table]

(alias: switchc)

Switch the current session for client target-client to target-session. But okay, plot twist: 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. -O may be used with -n and -p to specify the field to sort on: one of name, size, creation (time), or activity (time). -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 will be looked up using key-table. After that key, the client is returned to its default key table (normally root). 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

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. Periodt. ๐Ÿ’…

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. It's giving very "you are here" energy. ๐ŸŒˆ

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. Just stack it on top, bestie.
  • append-selection-and-cancel (vi: A) โ€” Append the selection to the top paste buffer and exit copy mode. Bye! ๐Ÿ‘‹
  • 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. ๐Ÿ“
  • line-numbers-on โ€” Show line numbers in copy mode. ๐Ÿ”ข
  • line-numbers-off โ€” Hide line numbers in copy mode. ๐Ÿ™ˆ
  • line-numbers-toggle (emacs: L) โ€” Toggle line numbers in copy mode. ๐Ÿ”ข
  • 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 treat all non-whitespace characters as part of a word. ๐Ÿงต
  • next-space-end (vi: E) โ€” Same as next-word-end but treat all non-whitespace characters as part of a word. ๐Ÿงต
  • 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 to the previous word. ๐Ÿ“–
  • previous-space (vi: B) โ€” Same as previous-word but treat all non-whitespace characters as part of a word. ๐Ÿงต
  • rectangle-on โ€” Turn on rectangle selection mode. ๐Ÿ”ฒ
  • rectangle-off โ€” Turn off rectangle selection mode. ๐Ÿ”ณ
  • rectangle-toggle (vi: v) (emacs: R) โ€” Toggle rectangle selection mode. ๐Ÿ”ฒ
  • recentre-top-bottom (emacs : C-l) โ€” Cycles the current line between centre, top, and bottom. ๐Ÿ”„
  • refresh-on โ€” Turn on automatic refresh of the content from the pane, so that new output appears while in copy mode. Automatic refresh is off by default; it will scroll only while the cursor is at the bottom and is paused while a selection is in progress. ๐Ÿ”„
  • refresh-off โ€” Turn off automatic refresh of the content from the pane. โธ๏ธ
  • refresh-now (vi: r) (emacs: r) โ€” Refresh the content from the pane once. ๐Ÿ”„
  • refresh-toggle โ€” Toggle automatic refresh of the content from the pane. ๐Ÿ”„
  • scroll-bottom โ€” Scroll up until the current line is at the bottom while keeping the cursor on that line. โฌ‡๏ธ
  • scroll-down (vi: C-e) (emacs: C-Down) โ€” scroll down, bestie. When mode-keys is vi, the cursor stays fixed relative to the text. ๐Ÿ’ซ
  • scroll-down-and-cancel โ€” literally scroll-down but it also dips out of copy mode if the cursor hits the bottom.
  • scroll-exit-on โ€” turn ON the "exit copy mode when you scroll to the end of the buffer" behaviour โ€” unless a selection is present, bc we're not gonna yeet your selection, no ma'am.
  • scroll-exit-off โ€” turn that same exit-when-you-reach-the-end thing OFF. ๐Ÿ™ˆ
  • scroll-exit-toggle โ€” toggle it, iconically.
  • scroll-middle (vi: z) โ€” scroll so the current line becomes the middle one, while keeping the cursor planted right there on that line. main character centering. ๐Ÿ‘‘
  • scroll-to-mouse โ€” scrolls the pane in copy-mode when it's bound to a mouse drag event. -e makes copy mode bail out when you're at the bottom.
  • scroll-top โ€” scroll down until the current line sits at the top, cursor still chillin' on it.
  • scroll-up (vi: C-y) (emacs: C-Up) โ€” scroll up. If mode-keys is vi, the cursor is fixed relative to the text.
  • search-again (vi: n) (emacs: n) โ€” run the last search again, fr fr.
  • search-backward text (vi: ?) โ€” search backwards for the text you specified.
  • search-backward-incremental text (emacs: C-r) โ€” search backwards incrementally for the specified text. This one is expected to be used with the -i flag to the command-prompt command. ๐Ÿงš
  • search-backward-text text โ€” search backwards for the specified plain text.
  • search-forward text (vi: /) โ€” search forward for the specified text.
  • search-forward-incremental text (emacs: C-s) โ€” search forward incrementally for the specified text. Again: expected to be used with the -i flag to the command-prompt command.
  • search-forward-text text โ€” search forward for the specified plain text.
  • search-reverse (vi: N) (emacs: N) โ€” repeat the last search but backwards-ways: forward becomes backward and backward becomes forward. ๐Ÿ”„
  • select-line (vi: V) โ€” select the current line.
  • select-word โ€” select the current word.
  • selection-mode [char | word | line] โ€” change the selection mode.
  • set-mark (vi: X) (emacs: X) โ€” mark the current line.
  • start-of-line (vi: 0) (emacs: C-a) โ€” move the cursor to the start of the line.
  • stop-selection โ€” stop selecting, but without clearing the current selection you already have. ๐Ÿ˜Œ
  • toggle-position (vi: P) (emacs: P) โ€” toggle whether the position indicator in the top right is visible.
  • top-line (vi: H) (emacs: M-R) โ€” move to the top line.

Okay so the search commands come in several varieties, and this is important, so lock in: โ€˜search-forwardโ€™ and โ€˜search-backwardโ€™ search for a regular expression. The โ€˜-textโ€™ variants search for a plain text string instead of a regular expression. The โ€˜-incrementalโ€™ ones do an incremental search and expect to be used with the -i flag to the command-prompt command. โ€˜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 new search term; if you press them with an empty search term they repeat the previously used search term. chef's kiss emulation. ๐Ÿ˜ญ

The โ€˜next-promptโ€™ and โ€˜previous-promptโ€™ move between shell prompts, but โ€” plot twist โ€” they require the shell to emit an escape sequence (\033]133;A\033\\) to tell tmux where the prompts are located. If the shell doesn't do that, these commands will do 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. If the shell doesn't send these escape sequences, these commands do nothing. periodt. ๐Ÿ’€

Copy commands may take an optional buffer prefix argument, and that's what's used to generate the buffer name โ€” the default is โ€˜bufferโ€™, so buffers end up named โ€˜buffer0โ€™, โ€˜buffer1โ€™ and so on. Pipe commands take a command argument, which is the command that the selected text gets piped into. โ€˜copy-pipeโ€™ variants also copy the selection. The โ€˜-and-cancelโ€™ variants of some commands exit copy mode after they've completed (for copy commands) or when the cursor reaches the bottom (for scrolling commands). โ€˜-no-clearโ€™ variants do not 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 can be customized with the word-separators session option. Next word moves to the start of the next word, next word end to the end of the next word, and previous word to the start of the previous word. The three next and previous space keys work similarly but treat all non-whitespace characters as part of a word. Setting word-separators to the empty string makes next/previous word equivalent to next/previous space. lowkey elegant. โœจ

The jump commands enable quick movement within a line. For instance, typing โ€˜fโ€™ followed by โ€˜/โ€™ will move the cursor to the next โ€˜/โ€™ character on the current line. A โ€˜;โ€™ will then jump to the next occurrence. obsessed. ๐Ÿ”ฅ

Commands in copy mode may be prefaced by an optional repeat count. With vi key bindings, a prefix is entered using the number keys; with emacs, the Alt (meta) key and a number begins prefix entry.

The synopsis for the copy-mode command is:

copy-mode [-dekHMqSu] [-s src-pane] [-t target-pane]
  • Enter copy mode. ๐Ÿฆ‹
  • -u enters copy mode and scrolls one page up, and -d 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 bound to a mouse key binding, see โ€œMOUSE SUPPORTโ€).
  • -S enters copy-mode and scrolls when bound to a mouse drag event; see scroll-to-mouse.
  • -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. This will not happen if a selection is present. And while in copy mode, pressing a key other than those used for scrolling will disable this behaviour. It's intended to allow fast scrolling through a pane's history, like this:
bind PageUp copy-mode -eu
bind PageDown copy-mode -ed
  • -k kills the pane when the mode is exited.

A number of preset arrangements of panes are available โ€” these are called layouts, and they're basically the outfit changes of the tmux world. ๐Ÿ‘— These may be selected with the select-layout command or cycled with next-layout (bound to โ€˜Spaceโ€™ by default); once a layout is chosen, panes within it may be moved and resized as 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. geometric slay. ๐ŸงŠ

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: {"V":2,"L":{"t":"h","w":159,"h":48,"x":0,"y":0,"c":[{"t":"p","w":79,"h":48,"x":0,"y":0,"l":0,"i":0,"I":"%0"},{"t":"p","w":79,"h":48,"x":80,"y":0,"a":true,"i":1,"I":"%2"}]}}
$ tmux select-layout '{"V":2,"L":{"t":"h","w":159,"h":48,"x":0,"y":0,"c":[{"t":"p","w":79,"h":48,"x":0,"y":0,"l":0,"i":0,"I":"%0"},{"t":"p","w":79,"h":48,"x":80,"y":0,"a":true,"i":1,"I":"%2"}]}}'

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 that from which the layout was originally defined. ๐Ÿšซ


Commands related to windows and panes are as follows:

  • break-pane [-abdPW] [-F format] [-n window-name] [-s src-pane] [-t dst-window] [-x width] [-y height] [-X x-position] [-Y y-position] (alias: breakp) โ€” break src-pane off from its containing window to make it the only pane in dst-window.
break-pane [-abdPW] [-F format] [-n window-name] [-s src-pane] [-t dst-window] [-x width] [-y height] [-X x-position] [-Y y-position]
      (alias: breakp)

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. ๐Ÿ“‹

If the -W option is given, src-pane is lifted out of the tiled layout and made floating. The -x and -y options set the width and height of the floating pane in columns and lines respectively โ€” the default is half the window width and a quarter the window height. The -X and -Y options set the position of the upper-left corner of the pane; if omitted, new floating panes are cascaded from the top-left of the window. The -x, -y, -X, and -Y options may be followed by โ€˜%โ€™ to specify a percentage of the window size. ๐Ÿ“

If the pane had previously been floating, the position and sizes are restored from the saved values not specified by the -x, -y, -X, and -Y options.

If -d is given, the active pane is not changed โ€” it just stays right where it is. The pane must not already be floating or hidden, and the window must not be zoomed.


๐Ÿซง COMMANDS (still going, bestie, we're so back) ๐Ÿซง

capture-pane

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

alias: capturep

Okay so this one grabs everything that's currently sitting inside a pane. If you pass -p, the output comes straight to stdout, and if you don't, it goes into the buffer you named with -b โ€” or into a brand new buffer if you didn't name one. ๐Ÿ’พ

  • -a โ€” use the alternate screen, and heads up, the history is not accessible when you do. If there's no alternate screen at all, you get an error back, unless you also passed -q.
  • -M โ€” same energy as -a but for modes: if the pane is in a mode, this uses the screen for that mode.
  • -e โ€” include escape sequences for text and background attributes in the output.
  • -C โ€” also escapes non-printable characters as octal \xxx.
  • -T โ€” ignore trailing positions that don't contain a character.
  • -N โ€” preserve trailing spaces at the end of each line.
  • -J โ€” preserve trailing spaces and join any wrapped lines. Also, -J implies -T, no cap.
  • -P โ€” capture only output the pane has received that is the beginning of an as-yet incomplete escape sequence.
  • -L โ€” stick the line number at the start of each line.
  • -I โ€” include the time each line entered the history, or zero if that's not available.
  • -F โ€” include the flags, where:
    • - means no flags
    • D means an unused line
    • O means a line marked as output
    • P means a line marked as a prompt
    • X means a line containing extended cells
    • H means a line with hyperlinks
  • -H โ€” only hyperlinks in the specified lines get captured. If a line has multiple hyperlinks, they're separated by spaces.
  • -R โ€” dumps the internal grid data, for diagnostics. (nerd mode activated ๐Ÿ”ฌ)

And now the line range stuff, because this is where it gets spicy:

  • -S and -E set the starting and ending line numbers. Zero is the first line of the visible pane, and negative numbers are lines in the history. Give - to -S and that's the start of the history; give - to -E and that's the end of the visible pane. By default? You only capture the visible contents of the pane, bestie. Nothing more.

choose-client

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

This throws a pane into client mode, where you can pick a client interactively off a list. Each client gets one line. A shortcut key shows up on the left in brackets so you can just grab one instantly, or you can navigate the list and choose / mess with an item using the keys below. ๐Ÿ‘‘

  • -Z โ€” zooms the pane.
  • -y โ€” disables any confirmation prompts.

The keys you can use in client mode:

  • Enter โ€” choose the selected client
  • Up โ€” select the previous client
  • Down โ€” select the next client
  • C-s โ€” search by name
  • n โ€” repeat last search forwards
  • N โ€” repeat last search backwards
  • t โ€” toggle whether the client is tagged
  • T โ€” tag no clients
  • C-t โ€” tag all clients
  • d โ€” detach the selected client
  • D โ€” detach the tagged clients
  • x โ€” detach and HUP the selected client
  • X โ€” detach and HUP the tagged clients
  • z โ€” suspend the selected client
  • Z โ€” suspend the tagged clients
  • f โ€” enter a format to filter items
  • c โ€” clear the current filter
  • O โ€” change sort order
  • r โ€” reverse sort order
  • v โ€” toggle preview
  • i โ€” change view (preview and client information)
  • F1 or C-h โ€” display help
  • q โ€” exit mode

Once a client is chosen, %% gets swapped out for the client name inside template, and the whole thing runs as a command. If you didn't give a template, then "detach-client -t '%%'" is what gets used. ๐Ÿซถ

  • -O โ€” sets the initial sort order, one of name, size, creation (time), or activity (time).
  • -r โ€” reverses the sort order.
  • -f โ€” sets 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.
  • -F โ€” the format for each item in the list.
  • -K โ€” a format for each shortcut key. Both -F and -K are evaluated once for each line.

More flags:

  • -N โ€” starts without the preview, or if you give it twice, starts with the larger preview.
  • -h โ€” hides the pane containing the mode.
  • -k โ€” kills the pane when the mode is exited.
Heads up: the choose-client command works only if at least one client is attached. No clients, no mode. ๐Ÿ’€

choose-tree

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

This one drops a pane into tree mode, where you can pick a session, window or pane out of a tree, interactively. Each session, window or pane is one line. Shortcut key shows up on the left in brackets for instant grabbing, or navigate the tree and choose / manipulate an item with the keys below. ๐ŸŒณโœจ

  • -s โ€” starts with sessions collapsed.
  • -w โ€” starts with windows collapsed.
  • -Z โ€” zooms the pane.
  • -y โ€” disables any confirmation prompts.

The keys for tree mode:

  • Enter โ€” choose the selected item
  • Up โ€” select the previous item
  • Down โ€” select the next item
  • S-Up โ€” swap the current window with the previous one
  • S-Down โ€” swap the current window with the next one
  • + โ€” expand the selected item
  • - โ€” collapse the selected item
  • M-+ โ€” expand all items
  • M-- โ€” collapse all items
  • x โ€” kill the selected item
  • X โ€” kill the tagged items
  • < โ€” scroll the list of previews left
  • > โ€” scroll the 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 whether the 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
  • c โ€” clear the current filter
  • H โ€” jump to the starting pane
  • O โ€” change sort order
  • r โ€” reverse sort order
  • v โ€” toggle preview
  • i โ€” change view (preview and session, window and pane information)
  • F1 or C-h โ€” display help
  • q โ€” exit mode

After a session, window or pane is chosen: the first instance of %% and all instances of %1 get replaced by the target inside template, and the result runs as a command. If you didn't give a template, "switch-client -t '%%'" is what's used. ๐Ÿ’–

  • -O โ€” sets the initial sort order, one of index, name, activity (time), or z.
  • -r โ€” reverses the sort order.
  • -f โ€” sets an initial filter. The filter is a format: evaluates to zero โ†’ item not shown; otherwise โ†’ shown. If a filter would make an empty list, it's ignored.
  • -F โ€” the format for each item in the tree.
  • -K โ€” a format for each shortcut key. Again, both are evaluated once for each line.
  • -G โ€” include all sessions in any session groups in the tree, instead of only the first one.

And the rest:

  • -N โ€” starts without the preview, or if given twice, with the larger preview.
  • -i โ€” starts showing client information instead of the preview.
  • -h โ€” hides the pane containing the mode.
  • -k โ€” kills the pane when the mode is exited.

-h and -k are literally made to make using this mode inside a floating pane easier. Like, for example:

bind s 'new-pane -x50% -y50% -E; choose-tree -hks'
And the same rule as before: choose-tree works only if at least one client is attached. ๐Ÿซ 

customize-mode

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

Puts a pane into customize mode, where you can browse and modify options and key bindings from a list. The option values shown in the list are for the active pane in the current window. ๐ŸŽ€

  • -Z โ€” zooms the pane.

The keys you can use in customize mode are:

okay bestie, we're still in customize-mode and the keybindings are absolutely giving main character energy โœจ๐Ÿ’…. here's every single one, no cap:

  • 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
  • e โ€” Open the value in an editor
  • 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
  • c โ€” Clear the current filter
  • v โ€” Toggle option information
  • F1 or C-h โ€” Display help
  • q โ€” Exit mode

-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 tree.

-N starts without the option information. -k kills the pane when the mode is exited.

The customize-mode command works only if at least one client is attached. ๐Ÿ’–

switch-mode

switch-mode [-kswZ] [-F format] [-t target-pane] [command]

Put a pane into switch mode, where a session or window may be chosen interactively from a list. Each session or window is shown on one line and the list is narrowed by typing: the typed text is matched against each item with fuzzy matching and only matching items are shown, sorted by how well they match. -s lists sessions (the default) and -w lists windows. -Z zooms the pane. The following keys may be used in switch mode:

  • Enter โ€” Choose the selected item
  • Up โ€” Select the previous item
  • Down โ€” Select the next item
  • Escape โ€” Exit mode

After a session or window is chosen, the first instance of %% and all instances of %1 are replaced by the target in command and the result executed as a command. If command is not given, switch-client -Zt '%%' is used. -F specifies the format for each item in the list. -k kills the pane when the mode is exited.

The appearance of matched characters is controlled by the switch-mode-match-style option. ๐Ÿ‘‘


display-panes

display-panes [-kNZ] [-d duration] [-s source-window] [-t target-pane] [template]

(alias: displayp)

Put target-pane into panes mode, which displays a preview of the window and a visible indicator of each pane. If -s is given, the panes in source-window are displayed instead of those in the window containing target-pane. See the display-panes-colour, display-panes-active-colour, display-panes-border-style, display-panes-format and display-panes-time window options. The indicator is closed when a key is pressed (unless -N is given) or duration milliseconds have passed. If -d is not given, display-panes-time is used. A duration of zero means the indicator stays until a key is pressed. The mode is zoomed by default; -Z starts it unzoomed. -k kills the pane when the mode is exited. While the indicator is on screen, a pane may be chosen with the 0 to 9 keys or by clicking it with the mouse, which will cause template to be executed as a command with %% substituted by the pane ID. The default template is select-pane -t '%%'. ๐Ÿฆ‹


find-window

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

(alias: findw)

Search for a glob(7) pattern or, with -r, regular expression match-string in window names, titles, and visible content (but not history). The flags control matching behavior: -C matches only visible window contents, -N matches only the window name and -T matches only the window title. -i makes the search ignore case. The default is -CNT. -Z zooms the pane.

The find-window command works only if at least one client is attached. โœจ

join-pane

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

(alias: joinp)

Like split-window, but instead of splitting dst-pane and creating a new pane, split it and move src-pane into the space. This can be used to reverse break-pane. The -b option causes src-pane to be joined to left of or above dst-pane.

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

If src-pane is floating and dst-pane is either unspecified or equal to src-pane, src-pane is returned to its previous position in the layout. ๐Ÿ’œ


kill-pane

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

(alias: killp)

Destroy the given pane. If no panes remain in the containing window, it is also destroyed. The -a option kills all panes in the window except the pane given with -t. When -a is given, -f specifies a filter. Only panes for which the filter is true are killed. ๐Ÿ’€


kill-window

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

(alias: killw)

Kill the current window or the window at target-window, removing it from any sessions to which it is linked. The -a option kills all windows in the session except the window given with -t. When -a is given, -f specifies a filter. Only windows for which the filter is true are killed. ๐Ÿ’…


last-pane

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

(alias: lastp)

Select the last (previously selected) pane. -Z keeps the window zoomed if it was zoomed. -e enables or -d disables input to the pane. ๐ŸŒˆ


last-window

last-window [-t target-session]

(alias: last)

Select the last (previously selected) window. If no target-session is specified, select the last window of the current session. ๐ŸŽ€


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

(alias: linkw)

Link 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. With -a or -b the window is moved to the next index after or before dst-window (existing windows are moved if necessary). If -k is given and dst-window exists, it is killed, otherwise an error is generated. If -d is given, the newly linked window is not selected. ๐Ÿ”—


list-panes

list-panes [-ars] [-F format] [-f filter] [-O sort-order] [-t target]

(alias: lsp)

If -a is given, target is ignored and all panes on the server are listed. 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 specifies the format of each line and -f a filter. Only panes for which the filter is true are shown. See the โ€œFORMATSโ€ section. -O specifies the sort order: one of name (title), index, size (area), creation (time), or activity (time). -r reverses the sort order. ๐Ÿซถ


list-windows

list-windows [-ar] [-F format] [-f filter] [-O sort-order] [-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 specifies the format of each line and -f a filter. Only windows for which the filter is true are shown. See the โ€œFORMATSโ€ section. -O specifies the sort order: one of index, name, size (area), creation (time), or activity (time). -r reverses the sort order. ๐Ÿ‘‘


move-pane

move-pane [-bdfhMv] [-D [lines]] [-l size] [-L [columns]] [-P position] [-R [columns]] [-s src-pane] [-t dst-pane] [-U [lines]] [-X x-position] [-Y y-position] [-z z-index]

(alias: movep)

Does the same as join-pane, except if given -D, -L, -P, -R, -U, -X, -Y or -z in which case move the target floating pane. -D, -L, -R and -U move it down, left, right or up by lines or columns (one if omitted). -P moves it to position, which may be one of:

  • top-left โ€” Top left
  • top-centre โ€” Top and horizontal centre
  • top-right โ€” Top right
  • centre-left โ€” Vertical centre and left
  • centre โ€” Centre
  • centre-right โ€” Vertical centre and right
  • bottom-left โ€” Bottom left
  • bottom-centre โ€” Bottom and horizontal centre
  • bottom-right โ€” Bottom right
  • top-left-centre โ€” Centre of top-left quadrant
  • top-right-centre โ€” Centre of top-right quadrant
  • bottom-left-centre โ€” Centre of bottom-left quadrant
  • bottom-right-centre โ€” Centre of bottom-right quadrant
  • front โ€” Front of floating panes
  • back โ€” Back of floating panes
  • forward โ€” Forward one floating pane
  • backward โ€” Backward one floating pane
  • forward-loop โ€” Forward but back if already at front
  • backward-loop โ€” Backward but front if already at back

-X and -Y move it to an absolute position. -z moves the pane to the given z-index, where zero is the front.

-M begins a mouse drag (only valid if bound to a mouse key binding, see โ€œMOUSE SUPPORTโ€). ๐Ÿ–ฑ๏ธ

  • move-window [-abrdk] [-s src-window] [-t dst-window] (alias: movew) โ€” okay so this is basically link-window's sibling but with โœจcommitmentโœจ: the window at src-window gets moved to dst-window instead of being duplicated. With -r, every window in the session gets renumbered in sequential order, respecting the base-index option. slay.
  • new-window [-abdEkPS] [-c start-directory] [-e environment] [-F format] [-n window-name] [-t target-window] [shell-command [argument ...]] (alias: neww) โ€” bestie, make a new window ๐Ÿ’– With -a or -b, the new window gets inserted at the next index after or before the specified target-window, pushing windows up if necessary; otherwise target-window is literally just where the new window lands.

If -d is given, the session does not make the new window the current window (so it chills in the background, no cap). If -E is given, the initial pane is created without a running command. target-window represents the window to be created; if the target already exists you get an error, unless the -k flag is used, in which case it is destroyed ๐Ÿ’€. window-name is the name given to the new window, if any.

If -S is given, an existing window is selected instead of creating a new one (unless -d is also given, in which case the command does nothing at all โ€” it's giving ghost). target-window is preferred if it already identifies an existing window; otherwise a window named window-name is selected if one exists.

shell-command is the command to execute. If shell-command is not specified, the value of the default-command option is used. -c specifies the working directory in which the new window is created.

When the shell command completes, the window closes. See the remain-on-exit option to change this behaviour.

-e takes the form โ€˜VARIABLE=valueโ€™ and sets an environment variable for the newly created window; it may be specified multiple times.

The TERM environment variable must be set to โ€˜screenโ€™ or โ€˜tmuxโ€™ for all programs running inside tmux. New windows will automatically have โ€˜TERM=screenโ€™ added to their environment, but care must be taken not to reset this in shell startup files or by the -e option. โš ๏ธ don't sabotage yourself.

The -P option prints information about the new window after it has been created. By default, it uses the format โ€˜#{session_name}:#{window_index}โ€™ but a different format may be specified with -F.

  • new-pane [-AbCDefhIkKLMOPvWZ] [-B border-lines] [-c start-directory] [-e environment] [-F format] [-l size] [-m message] [-p percentage] [-R inactive-border-style] [-s style] [-S active-border-style] [-t target-pane] [-T title] [-x width] [-y height] [-X x-position] [-Y y-position] [shell-command [argument ...]] (alias: newp) โ€” creates a new floating pane ๐Ÿฆ‹ the iconique floaty ones. The -x and -y options set the width and height of the floating pane in columns and lines respectively. The default is half the window width and a quarter the window height. The -X and -Y options set the position of the upper-left corner of the pane. If omitted, new floating panes are cascaded from the top-left of the window. The -x, -y, -X, and -Y options may be followed by โ€˜%โ€™ to specify a percentage of the window size. -B sets the pane border lines for floating panes; see pane-border-lines. -M may be used when bound to a mouse drag key; the new floating pane is resized to follow the mouse drag. -A creates a floating pane which remains visible above a zoomed pane. -O creates a modal pane. A modal pane is always the active pane and prevents interaction with any other panes while it is active โ€” main character energy, fr fr ๐Ÿ‘‘. A window can only have one modal pane and it must be a floating pane. With -K, all keys, including the prefix key, are passed directly to the modal pane. With -C, the modal pane is closed when the mouse is clicked outside it. With -D, the modal pane is closed when โ€˜Escapeโ€™ or โ€˜C-cโ€™ is pressed.

The -L option makes new-pane behave like split-window.

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

  • next-layout [-t target-window] (alias: nextl) โ€” move a window to the next layout and rearrange the panes to fit. glow up era โœจ
  • 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 with 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 vice versa. A pane may only be connected to one command at a time, so any existing pipe is closed before shell-command is executed. 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 any) is closed.

-I and -O specify which of the shell-command output streams are connected to the pane: with -I stdout is connected (so anything shell-command prints is written to the pane as if it were typed); with -O stdin is connected (so any output in the pane is piped to shell-command). Both may be used together and if neither are specified, -O is used.

The -o option only opens a new pipe if no previous pipe exists, allowing a pipe to be toggled with a single key, for example:

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

so handy bestie, iykyk ๐Ÿ’…

  • previous-layout [-t target-window] (alias: prevl) โ€” move to the previous layout in the session.
  • previous-window [-a] [-t target-session] (alias: prev) โ€” move to the previous window in the session. With -a, move to the previous window with an alert.
  • rename-window [-t target-window] new-name (alias: renamew) โ€” rename the current window, or the window at target-window if specified, to new-name. name it something cute ๐ŸŽ€.
  • resize-pane [-MTZ] [-D lines] [-L columns] [-R columns] [-U lines] [-x width] [-y height] [-t target-pane] (alias: resizep) โ€” resize a pane, up, down, left or right by a specified adjustment with -U, -D, -L or -R; or to an absolute size with -x or -y. The adjustment is given in lines or columns (the default is 1); -x and -y may be a given as a number of lines or columns or followed by โ€˜%โ€™ for a percentage of the window size (for example โ€˜-x 10%โ€™). If target-pane is floating, -U, -D, -L, and -R target their respective borders, and negative values may be given. With -Z, the active pane is toggled between zoomed (occupying the whole of the window) and unzoomed (its normal position in the layout).

-M begins mouse resizing (only valid if 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 with -U, -D, -L or -R, or to an absolute size with -x or -y. The adjustment is given in lines or cells (the default is 1). -A sets the size of the largest session containing the window; -a the size of the smallest. This command will automatically set window-size to manual in the window options.
  • respawn-pane [-Ek] [-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). If shell-command is not given, the command used when the pane was created or last respawned is executed. The pane must be already inactive, unless -k is given, in which case any existing command is killed ๐Ÿ’€. If -E is given, the pane is left without a running command. -c specifies a new working directory for the pane. The -e option has the same meaning as for the new-window command.
  • respawn-window [-Ek] [-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 is not given, the command used when the window was created or last respawned is executed. The window must be already inactive, unless -k is given, in which case any existing command is killed. If -E is given, the window is left with one pane and without a running command. -c specifies a new working directory for the window. The -e option has the same meaning as 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). -Z keeps the window zoomed if it was zoomed. spin spin spin ๐ŸŒ€
  • select-layout [-Enop] [-t target-pane] [layout-name] (alias: selectl) โ€” choose a specific layout for a window. If layout-name is not given, the last preset layout used (if any) is reapplied. -n and -p are equivalent to the next-layout and previous-layout commands. -o applies the last set layout if possible (undoes the most recent layout change). -E spreads the current pane and any panes next to it out evenly.
  • 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, 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 or -d disables input to the pane. -T sets the pane title.

-m and -M are the marked pane girlies โœจ โ€” one sets it, one clears it. There's only one marked pane at a time bestie, so the second you mark a new one the old one gets ๐Ÿ’€ cleared, no exceptions. And why do we care? Because the marked pane is the default target for -s on join-pane, move-pane, swap-pane and swap-window. Main character pane behaviour, honestly ๐Ÿ‘‘.

๐ŸชŸ select-window

select-window [-lnpT] [-t target-window]
              (alias: selectw)

Picks the window at target-window ๐Ÿ’–. And listen โ€” -l, -n and -p are literally just the last-window, next-window and previous-window commands wearing a disguise ๐ŸŽญ. Then there's -T: if you pass it and the selected window is already the current window, it behaves like last-window instead. Sneaky little toggle, we love her ๐ŸŒธ.

โœ‚๏ธ split-window

split-window [-bdefhIkPvZ] [-B border-lines] [-c start-directory] [-e
        environment] [-F format] [-l size] [-m message] [-p percentage]
        [-R inactive-border-style] [-s style] [-S active-border-style]
        [-t target-pane] [-T title] [shell-command [argument ...]]
              (alias: splitw)

Okay so this is the icon herself: creates a brand new pane by splitting target-pane ๐ŸŽ€.

  • -d โ€” the session does not make the new pane the current pane. It gets born but stays in the background, humble queen ๐Ÿ™ˆ.
  • -Z โ€” zooms if the window isn't zoomed, or keeps it zoomed if it already is.
  • -s โ€” sets the style for the pane content.
  • -S โ€” sets the border style when the pane is active.
  • -R โ€” sets the border style when the pane is inactive. (Both of these are the "see STYLES" girlies ๐Ÿ’….)
  • -T โ€” sets the pane title.

Then the geometry section, and it matters, so pay attention bestie:

  • -h does a horizontal split and -v does a vertical split. If you specify neither? -v is assumed. The default is right there, no cap ๐ŸŒˆ.
  • -l specifies the size of the new pane โ€” in lines for a vertical split, or in columns for a horizontal split. And the size can be followed by โ€˜%โ€™ to mean a percentage of the available space ๐ŸŒธ.
  • -p is just shorthand for that percentage thing. Same energy, fewer keystrokes โœจ.
  • -B sets the pane border lines for floating panes โ€” go read pane-border-lines for the deets ๐Ÿฆ‹.
  • -b โ€” the new pane gets created to the left of or above target-pane. Baby goes first ๐Ÿฅบ.
  • -f โ€” makes a new pane spanning the full window height (with -h) or the full window width (with -v), instead of just splitting the active pane. Full send ๐Ÿ’€.

Now, floating panes get their own lil rules. If target-pane is floating, a new floating pane is created adjacent to it with equal sizes ๐Ÿ‘ฏ. The position is decided by the -h, -v, and -b flags. And if any part of the new pane wouldn't be visible on screen, target-pane and the new pane both get resized to fit. Teamwork, fr fr ๐Ÿซถ.

-k keeps the pane open after the optional shell-command exits, and waits for a key press before closing it. The message shown is controlled by the remain-on-exit-format option. And -m message is the same as -k but also sets the remain-on-exit-format option for this pane to message. Two-for-one, iconic ๐ŸŽ€.

-W waits until shell-command exits, then returns its exit status. Like so:

$ tmux new-pane -W 'vi afile'
$ echo $?
0

-E โ€” or just an empty shell-command, ('') โ€” creates an empty pane with no command running in it. display-message -I can write to an empty pane, iykyk ๐Ÿ‘€.

-I creates an empty pane and forwards any output from stdin to it. Example time:

$ make 2>&1|tmux new-pane -dI &

๐Ÿ”„ swap-pane

swap-pane [-dDUZ] [-s src-pane] [-t dst-pane]
              (alias: swapp)

Swaps two panes, periodt ๐Ÿ”.

  • -U โ€” if you use it and don't give a source pane with -s, then dst-pane gets swapped with the previous pane (the one before it numerically).
  • -D โ€” swaps with the next pane (the one after it numerically).
  • -d โ€” tells tmux not to change the active pane, stay put bestie ๐Ÿ™….
  • -Z โ€” keeps the window zoomed if it was zoomed.

And the plot twist ๐Ÿ‘‘: if -s is omitted and there's a marked pane hanging around (see select-pane -m), the marked pane is used instead of the current pane. Marked girlies stay winning.

๐Ÿ” swap-window

swap-window [-d] [-s src-window] [-t dst-window]
              (alias: swapw)

Basically link-window's cousin, except the source and destination windows get swapped ๐Ÿ’ซ. It's an error if no window exists at src-window โ€” like, actual error, not a vibe ๐Ÿ’€. And if -d is given, the new window does not become the current window.

Same deal as before: if -s is omitted and there's a marked pane (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)

Unlinks target-window ๐ŸŽ€. Here's the rules, listen closely:

  • Unless -k is given, a window may only be unlinked if it is linked to multiple sessions โ€” windows may not be linked to no sessions, that's not a thing bestie ๐Ÿšซ.
  • If -k is specified and the window is linked to only one session, it is unlinked and destroyed ๐Ÿ’€. Gone. Poof.

๐ŸŒˆ KEY BINDINGS ๐ŸŒˆ

tmux lets a command be bound to most keys, with or without a prefix key โœจ. When you're specifying keys, most of them just represent themselves (like โ€˜Aโ€™ to โ€˜Zโ€™, casual). Ctrl keys can 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: 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.

Okay important note bestie: to bind the โ€˜"โ€™ or โ€˜'โ€™ keys you need quotation marks. Yes really. Like this:
bind-key '"' split-window
bind-key "'" new-window

A command bound to the Any key will execute for all keys which don't have a more specific binding. Catch-all energy, we stan ๐ŸŒธ.

Commands related to key bindings are as follows:

๐ŸŽ€ bind-key

bind-key [-nr] [-N note] [-T key-table] key [command [argument ...]]
              (alias: bind)

Binds key to command ๐Ÿ’–. Keys are bound in a key table, and here's the tea:

  • By default (no -T), the key gets bound in the prefix key table. That table is 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 for keys pressed without the prefix key. Binding โ€˜cโ€™ to new-window in the root table (โš ๏ธ not recommended bestie) means a plain โ€˜cโ€™ creates a new window. Chaos.
  • Keys can also be bound in custom key tables, and the switch-client -T command is how you switch to them from a key binding ๐Ÿฆ‹.
  • -r โ€” 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), and you clear it by passing an empty string.
  • The -r and -N flags can both be used without command to alter an existing binding ๐Ÿ‘‘

To view the default bindings and possible commands, go see the list-keys command ๐Ÿซถ.

๐Ÿ“‹ list-keys

list-keys [-1aNr] [-F format] [-O sort-order] [-P prefix-string] [-T
        key-table] [key]
              (alias: lsk)

Lists key bindings โœจ.

  • -F โ€” specifies the format of each line. See the โ€œFORMATSโ€ section ๐ŸŒˆ.
  • -T โ€” specifies a key-table to list from.
  • -1 โ€” lists only the first matching key.
  • -O โ€” specifies the sort order: one of โ€˜keyโ€™, โ€˜modifierโ€™, โ€˜nameโ€™ (that's the table name).
  • -r โ€” reverses the sort order ๐Ÿ”ƒ.

If no format is given, there are two forms, bestie:

  • 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 unless specified otherwise. 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 -a lists the command for keys that don't have a note rather than skipping them. No key left behind ๐Ÿ’….

๐Ÿ“จ send-keys

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

Sends a key or keys to a window or client ๐Ÿ“ฌ. Each argument key is the name of the key (like โ€˜C-aโ€™ or โ€˜NPageโ€™) to send; and if the string isn't recognised as a key, it gets sent as a series of characters. Fine, we improvise ๐Ÿ’.

  • -K โ€” keys are sent to target-client instead, so they're looked up in the client's key table rather than in target-pane.

All arguments are sent sequentially, first to last, in order, no jumping the queue ๐Ÿ˜ค. And if no keys are given and the command is bound to a key, then that key is used. Self-referential, iconic.

  • -l โ€” disables key name lookup and processes the keys as literal UTF-8 characters ๐Ÿฆ‹.
  • -H โ€” expects each key to be a hexadecimal number for an ASCII character ๐Ÿ”ข.
  • -R โ€” 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 โ€” sends a command into copy mode, see the โ€œWINDOWS AND PANESโ€ section ๐Ÿ‘€.
  • -N โ€” specifies a repeat count.
  • -F โ€” expands formats in arguments where appropriate โœจ.

๐ŸŽฏ send-prefix

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

Sends the prefix key to a window as if it was pressed ๐ŸŽน โ€” or with -2, the secondary prefix key. Yes, there's a second one. She has layers ๐Ÿ’….

๐Ÿ”“ unbind-key

unbind-key [-anq] [-T key-table] key
              (alias: unbind)

Unbinds the command bound to key ๐Ÿ’”. -n and -T work the same as they do for bind-key. If -a is present, all key bindings are removed โ€” every single one, scorched earth, no survivors ๐Ÿ’€. The -q option prevents errors being returned, so it just vibes quietly instead ๐Ÿคซ.

โœจ OPTIONS โœจ

The appearance and behaviour of tmux can 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, check 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 โœจ.

On top of that, each individual session may have a set of session options, and there is a separate set of global session options ๐ŸŒธ. Sessions which don't have a particular option configured inherit the value from the global session options โ€” the family heirloom vibe ๐Ÿซถ. 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 โ€” the vibes trickle down, bestie, it's a whole family tree. 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, no cap. 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.

Array options may be set by giving a key in square brackets after the option name, for example command-alias[zoom].

Here's the flag rundown, so nothing slips past you:

  • -F โ€” expands formats in the option value.
  • -u โ€” 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.
  • -o โ€” prevents setting an option that is already set.
  • -q โ€” suppresses errors about unknown or ambiguous options.
  • -a โ€” append mode, see below.

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).

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. ๐ŸŽจ

๐Ÿซถ show-options

show-options [-AgHpqsvw] [-F format] [-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. Just the tea, no label. ๐Ÿต
  • -F โ€” format is used for each option.
  • -q โ€” 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. ๐Ÿ“š

clear-on-attach [on | off]

When enabled (the default), the client terminal switches to the alternate screen and clears it when a client is attached. When disabled, tmux does not enter the alternate screen; instead the existing terminal content is scrolled into the scrollback buffer so it remains accessible.

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[zoom] 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. ๐Ÿ‘€

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, an identifier of the form U+number where the number is a hexadecimal number, or a range of the form U+number-U+number.

copy-command shell-command

Give the command to pipe to if the copy-pipe copy mode command is used without arguments.

theme [detect | terminal | light | dark]

Whether tmux should use the detected client theme (detect), use terminal ANSI colours (terminal), or force the light or dark theme.

dark-theme-black, dark-theme-white, dark-theme-light-grey, dark-theme-dark-grey, dark-theme-green, dark-theme-yellow, dark-theme-red, dark-theme-blue, dark-theme-cyan, dark-theme-magenta, light-theme-black, light-theme-white, light-theme-light-grey, light-theme-dark-grey, light-theme-green, light-theme-yellow, light-theme-red, light-theme-blue, light-theme-cyan and light-theme-magenta colour

Set the theme colours. These are the named colours themeblack, themewhite, themelightgrey, themedarkgrey, themegreen, themeyellow, themered, themeblue, themecyan and thememagenta which may be used in styles and elsewhere a colour is accepted. The dark-theme-* set is used when the client reports a dark background and the light-theme-* set when it reports a light background; an unknown background is treated as dark. ๐ŸŒ—

default-client-command command

Set the default command to run when tmux is called without a command. The default is new-session.

default-terminal terminal

Set the default terminal for new windows created in this session โ€” the default value of the TERM environment variable. For tmux to work correctly, this must be set to screen, tmux or a derivative of them.

escape-time time

Set the time in milliseconds for which tmux waits after an escape is input to determine if it is part of a function or meta key sequences.

editor shell-command

Set the command used when tmux runs an editor.

exit-empty [on | off]

If enabled (the default), the server will exit when there are no active sessions.

exit-unattached [on | off]

If enabled, the server will exit when there are no attached clients.

extended-keys [on | off | always]

Controls how modified keys (keys pressed together with Control, Meta, or Shift) are reported. This is 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 which lack an existing 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 will be forced instead of the standard mode. When set to off, this feature is disabled and only standard keys are 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.

extended-keys-format [csi-u | xterm]

Selects one of the two possible formats for reporting modified keys to applications. This is the equivalent of the formatOtherKeys xterm(1) resource. For example, C-S-a will be 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 are requested from the terminal if supported and passed through to applications running in tmux. Attached clients should be detached and attached again after changing this option.

focus-follows-mouse [on | off]

When enabled and mouse is on, moving the mouse into a pane selects it.

get-clipboard [both | request | buffer | off]

Controls the behaviour when an application requests the clipboard from tmux.

If off, the request is ignored; if buffer, tmux responds with the newest paste buffer; request causes tmux to request the clipboard from the most recently used client (if possible) and send the reply (if any) back to the application; both is the same as request but also creates a paste buffer.

See also the set-clipboard option. ๐Ÿ“‹

history-file path

If not empty, a file to which tmux will write command prompt history on exit and load it from on start.

input-buffer-size bytes

Maximum of bytes allowed to read in escape and control sequences. Once reached, the sequence will be discarded.

message-limit number

Set the number of error or information messages to save in the message log for each client.

prompt-history-limit number

Set the number of history items to save in the history file for each type of command prompt.

set-clipboard [on | external | off]

Attempt to set the terminal clipboard content using the xterm(1) escape sequence, if there is an Ms entry in the terminfo(5) description (see the โ€œTERMINFO EXTENSIONSโ€ section).

If it's set to on, tmux will โœจbothโœจ accept the escape sequence that creates a buffer and try to set the terminal clipboard. If it's set to external, tmux tries to set the terminal clipboard but ignores any attempts by applications to set tmux buffers. And if it's off? tmux neither accepts the clipboard escape sequence nor tries to touch the clipboard at all. ๐Ÿ’…

Heads up bestie โ€” this whole feature has to be enabled in xterm(1) first by setting the resource:
disallowedWindowOps: 20,21,SetXprop

Or by changing that property from the xterm(1) interactive menu whenever you need it. ๐ŸŽ€


๐ŸŒˆ terminal-features[] string

Set terminal features for terminal types read from terminfo(5). tmux has a whole set of named terminal features, and each one applies the appropriate changes to the terminfo(5) entry in use. ๐Ÿฆ‹

tmux can detect features for a few common terminals, and this option is how you 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 meant for classes of functionality supported in a standard way but just not reported by terminfo(5). Careful out here: only configure this with features the terminal actually supports, fr fr. ๐Ÿ™ˆ

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. A feature may be suffixed with @ to disable it; for example, xterm*:sync@. The available features are:

  • 256 โ€” Supports 256 colours with the SGR escape sequences.
  • appesc โ€” Supports application escape key mode, where the Escape key sends a sequence that cannot be mistaken for the start of another key.
  • 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.
  • progressbar โ€” Supports the OSC 9;4 progress bar extension.
  • 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.
  • utf8 โ€” Supports UTF-8 output.

๐ŸŽ€ terminal-overrides[] string

Allow terminal descriptions read using terminfo(5) to be 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. ๐Ÿ’–

So like, say you wanna 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

Set list of user-defined key escape sequences. Each item is associated with a key named User0, User1, and so on. Obsessed with this one ngl.

For example:

set -s user-keys[0] "\e[5;30012~"
bind User0 resize-pane -L 3

๐Ÿ’œ variation-selector-always-wide [on | off]

Always treat 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]

Set 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 (equivalent to monitor-activity being off), current means only activity in windows other than the current window are ignored, and other means activity in the current window is ignored but not those in other windows. ๐Ÿ‘‘


assume-paste-time milliseconds

If keys are entered faster than one in milliseconds, they are assumed to have been pasted rather than typed and tmux key bindings are not processed. The default is one millisecond and zero disables. โฑ๏ธ


base-index index

Set the base index from which an unused index should be searched when a new window is created. The default is zero.


bell-action [any | none | current | other]

Set 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

Set the command used for new windows (if not specified when the window is created) to shell-command, which may be any sh(1) command. The default is an empty string, which instructs tmux to create a login shell using the value of the default-shell option.


default-shell path

Specify the default shell. This is used as the login shell for new windows when the default-command option is set to empty, and 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

Set 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. The 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 is in a group and has other sessions in that group. If keep-group, destroy the session unless it is 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 is detached when the session it is attached to is destroyed. If off, the client is switched to the most recently active of the remaining sessions. If no-detached, the client is detached only if there are no detached sessions; if detached sessions exist, the client is switched to the most recently active. If previous or next, the client is switched to the previous or next session in alphabetical order. ๐Ÿ”ฅ


display-time time

Set the amount of time for which status line messages and other on-screen indicators are displayed. If set to 0, messages and indicators are displayed until a key is pressed. time is in milliseconds.


history-limit lines

Set the maximum number of lines held in pane history. ๐Ÿ“œ


initial-repeat-time time

Set the time in milliseconds for the initial repeat when a key is bound with the -r flag. This allows multiple commands to be entered without pressing the prefix key again. See also the repeat-time option. If initial-repeat-time is zero, repeat-time is used for the first key press.


key-table key-table

Set the default key table to key-table instead of root.


lock-after-time number

Lock the session (like the lock-session command) after number seconds of inactivity. The default is not to lock (set to 0). ๐Ÿ”’


lock-command shell-command

Command to run when locking each client. The default is to run lock(1) with -np.


menu-style style

Set the menu style. See the โ€œSTYLESโ€ section on how to specify style.


menu-selected-style style

Set the selected menu item style. See the โ€œSTYLESโ€ section on how to specify style.


menu-border-style style

Set the menu border style. See the โ€œSTYLESโ€ section on how to specify style.


menu-border-lines type

Set the type of characters used for drawing menu borders. See popup-border-lines for possible values for border-lines.


message-command-style style

Set status line message command style. This is used for the command prompt with vi(1) keys when in command mode. For how to specify style, see the โ€œSTYLESโ€ section.


message-format string

Set the format string for the prompt and message area. The special placeholder #{message} expands to the interactive prompt or message text and #{command_prompt} is set to 1 when the prompt is in command mode (vi). Style directives like fill, align, and width may be used in the format string. The default uses a conditional to select between message-style and message-command-style. โœจ


message-line [0 | 1 | 2 | 3 | 4]

Set line on which status line messages and the command prompt are shown.

  • message-style style โ€” sets the style of status line messages. This one covers messages and the command prompt, and the message gets drawn right on top of whatever status line is already there. A width attribute (either a fixed number of columns or a percentage like 50%) limits how wide the prompt area is, and an align attribute (left, centre, right) decides where it sits horizontally. If that width is smaller than the full terminal width, the normal status bar content stays visible around the prompt area, cute right? The fill attribute is what the default message-format uses to clear the background. Wanna know how to write a style? Go peek at STYLES ๐Ÿ’…
  • mouse [on | off] โ€” set it on and tmux captures the mouse, meaning mouse events can be bound as key bindings. Deets live in MOUSE SUPPORT ๐Ÿญ
  • prefix key โ€” sets the key that counts as the prefix key. On top of the standard keys listed under KEY BINDINGS, you can also set this to the special key None if you want, like, no prefix at all ๐Ÿ‘‘
  • prefix2 key โ€” sets a secondary key that also works as a prefix key. Same deal as prefix: None is allowed.
  • prefix-timeout time โ€” how many milliseconds tmux waits after you hit the prefix before it just gives up and dismisses it. Set it to zero and the timeout is fully disabled, no cap.
  • prompt-cursor-colour colour โ€” the colour of the cursor inside the command prompt.
  • prompt-command-cursor-colour colour โ€” the colour of the cursor in the command prompt specifically when vi(1) keys are enabled and the prompt is chillin' in command mode.
  • prompt-cursor-style style โ€” the style of the cursor in the command prompt. Available styles? Check the cursor-style options, bestie.
  • prompt-command-cursor-style style โ€” same thing but for when vi(1) keys are on and the prompt is in command mode. Again, see the cursor-style options for what styles exist.
  • renumber-windows [on | off] โ€” turn this on and whenever a window closes in a session, the other windows get automatically renumbered in numerical order. It respects the base-index option if you've set one. off means no renumbering, leave them alone ๐Ÿ™ˆ
  • repeat-time time โ€” lets you fire off multiple commands without smashing the prefix key again, within the given number of milliseconds (default is 500, iconic). Whether a key actually repeats is decided 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 see 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 those exist. tmux automatically sets these to the \e]0;...\007 sequence if the terminal looks like it's xterm(1). Heads up: 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, check FORMATS ๐ŸŒˆ
  • silence-action [any | none | current | other] โ€” picks the action for window silence when monitor-silence is on. The values are the exact same ones as for activity-action.
  • status [off | on | 2 | 3 | 4 | 5] โ€” show or hide the status line, or say how big it is. on gives you a status line one row tall; 2, 3, 4 or 5 give you more rows.
  • status-format[] format โ€” the format used for each line of the status line. The default builds the top status line out of all those individual status options listed below โœจ
  • status-interval interval โ€” refresh the status line every interval seconds. Default behaviour is an update every 15 seconds. Set it to zero and redrawing at an interval is disabled entirely.
  • status-justify [left | centre | right | absolute-centre] โ€” where the window list sits in the status line: left, centre or right. centre puts the window list in the relative centre of whatever free space exists; absolute-centre uses the centre of the entire horizontal space. Subtle difference, but it matters ๐Ÿ’…
  • status-keys [vi | emacs] โ€” picks vi or emacs-style key bindings for the status line, like at the command prompt. Default is emacs, unless 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. The string gets passed through strftime(3). Also go read FORMATS and STYLES. For details on setting names and titles, see NAMES AND TITLES.

Some examples, bestie:

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

And the default is [#S] .

  • status-left-length length โ€” the max length of the left component of the status line. Default is 10.
  • status-left-style style โ€” the style of the left part of the status line. For how to write a style, see STYLES.
  • status-position [top | bottom] โ€” where the status line lives.
  • status-right string โ€” the display string to the right of the status line. By default it shows the current pane title in double quotes, plus the date and the time. Just like status-left, the string gets passed to strftime(3) and character pairs get replaced.
  • status-right-length length โ€” the max length of the right component of the status line. Default is 40.
  • status-right-style style โ€” the style of the right part of the status line. Again, STYLES section for the how-to.
  • status-style style โ€” the style for the status line. You already know where to look: STYLES ๐Ÿ’–
  • update-environment[] variable โ€” the list of environment variables that get copied into the session environment whenever a new session is created or an existing one is attached. Any variables that don't exist in the source environment are marked to be removed from the session environment โ€” as if -r was passed to the set-environment command.
  • visual-activity [on | off | both] โ€” if on, tmux shows a message instead of sending a bell when activity happens in a window that has the monitor-activity window option enabled. Set it to both and you get a bell and a message. Double trouble ๐ŸŽ€
  • visual-bell [on | off | both] โ€” if on, a message pops up on a bell in a window that has the monitor-bell window option enabled, instead of it being passed through to the terminal (which is what normally makes the actual sound). both gives you the bell and the message. Also see the bell-action option.
  • visual-silence [on | off | both] โ€” if monitor-silence is enabled, this prints a message after the interval has expired on a given window, instead of firing off a bell. both means a bell and a message, obviously ๐Ÿ˜Œ
  • word-separators string โ€” sets what the session thinks counts as word separator characters, for the sake of the next and previous word commands in copy mode. A space in string matches any character with the Unicode White_Space property.

Available window options are: ๐Ÿ‘‘

  • aggressive-resize [on | off] โ€” aggressively resize the chosen window. Meaning tmux resizes the window to the size of the smallest or largest session (see the window-size option) for which it's the current window, instead of the session it's attached to. The window can resize when the current window changes on another session. This option is great for full-screen programs that support SIGWINCH, and honestly terrible for interactive stuff like shells. Pick your fighter ๐Ÿ’€
  • automatic-rename [on | off] โ€” controls automatic window renaming. With this on, tmux renames the window automatically using the format given by automatic-rename-format. This flag gets 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. You can also switch it 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's hour format.
  • display-panes-active-colour colour โ€” the colour the display-panes command uses to show the indicator for the active pane.
  • display-panes-border-style style โ€” the style of the borders in panes mode used by the display-panes command. Style how-to is in STYLES.
  • display-panes-colour colour โ€” the colour the display-panes command uses to show the indicators for the inactive panes.
  • display-panes-format format โ€” the format of the text shown by the display-panes command, expanded once for each pane.
  • display-panes-time time โ€” how many milliseconds the indicators shown by the display-panes command hang around for.
  • fill-character format โ€” the format used to fill terminal areas that a pane isn't using. It's expanded once for areas inside the window with is_inside set, and once for areas outside the window with is_outside set.
  • main-pane-height height โ€” and also
  • main-pane-width width โ€” set the width or height of the main (left or top) pane in the main-horizontal, main-horizontal-mirrored, main-vertical or main-vertical-mirrored layouts. Suffix it with % and it becomes a percentage of the window size โœจ
  • copy-mode-match-style style โ€” the style of search matches in copy mode. STYLES section, as always ๐Ÿซถ
  • copy-mode-mark-style style โ€” the style of the line containing the mark in copy mode. Yep, STYLES ๐Ÿ’œ
  • copy-mode-current-match-style style โ€” sets the glow-up for the current search match when you're in copy mode โœจ. Wanna know how to build a style? Check the โ€œSTYLESโ€ section bestie ๐Ÿ’…
  • copy-mode-position-format format โ€” the format of that lil position indicator in copy mode ๐Ÿ“
  • copy-mode-position-style style โ€” style for the position indicator in copy mode ๐ŸŽ€ (STYLES section has the deets on specifying style)
  • copy-mode-selection-style style โ€” style for your selection in copy mode ๐Ÿ’– (again, โ€œSTYLESโ€ section, you know the drill)
  • copy-mode-current-line-number-style style โ€” style for the current line number in copy mode ๐ŸŒŸ (โ€œSTYLESโ€ section!)
  • copy-mode-current-line-style style โ€” style for the line the cursor is chillin' on in copy mode ๐Ÿ‘‘ (โ€œSTYLESโ€ section)
  • copy-mode-line-number-style style โ€” style for all the line numbers in copy mode ๐Ÿ”ข (โ€œSTYLESโ€ section, mwah)
  • copy-mode-line-numbers [off | default | absolute | relative | hybrid] โ€” show line numbers in copy mode, fr fr. Let's break it down:
    • off โ€” hides them, bye ๐Ÿ‘‹
    • default โ€” shows line numbers matching the copy mode position indicator and goto-line
    • absolute โ€” shows absolute line numbers
    • relative โ€” shows line numbers relative to the cursor
    • hybrid โ€” shows the current line number as absolute, and every other line number as relative โœจ

With off or default, the position indicator and goto-line use the same numbering. With absolute, relative and hybrid, they use absolute line numbers. Noted ๐Ÿ“

  • mode-keys [vi | emacs] โ€” use vi or emacs-style key bindings in copy mode ๐ŸŽน. Default is emacs, unless VISUAL or EDITOR contains โ€˜viโ€™ (then you're a vi girlie, iykyk)
  • mode-style style โ€” sets the window modes style. โ€œSTYLESโ€ section for how, bestie ๐Ÿ’œ
  • monitor-activity [on | off] โ€” monitor for activity in the window ๐Ÿ‘€. Windows with activity get highlighted in the status line, slay
  • monitor-bell [on | off] โ€” monitor for a bell ๐Ÿ”” in the window. Windows with a bell get highlighted in the status line
  • monitor-silence [interval] โ€” monitor for silence (aka no activity) in the window within interval seconds ๐Ÿคซ. Windows that have been silent for the interval get highlighted in the status line. An interval of zero disables the monitoring, periodt
  • other-pane-height height โ€” sets the height of the other panes (not the main pane) in the main-horizontal and main-horizontal-mirrored layouts ๐Ÿ“. If this is set to 0 (the default), it has no effect, so it's giving 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 so. If suffixed by โ€˜%โ€™, this is a percentage of the window size ๐Ÿ’ฏ
  • other-pane-width width โ€” 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 โ€” sets the pane border style for the currently active pane ๐ŸŒˆ. โ€œSTYLESโ€ section for how. Heads up: attributes are ignored ๐Ÿ™ˆ
  • pane-base-index index โ€” like base-index, but for the starting index of pane numbers ๐Ÿ”ข
  • pane-border-format format โ€” sets the text shown in pane border status lines โœ๏ธ
  • pane-border-indicators [off | colour | arrows | both] โ€” indicate the active pane by colouring only half of the border (but only in windows with exactly two panes!), by displaying arrow markers, by drawing both, or by drawing neither ๐ŸŽฏ
  • pane-border-lines type โ€” sets the type of characters used for drawing 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
    • none โ€” no border for floating panes
โ€˜doubleโ€™ and โ€˜heavyโ€™ will fall back to standard ACS line drawing when UTF-8 is not supported ๐Ÿซถ
  • pane-border-status [off | top | bottom | top-floating | bottom-floating] โ€” turn pane border status lines off, or set their position ๐Ÿ“Œ. If set to top-floating or bottom-floating, status lines are shown only on floating panes ๐Ÿช„
  • pane-border-style style โ€” sets the pane border style for panes aside from the active one โœจ. โ€œSTYLESโ€ section for how. Attributes? Ignored, bestie ๐Ÿ™ˆ
  • popup-style style โ€” sets the popup style ๐ŸŽ€. See the โ€œSTYLESโ€ section on how to specify style. Attributes are ignored
  • popup-border-style style โ€” sets the popup border style ๐Ÿ’…. See the โ€œSTYLESโ€ section on how to specify style. Attributes are ignored
  • popup-border-lines type โ€” sets the type of characters used for drawing popup borders. type can be one of:
    • single โ€” single lines using ACS or UTF-8 characters (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
โ€˜doubleโ€™ and โ€˜heavyโ€™ will fall back to standard ACS line drawing when UTF-8 is not supported ๐ŸŒธ
  • pane-scrollbars [off | modal | on | auto-hide] โ€” when enabled, a character based scrollbar appears on the left or right of each pane ๐Ÿ“œ. A filled section of the scrollbar, known as the โ€˜sliderโ€™, represents the position and size of the visible part of the pane content ๐Ÿ‘€

If set to on the scrollbar is visible all the time and the pane is narrowed by the width of the scrollbar. If set to modal the scrollbar only appears when the pane is in copy mode or view mode, and auto-hides when not in use. If set to auto-hide the scrollbar is available all the time but auto-hides when not in use. With modal and auto-hide, the scrollbar overlays the pane and does not narrow or reflow it, iconic โœจ

See also pane-scrollbars-style.

  • pane-scrollbars-position [left | right] โ€” sets which side of the pane to display pane scrollbars on โฌ…๏ธโžก๏ธ
  • pane-scrollbars-style style โ€” sets the scrollbars style ๐ŸŽจ. โ€œSTYLESโ€ section for how. The foreground colour is used for the slider, the background for the rest of the scrollbar. The width attribute sets the width of the scrollbar, and the pad attribute sets the padding between the scrollbar and the pane. Other attributes are ignored ๐Ÿ™ˆ
  • pane-scrollbars-timeout time โ€” sets the time in milliseconds before scrollbars are hidden when pane-scrollbars is modal or auto-hide โฑ๏ธ
  • pane-status-current-style style โ€” sets the status line style for the currently active pane ๐Ÿ‘‘. โ€œSTYLESโ€ section for how
  • pane-status-style style โ€” sets the status line style for a single pane ๐ŸŒŸ. โ€œSTYLESโ€ section for how
  • session-status-current-style style โ€” sets the status line style for the currently active session ๐Ÿ’–. โ€œSTYLESโ€ section for how
  • session-status-style style โ€” sets the status line style for a single session ๐Ÿฆ‹. โ€œSTYLESโ€ section for how
  • tiled-layout-max-columns number โ€” sets the maximum number of columns in the tiled layout ๐Ÿงฑ. A value of 0 (the default) means no limit. When a limit is set, panes are arranged to not exceed this number of columns, with additional panes stacked in extra rows ๐Ÿฅž
  • tree-mode-border-style style โ€” sets the style of borders in tree mode ๐ŸŒณ. โ€œSTYLESโ€ section for how
  • tree-mode-preview-format format โ€” the format of the preview indicator in tree mode ๐Ÿ‘๏ธ
  • tree-mode-preview-style style โ€” sets the style of the preview indicator in tree mode โœจ. โ€œSTYLESโ€ section for how
  • tree-mode-selection-style style โ€” sets the style of the selected line in tree mode ๐ŸŽ€. โ€œSTYLESโ€ section for how
  • window-status-activity-style style โ€” sets the status line style for windows with an activity alert ๐Ÿšจ. โ€œSTYLESโ€ section for how
  • window-status-bell-style style โ€” sets the status line style for windows with a bell alert ๐Ÿ””. โ€œSTYLESโ€ section for how
  • window-status-current-format string โ€” like window-status-format, but this is the format used when the window is the current window ๐Ÿ’…
  • window-status-current-style style โ€” sets the status line style for the currently active window ๐Ÿ‘‘. โ€œSTYLESโ€ section for how
  • window-status-format string โ€” sets the format in which the window is displayed in the status line window list ๐ŸชŸ. See the โ€œFORMATSโ€ and โ€œSTYLESโ€ sections
  • window-status-last-style style โ€” sets the status line style for the last active window โฎ๏ธ. โ€œSTYLESโ€ section for how
  • window-status-separator string โ€” sets the separator drawn between windows in the status line โž–. The default is a single space character
  • window-status-style style โ€” sets the status line style for a single window ๐ŸŒˆ. โ€œSTYLESโ€ section for how
  • window-size largest | smallest | manual | latest โ€” configure how tmux determines the window size ๐Ÿ“:
    • largest โ€” the size of the largest attached session is used
    • smallest โ€” the size of the smallest
    • manual โ€” the size of a new window is set from the default-size option, and windows are resized automatically
    • latest โ€” tmux uses the size of the client that had the most recent activity

See also the resize-window command and the aggressive-resize option ๐Ÿ‘€

  • wrap-search [on | off] โ€” if this option is set, searches will wrap around the end of the pane contents ๐Ÿ”„. The default is on

Available pane options are: ๐Ÿซถ

  • allow-passthrough [on | off | all] โ€” bestie, this one lets programs running inside a pane straight-up bypass tmux using a terminal escape sequence (\ePtmux;...\e\\). Set it to on and those passthrough sequences are only allowed if the pane is actually visible ๐Ÿ‘€. Set it to all and they get let through even when the pane is invisible. Lowkey powerful, highkey chaotic ๐Ÿ’…
  • allow-rename [on | off] โ€” gives programs in the pane permission to rename the window using a terminal escape sequence (\ek...\e\\). Window names, but make it โœจcollaborativeโœจ.
  • allow-set-title [on | off] โ€” lets programs in the pane change the title via terminal escape sequences (\e]2;...\e\\ or \e]0;...\e\\). That's it, that's the whole vibe ๐ŸŽ€
  • alternate-screen [on | off] โ€” controls whether programs inside the pane get to use the terminal's alternate screen feature, aka the smcup and rmcup terminfo(5) capabilities ๐Ÿ’–. Why do you care? Because the alternate screen feature preserves the contents of the window when an interactive app starts and restores it when it exits โ€” so everything you could see before the app launched reappears completely unchanged once it's gone. It's giving "no notes, we saved your screen" ๐ŸŒธ
  • cursor-colour colour โ€” sets the colour of the cursor. Your cursor, your aesthetic, periodt ๐Ÿ‘‘
  • cursor-style style โ€” sets the style of the cursor. The available styles are: default, blinking-block, block, blinking-underline, underline, blinking-bar, bar. Pick your fighter, she's serving cursor ๐Ÿ’…
  • pane-colours[] colour โ€” the default colour palette. Every single entry in this array defines which colour tmux actually uses when the colour with that index gets requested. The index can run anywhere from zero to 255. So if a program asks for colour number 42, pane-colours[42] is what it's gonna get ๐ŸŒˆ
  • remain-on-exit [on | off | failed | key | failed-key] โ€” a pane with this flag set does not get destroyed when the program running in it exits. Immortal pane behavior ๐Ÿ’€. Break it down:
    • failed โ€” only keeps it around when the program's exit status is not zero.
    • key โ€” the pane stays open and then closes when a key is pressed.
    • failed-key โ€” the pane stays open and closes when a key is pressed, but only if the program's exit status is not zero.

And whenever a pane's just chillin' there like this, you can bring it back to life with the respawn-pane command ๐Ÿฆ‹

  • remain-on-exit-format string โ€” sets the text shown at the bottom of exited panes when remain-on-exit is enabled. That little goodbye note ๐Ÿฅบ
  • scroll-on-clear [on | off] โ€” when the entire screen gets cleared and this option is on, tmux scrolls the contents of the screen into history before wiping it. So nothing is ever really lost, it just moved to a better neighborhood โœจ
  • switch-mode-match-style style โ€” sets the style of the characters matched by the filter in switch-mode. Wanna know how to specify a style? Go look at the โ€œSTYLESโ€ section, go go go ๐Ÿƒโ€โ™€๏ธ
  • synchronize-panes [on | off] โ€” duplicates your input to all the other panes in the same window where this option is also on. Only for panes that aren't in any mode, bestie. Type once, echo everywhere ๐Ÿ”ฅ
  • window-active-style style โ€” sets the pane style for when it is the active pane. Same deal for specifying it: check the โ€œSTYLESโ€ section ๐Ÿ’œ
  • window-style style โ€” sets the pane style. And yes, โ€œSTYLESโ€ section, always the โ€œSTYLESโ€ section ๐ŸŽ€
  • window-pane-status-format string โ€” sets the format that the window pane is displayed in, inside the status line window pane list. See the โ€œFORMATSโ€ and โ€œSTYLESโ€ sections ๐Ÿ‘‘
  • window-pane-current-status-format string โ€” like window-status-format, but this is the format used when the window is the current window. The main character gets her own outfit ๐Ÿ’…

๐Ÿช HOOKS ๐Ÿช

Okay so tmux lets commands run on all sorts of triggers, and those triggers are called hooks. Most tmux commands have an after hook, and on top of that there's a whole bunch of hooks that aren't attached to any command at all ๐ŸŒŸ

Hooks live as array options โ€” the members of that array get executed in order when the hook fires. And just like options, different hooks can be global or belong to a session, a window, or a pane. You configure them with the set-hook or set-option commands, and you display them with show-hooks or show-options -H. These next two commands? Literally the same, no cap:

set-hook -g pane-mode-changed[style] 'display-message changed'
set-option -g pane-mode-changed[style] 'display-message changed'

Heads up: setting a hook without specifying an array key clears the hook and sets the first member of the array ๐Ÿซถ

A command's after hook runs after that command completes โ€” except when the command is itself being run as part of a hook. Those after hooks are named with an after- prefix. For example, this one adds a hook that selects the even-vertical layout after every split-window:

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

And if a command fails? The command-error hook fires ๐Ÿ’€. For example, this could be used to write to a log file:

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

The hooks โœจ

In addition to the after hooks, these are the 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-closed โ€” runs when a client is closed.
  • client-created โ€” runs when a client is created.
  • 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.
  • marked-pane-changed โ€” runs when the marked pane is set or cleared.
  • pane-activity โ€” runs when there is new output in a pane.
  • pane-bell โ€” runs when a pane receives a bell.
  • pane-command-finished โ€” runs when an OSC 133 command finishes in a pane.
  • pane-command-started โ€” runs when an OSC 133 command starts in a pane.
  • pane-created โ€” runs when a pane is created or respawned.
  • pane-died โ€” runs when the program running in a pane exits, but remain-on-exit is on so the pane has not closed ๐Ÿ˜ญ
  • 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-mode-changed โ€” runs when a pane changes mode.
  • pane-mode-entered โ€” runs when a pane enters a mode.
  • pane-mode-exited โ€” runs when a pane exits a mode.
  • pane-moved โ€” runs when a pane is moved to another window.
  • pane-prompt-closed โ€” runs when a prompt in a pane is closed.
  • pane-prompt-opened โ€” runs when a prompt is opened in a pane.
  • pane-resized โ€” runs when a pane is resized.
  • pane-set-clipboard โ€” runs when the terminal clipboard is set using the xterm(1) escape sequence ๐Ÿ“‹
  • pane-shell-prompt โ€” runs when an OSC 133 shell prompt starts in a pane.
  • pane-title-changed โ€” runs when a pane title is changed.
  • session-closed โ€” runs when a session is closed.
  • session-created โ€” runs when a new session is created.
  • session-added-to-group โ€” runs when a session is added to a session group.
  • session-removed-from-group โ€” runs when a session is removed from a session group.
  • session-renamed โ€” runs when a session is renamed.
  • session-window-changed โ€” runs when a session changes its active window.
  • window-closed โ€” runs when a window is closed.
  • window-created โ€” runs when a window is created.
  • window-layout-changed โ€” runs when a window layout is changed.
  • window-linked โ€” runs when a window is linked into a session.
  • window-pane-changed โ€” runs when a window changes its active pane.
  • window-renamed โ€” runs when a window is renamed.
  • window-resized โ€” runs when a window is resized. This may happen after the client-resized hook runs.
  • window-unzoomed โ€” runs when a window is unzoomed.
  • window-zoomed โ€” runs when a window is zoomed.
  • window-unlinked โ€” runs when a window is unlinked from a session.

Managing hooks ๐Ÿ› ๏ธ

Hooks are managed with these commands:

set-hook

set-hook [-agpERTuw] [-B name:what:format] [-t target-pane] hook-name
        [command]

Without -E or -R, this sets (or, with -u, unsets) the hook hook-name to command. And btw, the flags are the exact same as for set-option ๐Ÿ‘ฏ

With -B, the name:what:format thing uses the same subscription syntax as refresh-client -B:

  • name is the hook to run,
  • what selects the session, pane, all panes, window, or all windows,
  • and format is expanded once a second.

With -T, the hook is run only when format is true. For monitor hooks, name must begin with @. If a command is given, it gets stored as the @ hook command; otherwise only the monitor is created or replaced. Important note bestie: monitor hooks are not inherited โ€” the hook only runs from the scope where it was created. And with -u, the subscription named by -B is removed ๐Ÿซก

With -E, you fire the user event named hook-name, and hook-name must begin with @.

With -R, you run hook-name immediately. Boom, right now, no waiting ๐Ÿ’ฅ

show-hooks

show-hooks [-Bgpw] [-F format] [-t target-pane] [hook]

Shows hooks โœจ. The flags are the same as for show-options.

With -B, it shows the subscriptions installed with set-hook -B. With -F, format is used for each hook ๐ŸŽ€

๐Ÿญ MOUSE SUPPORT ๐Ÿญ

okay bestie, if the mouse option is on, tmux lets you bind mouse events as keys. iconic. every key name is a mouse event (like MouseUp1) plus a location suffix. the suffixes are:

  • 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
  • Empty โ€” empty space in the window
  • ControlN โ€” on control range N

(peep the STYLES section for the tea on control ranges ๐Ÿ’…)

and here's the whole mouse event menu, no cap:

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

so the SecondClick events fire on the second click of a double click โ€” even if there might be a third click coming that fires TripleClick instead of DoubleClick. messy? a little. that's the rules tho.

each one gets a location suffix tacked on, like MouseDown1Status. don't forget the suffix, she's important ๐ŸŽ€

there's also the special token {mouse} or = that you can use as the 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 โ€” like the window in the status line where button 1 got released for a MouseUp1Status binding, or the pane the wheel was scrolled over for a WheelDownPane binding. literally knows where you're pointing ๐Ÿซถ

the send-keys -M flag can forward a mouse event to a pane.

and the default key bindings let the mouse select and resize panes, copy text, and switch windows using the status line. all of these kick in if the mouse option is turned on. turn it on bestie, it's the moment โœจ


๐ŸŒˆ FORMATS ๐Ÿ’–

some commands take the -F flag with a format argument. it's a string that controls the output format of the command. format variables go inside #{ and }, like #{session_name}. the possible variables are listed in the table below (iykyk, we're getting there), or you can use 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. also: ## becomes a single #, #, becomes a ,, and #} becomes a }.

Conditionals happen when you prefix with ?. for each pair of two arguments: if the variable in the first of the pair exists and isn't zero, the second of the pair gets chosen, otherwise it keeps going. if none of the paired conditions match, the default value is chosen. if there's an unpaired final argument, that's the default. if not, the default is the empty string. for example:

  • #{?session_attached,attached,not attached} includes attached if the session is attached, and not attached if it's unattached
  • #{?automatic-rename,yes,no} includes yes if automatic-rename is enabled, no if not
  • #{?#{n:window_name},#{window_name} - } includes the window name with a dash separator if there's a window name, or the empty string if the window name is empty
  • #{?session_format,format1,window_format,format2,format3} includes 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 inside a conditional, , and } must be escaped as #, and #}, unless they're part of a #{...} replacement. for example:

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

String comparisons? yes ma'am. prefix two comma-separated alternatives with ==, !=, <, >, <= or >= and a colon. so #{==:#{host},myhost} gets replaced by 1 if you're running on myhost, otherwise 0. || and && evaluate to true if any or all of the comma-separated alternatives are true, like #{||:#{pane_in_mode},#{alternate_on}}. ! evaluates to true if the value is false and vice versa, like #{!:#{pane_in_mode}}. and !! converts a value to a canonical boolean form โ€” 1 for true, 0 for false โ€” so #{!!:non-empty string} evaluates to 1. slay.

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

  • r โ€” the pattern is a regular expression instead of the default glob(7) pattern
  • i โ€” ignore case
  • z โ€” do a fuzzy match
  • p โ€” like z but returns a list of matched positions

a fuzzy match matches plain terms as sequences where each character must appear in order but not necessarily consecutively. terms beginning with ' are exact substring matches, ^ anchors a term at the start, $ anchors it at the end, ! inverts a term, and | separates alternative groups. examples bestie:

#{m:*foo*,#{host}}
#{m/ri:^A,MYVAR}
#{m/z:dev bash,dev:1 bash}
#{m/z:^dev | ^prod,prod:1 ssh}

A C searches pane content for a glob(7) pattern or regular expression, 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. so: #{C/r:^Start} ๐ŸŒธ

Numeric operators! prefix two comma-separated alternatives with an e and an operator. an optional f flag after the operator means use floating point numbers, otherwise integers. then you can follow it with a number giving the decimal places for the result. the operators are:

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

so #{e|*|f|4:5.5,3} multiplies 5.5 by 3 and gives a result with four decimal places, and #{e|%%:7,3} returns the modulus of 7 and 3. a replaces a numeric argument with its ASCII equivalent, so #{a:98} results in b. c replaces a tmux colour with its six-digit hexadecimal RGB value โ€” and if you give it an argument of f or b, it instead produces the SGR escape sequence to set the foreground or background colour respectively. cute AND useful ๐ŸŽ€

You can cap the length of the resulting string by prefixing it with an =, a number and a colon. positive numbers count from the start of the string, negative from the end. so #{=5:pane_title} includes at most the first five characters of the pane title, and #{=-5:pane_title} the last five. a suffix or prefix can be given as a second argument โ€” if provided, it gets appended or prepended to the string when the length has been trimmed. for example #{=/5/...:pane_title} appends ... if the pane title is more than five characters. similarly, p pads the string to a given width, so #{p10:pane_title} results in a width of at least 10 characters. a positive width pads on the left, a negative on the right. n expands to the length of the variable and w to its width when displayed, like #{n:window_name}. and R repeats the first argument a number of times given by the second, so #{R:a,3} gives you aaa. periodt.

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. add p (t/p) and you get a shorter but less accurate time format for times in the past. r (t/r) gives the time relative to the current time, like 1m or 2m23s. d (t/d) gives the difference from the time to the current time in seconds (future times are negative). and you can give a custom format with 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).

The I: prefix interrogates the client. I/f is true if tmux believes the client supports the given terminal feature, like I/f:RGB. I/c is true if a client has the given terminfo(3) capability, like I/c:smcup. and I/e gives the value of a client environment variable, like #{I/e:FOO}. nosy in the best way ๐Ÿ‘‘

The b: and d: prefixes are basename(3) and dirname(3) of the variable respectively. q: escapes sh(1) special characters โ€” with an h suffix it escapes hash characters (so # becomes ##), with a it escapes tmux command arguments, and with s it uses single quotes.

โš ๏ธ real talk: some variables like pane_title and pane_path are set by escape sequences received from the pane and may contain arbitrary content, including shell metacharacters. so use q: to escape these with commands passed to run-shell, if-shell, or pipe-pane. do not skip this bestie, it's giving security ๐Ÿ’€

E: expands the format twice โ€” so #{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: 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 โ€” plus /r to sort in reverse order. /r also works with P: to reverse the sort order; panes are sorted by creation order by default. P: can additionally take /i to sort by pane index or /z to sort by z-index. so S/nr: sorts sessions by name in reverse order. for each of these, two comma-separated formats may be given, and the second one 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} }

okay so inside the W: loop, bestie, there's a little bonus: user options (@name) from the windows next door are available with a next_ or prev_ prefix. So if the next window has a user option like @color, you get to call it next_@color. cute, right? ๐Ÿ’…

Then O: loops over every single option โ€” and if an option is an array, it loops once for each array item, so you get every last crumb. ๐Ÿ“ O: can also be handed a flag to pick which options table you're rummaging through:

  • s โ€” the session table
  • w โ€” the window table
  • p โ€” the pane table
  • v โ€” the server table

g chooses global options. And the default? That's s. periodt.

V: loops over each environment variable. Its flags go like this:

  • s โ€” session environment
  • g โ€” global environment
  • c โ€” client environment

Then N: โ€” it checks whether a window name exists (with no suffix at all, or with the w suffix) or whether a session name exists (that's the s suffix). So for example N/w:foo gets replaced with 1 if there's a window named foo hanging around. ๐Ÿฆ‹


A prefix that looks like s/foo/bar/: swaps foo for bar all the way through. And the first argument can be an extended regular expression, plus a final argument of i makes it ignore case โ€” like s/a(.)/\1x/i: would turn abABab into bxBxbx. ๐Ÿคฏ You can also use a totally different delimiter character so you don't trip over literal slashes sitting in your pattern. Like s|foo/|bar/|: will substitute foo/ with bar/ throughout. no cap.

Multiple modifiers? Separate them with a semicolon (;), as in #{T;=10:status-left}, which caps the resulting strftime(3)-expanded string at at most 10 characters. ๐ŸŽ€


And there's more, because of course there is: the last line of a shell command's output can be dropped in using #(). So #(uptime) inserts the system's uptime. ๐Ÿ’–

Heads up though โ€” when it's building formats, tmux does not wait around for #() commands to finish. It just uses the previous result from running that same command, or a placeholder if the command has never been run before. If the command hasn't exited, the most recent line of output gets used โ€” but the status line will not be updated more than once a second.

Commands get run using /bin/sh, with the tmux global environment set (peep the GLOBAL AND SESSION ENVIRONMENT section for that one).

An l says: interpret this string literally, do not expand it. Like #{l:#{?pane_in_mode,yes,no}} just becomes #{?pane_in_mode,yes,no}. untouched, protected, iconic. โœจ


The A modifier shows one frame out of a list, taking turns: #{A/count:frame,frame,...} or #{A:frame,frame,...}. Each frame gets shown for count periods of 100 milliseconds before it hands over to the next one, and after the last it wraps right back to the first. If you don't give a count, one is used. ๐ŸŒ€

Lowkey important: the A modifier is only expanded in the status line and pane-border-format. And if it's present, the status line or the pane borders get redrawn every 100 milliseconds. So like, #{A/2:|,/,-,\} shows those four frames in turn, changing every 200 milliseconds. slay. ๐ŸŒˆ

The following variables are available, where appropriate:

okay bestie the format variable table is a WHOLE saga and we're still in it, no thoughts just vibes โ€” here's the rest ๐Ÿ’–

  • active_window_index โ€” index of the active window in the session ๐Ÿซถ
  • alternate_on โ€” 1 when the pane is living in the alternate screen โœจ
  • alternate_saved_x โ€” the saved cursor X over in the alternate screen
  • alternate_saved_y โ€” the saved cursor Y over in the alternate screen
  • bracket_paste_flag โ€” the pane's bracketed paste flag
  • buffer_created โ€” when the buffer got created โฐ
  • buffer_full โ€” the whole entire buffer content
  • 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 last time the client had any activity
  • client_cell_height โ€” height of each client cell, in pixels
  • client_cell_width โ€” width of each client cell, in pixels
  • client_colours โ€” how many colours the client supports ๐ŸŒˆ
  • client_control_mode โ€” 1 if the client is in control mode
  • client_created โ€” when the client was created
  • client_discarded โ€” bytes discarded when the client fell behind ๐Ÿ˜ญ
  • client_flags โ€” 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 it's available
  • client_tty โ€” 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 when you're listing commands
  • command_list_name โ€” command name when you're listing commands
  • command_list_usage โ€” command usage when you're listing commands
  • config_files โ€” list of configuration files that got loaded ๐Ÿ“‚
  • cursor_blinking โ€” 1 if the cursor is blinking
  • copy_cursor_hyperlink โ€” the hyperlink under the cursor in copy mode
  • copy_cursor_line โ€” the line the cursor is chillin' 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
  • copy_line_numbers โ€” 1 if line numbers are showing in copy mode ๐Ÿ”ข
  • copy_position โ€” the position shown in the copy mode indicator
  • copy_position_limit โ€” the limit shown in the copy mode indicator
  • current_file โ€” the current configuration file
  • cursor_character โ€” the character sitting at the cursor in the pane
  • cursor_colour โ€” cursor colour in the pane ๐ŸŽจ
  • cursor_flag โ€” pane cursor flag
  • cursor_shape โ€” 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_added โ€” number of lines scrolled into the pane history
  • history_bytes โ€” number of bytes in the window history
  • history_collected โ€” number of oldest pane history lines discarded at the history limit
  • history_generation โ€” a generation that gets incremented when the pane history is cleared or reflowed
  • history_limit โ€” maximum window history lines
  • history_size โ€” size of history, in lines
  • hook โ€” name of the running hook, if any ๐Ÿช
  • hook_client โ€” name of the client where the hook ran, if any
  • hook_fire_count โ€” how many times the hook has fired
  • hook_fire_time โ€” the last time the hook fired
  • hook_last โ€” the previous value for a monitor hook
  • hook_monitor_format โ€” format for a monitor hook
  • hook_monitor_target โ€” target for a monitor hook
  • hook_pane โ€” ID of the pane where the hook ran, if any
  • hook_session โ€” ID of the session where the hook ran, if any
  • hook_session_name โ€” name of the session where the hook ran, if any
  • hook_value โ€” the new value for a monitor hook
  • hook_window โ€” ID of the window where the hook ran, if any
  • hook_window_index โ€” index of the window where the hook ran, if any
  • hook_window_name โ€” name of the window where the hook ran, if any
  • host, #H โ€” hostname of the local host ๐Ÿ 
  • host_short, #h โ€” hostname of the local host, minus the domain name
  • insert_flag โ€” pane insert flag
  • key_string โ€” string representation of the key binding
  • key_repeat โ€” 1 if the key binding is repeatable ๐Ÿ”
  • key_note โ€” note of the key binding
  • key_prefix โ€” global key prefix
  • key_table โ€” table name of the key binding
  • key_command โ€” command of the key binding
  • key_has_repeat โ€” 1 if the list contains a repeatable key
  • key_string_width โ€” maximum key_string width in the list
  • key_table_width โ€” maximum key_table width in the list
  • keypad_cursor_flag โ€” pane keypad cursor flag
  • keypad_flag โ€” pane keypad flag
  • last_window_index โ€” index of the last window in the session
  • line โ€” line number in the list
  • loop_index โ€” index of the item in the W:, P:, S:, or L: loop ๐Ÿ”„
  • loop_last_flag โ€” 1 if it's 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 โ€” hyperlink under the mouse, if any
  • mouse_line โ€” line under the mouse, if any
  • mouse_sgr_flag โ€” pane mouse SGR flag
  • mouse_standard_flag โ€” pane mouse standard flag
  • mouse_status_line โ€” the status line the mouse event went down on
  • mouse_status_range โ€” range type or argument of the mouse event on the status line
  • mouse_utf8_flag โ€” pane mouse UTF-8 flag
  • mouse_word โ€” word under the mouse, if any
  • mouse_x โ€” mouse X position, if any
  • mouse_y โ€” mouse Y position, if any
  • next_session_id โ€” unique session ID for the next new session ๐Ÿ†”
  • next_window_active โ€” 1 if the next window in the W: loop is active
  • next_window_index โ€” index of the next window in the W: loop
  • option_array_key โ€” array key, if the option is an array item
  • option_has_array_key โ€” 1 if the option array key is present
  • option_has_value โ€” 1 if the option value is present
  • option_is_array โ€” 1 if the option is an array
  • option_is_hook โ€” 1 if the option is a hook
  • option_is_parent โ€” 1 if the option is inherited
  • option_is_string โ€” 1 if the option is a string
  • option_is_user โ€” 1 if the option is a user option
  • option_name โ€” name of the option
  • option_value โ€” value of the option
  • option_value_only โ€” 1 if only option values are gonna be shown
  • origin_flag โ€” pane origin flag
  • pane_active โ€” 1 if it's the active pane โญ
  • pane_at_bottom โ€” 1 if the pane is 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 โ€” bottom of the pane
  • pane_command_duration โ€” current or most recent OSC 133 command duration, in seconds
  • pane_command_end_time โ€” time the most recent OSC 133 command ended
  • pane_command_running โ€” 1 if an OSC 133 command is running
  • pane_command_start_time โ€” time the current or most recent OSC 133 command started
  • pane_command_status โ€” exit status from the most recent OSC 133 command
  • 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 โ€” exit signal of the process in a dead pane
  • pane_dead_status โ€” exit status of the process in a dead pane
  • pane_dead_time โ€” exit time of the process in a dead pane
  • pane_fg โ€” pane foreground colour
  • pane_flags โ€” pane flags
  • pane_floating_flag โ€” 1 if the pane is floating ๐ŸŽˆ
  • pane_format โ€” 1 if the format is for a pane
  • pane_height โ€” height of the pane
  • pane_id, #D โ€” unique pane ID
  • pane_in_mode โ€” number of modes the pane is in
  • pane_index, #P โ€” index of the pane
  • pane_input_off โ€” 1 if input to the pane is disabled ๐Ÿ”‡
  • pane_key_mode โ€” extended key reporting mode in this pane
  • pane_last โ€” 1 if it's the last pane
  • pane_last_output_time โ€” the last time the pane produced output
  • pane_last_prompt_time โ€” time the most recent OSC 133 prompt began
  • pane_left โ€” left of the pane
  • pane_marked โ€” 1 if this is the marked pane
  • pane_marked_set โ€” 1 if a marked pane is set
  • pane_modal_flag โ€” 1 if the pane is modal
  • pane_mode โ€” name of the pane mode, if any
  • pane_output_generation โ€” a generation that gets incremented when pane output is processed
  • pane_path โ€” path of the pane (the application can set this one ๐Ÿ‘€)
  • pane_pid โ€” PID of the first process in the pane
  • pane_pipe โ€” 1 if the pane is being piped ๐Ÿšฐ

okay bestie we're still deep in the variable list and it is long long, but you're doing amazing, keep scrolling ๐Ÿ’–

  • pane_pipe_pid โ€” the PID of the pipe process, if there is one
  • pane_private_modes โ€” list of the DECSET private modes that are enabled
  • pane_pb_state โ€” the pane's progress bar state ๐Ÿฆ‹ one of hidden, normal, error, indeterminate or paused (an application can set this one)
  • pane_pb_progress โ€” the pane's progress bar progress percentage (yep, an application can set this too)
  • pane_right โ€” right edge of the pane
  • pane_search_string โ€” the last search string you typed in copy mode
  • pane_start_command โ€” the command the pane was started with
  • pane_start_command_list โ€” the command the pane was started with, but quoted
  • 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, aka #T โ€” the title of the pane (an application can set this)
  • pane_top โ€” top of the pane
  • pane_tty โ€” the pane's pseudo terminal
  • pane_unseen_changes โ€” 1 if there were changes in the pane while you were in a mode
  • pane_unzoomed_height โ€” height of the pane when it is not zoomed
  • pane_unzoomed_width โ€” width of the pane when it is not zoomed
  • pane_width โ€” width of the pane
  • pane_x โ€” X position of the pane
  • pane_y โ€” Y position of the pane
  • pane_z โ€” Z position of the pane
  • pane_zoomed_flag โ€” 1 if the pane is zoomed
  • pid โ€” server PID
  • prev_window_active โ€” 1 if the previous window in the W: loop is active
  • prev_window_index โ€” index of the previous window in the W: loop
  • rectangle_toggle โ€” 1 if rectangle selection is activated
  • refresh_active โ€” 1 if copy mode refresh is active
  • scroll_position โ€” your scroll position in copy mode
  • scroll_region_lower โ€” bottom of the scroll region in the pane
  • scroll_region_upper โ€” top of the scroll region in the pane
  • search_count โ€” 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 was started in copy mode
  • selection_active โ€” 1 if a selection started and it changes along with the cursor in copy mode
  • selection_end_x โ€” X position of the end of the selection
  • selection_end_y โ€” Y position of the end of the selection
  • selection_mode โ€” the selection mode
  • selection_present โ€” 1 if a selection was started in copy mode
  • selection_start_x โ€” X position of the start of the selection
  • selection_start_y โ€” Y position of the start of the selection
  • server_sessions โ€” number of sessions
  • session_active โ€” 1 if the session is active
  • session_activity โ€” time of the session's last activity
  • session_activity_flag โ€” 1 if any window in the session has activity
  • session_alerts โ€” list of window indexes with alerts
  • session_attached โ€” number of clients the session is attached to
  • session_attached_list โ€” list of clients the session is attached to
  • session_bell_flag โ€” 1 if any window in the session has a bell
  • session_created โ€” 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 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 โ€” unique session ID
  • session_last_attached โ€” 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, aka #S โ€” name of the session
  • session_path โ€” 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 โ€” server socket path
  • sixel_support โ€” 1 if the server has support for SIXEL
  • start_time โ€” server start time
  • synchronized_output_flag โ€” 1 if the pane has synchronized output enabled
  • uid โ€” server UID
  • user โ€” server user
  • 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 the window's last activity
  • window_activity_flag โ€” 1 if the window has activity
  • window_bell_flag โ€” 1 if the window has a bell
  • window_bigger โ€” 1 if the window is larger than the client (it's giving main character window ngl)
  • 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, aka #F โ€” window flags, with # escaped as ##
  • window_format โ€” 1 if the format is for a window
  • window_height โ€” height of the window
  • window_id โ€” unique window ID
  • window_index, aka #I โ€” index of the 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_manual_height โ€” manual height of the window, if it's set
  • window_manual_width โ€” manual width of the window, if it's set
  • window_marked_flag โ€” 1 if the window contains the marked pane
  • window_modal_pane โ€” the modal pane in the window, if there is one
  • window_name, aka #W โ€” name of the window
  • window_offset_x โ€” X offset into the window if it is larger than the client
  • window_offset_y โ€” Y offset into the window if it is larger than the client
  • window_panes โ€” number of panes in the window
  • window_raw_flags โ€” window flags with nothing escaped
  • window_silence_flag โ€” 1 if the window has a silence alert
  • window_stack_index โ€” index in the session's 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 โ€” width of the window
  • window_zoomed_flag โ€” 1 if the window is zoomed
  • wrap_flag โ€” pane wrap flag ๐ŸŽ€

and that's not even the end bestie, keep going ๐Ÿ’œ

โœจ STYLES โœจ

okay bestie, so tmux has a whole bunch of options for telling it what the interface should look like โ€” the colours, the attributes, all of it ๐Ÿ’… Like status-style for your status line, that's the classic one.

plus โ€” and this is the fun part โ€” you can also drop styles inline into format options (think status-left) by wrapping them in #[ and ]. cute, right? ๐ŸŽ€

A style can just be the single term default, which means "use the default style please" (and that default might come from an option, like status-style in the status line). Or it can be a list of the following, separated by spaces or commas:

  • fg=colour โ€” sets the foreground colour. The colour is one of: black, red, green, yellow, blue, magenta, cyan, white; if your terminal supports it 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 like #ffffff โœจ
  • bg=colour โ€” sets the background colour.
  • us=colour โ€” sets the underscore colour.
  • none โ€” sets no attributes at all (turns off anything currently active).
  • acs, bright (or bold), dim, underscore, blink, reverse, hidden, italics, overline, strikethrough, double-underscore, curly-underscore, dotted-underscore, dashed-underscore โ€” sets an attribute. Any of these can be prefixed with no to unset it. (acs is the terminal alternate character set, iykyk.)
  • align=left (or noalign), align=centre, align=right โ€” aligns text to the left, centre or right of the available space, if appropriate.
  • fill=colour โ€” fills the available space with a background colour if appropriate.
  • dim=percentage โ€” dims the foreground and background colours by a percentage.
  • width=N โ€” sets the width of the styled area. N can be a column count or a percentage (for example 50%).
  • link=uri (or nolink) โ€” makes the styled text an OSC 8 hyperlink to uri, for example #[link=https://example.com]text#[nolink]. This only gets emitted to terminals that have the hyperlinks feature (see terminal-features); it works in the status line and in other formats drawn with styles. The link keeps going until nolink, default, or an empty link= shows up. Also, the uri can't contain spaces or commas and it's length-limited, so no novel-length URLs bestie ๐Ÿ˜ญ
  • list=on, list=focus, list=left-marker, list=right-marker, nolist โ€” marks the position of the various window list components in the status-format option: list=on marks the start of the list; list=focus is the part of the list that should be kept in focus if the whole list won't fit in the available space (usually the current window); list=left-marker and list=right-marker mark the text used to show that stuff got trimmed off the left or right of the list when there isn't enough room.
  • noattr โ€” do NOT copy attributes from the default style.
  • push-default, pop-default โ€” stores the current colours and attributes as the default, or resets to the previous default. A push-default affects every later use of the default term until a pop-default. Heads up though: only one default can be pushed (each push-default just replaces whatever default was saved before) ๐Ÿ™ˆ
  • range=left, range=right, range=session|X, range=window|X, range=pane|X, range=user|X, range=control|N, norange โ€” marks a range for mouse events in the status-format option. When a mouse event lands in the range=left or range=right range, the StatusLeft and StatusRight key bindings get 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 long, so keep it short bb.

range=control|N is a set of ranges for you to define custom behaviour with. N can be 0 through 9. When a mouse event occurs in the range=control|N range, the ControlN key binding is triggered. See โ€œMOUSE SUPPORTโ€ for the deets.

  • set-default โ€” sets the current colours and attributes as the default, overwriting any previous default. > โš ๏ธ Warning bestie: the previous default cannot be restored. It's gone. Periodt.

Examples are:

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

๐ŸŒธ NAMES AND TITLES ๐ŸŒธ

tmux is very much a "know the difference" kind of bestie: names and titles are two different things, and confusing them is a vibes crime ๐Ÿ’€

Windows and sessions have names. Names are what you use to target them, and they're what shows up in the status line and in the 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 whatever program is running inside that pane, using an escape sequence (the same way it'd set the xterm(1) window title in X(7)).

Windows themselves don't have titles โ€” a window's title is just the title of its active pane. And tmux itself may set the title of the terminal the client is running in; see the set-titles option for that one โœจ

A session's name gets set with the new-session and rename-session commands. A window's name gets 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 starts up, tmux copies the environment into the global environment; and on top of that, every session has its own session environment ๐Ÿซถ

When a window is created, the session environment and the global environment get merged. If a variable exists in both, the value from the session environment wins. That merged result is the initial environment passed to the new process.

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

Variables in both the session and global environments can be marked as hidden. Hidden variables don't get passed into the environment of new processes โ€” they can only be used by tmux itself (in formats, for example, see the โ€œFORMATSโ€ section) ๐Ÿ‘‘

The commands for messing with and viewing 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 happens in the global environment; otherwise it's 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 means the variable should 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 get shown. Variables that have been 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 (they're omitted by default, sneaky little things ๐Ÿ™ˆ).
set-environment [-Fhgru] [-t target-session] variable [value]
show-environment [-hgs] [-t target-session] [variable]

๐Ÿ’– STATUS LINE ๐Ÿ’–

tmux has an optional status line, and it lives in the bottom line of each terminal. Iconic behaviour honestly.

By default the status line is enabled and one line high (you can disable it or make it multiple lines with the status session option ๐Ÿ’ซ), and it 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 can contain dynamic content like the time or the output of a shell command โ€” see the status-left, status-left-length, status-right, and status-right-length options below), plus 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. You can customise it 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. And ooh โ€” the window name gets printed in inverted colours if there's an alert (bell, activity or silence) present ๐Ÿ˜ณ

The colour and attributes of the status line are configurable too: the entire status line with the status-style session option, and individual windows with the window-status-style window option ๐Ÿ’…

The status line automatically refreshes at an interval if it has changed, and that interval can be controlled with the status-interval session option.

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 it clears history for all types. See command-prompt for the possible values of prompt-type.
clear-prompt-history [-T prompt-type]

command-prompt</p> ๐Ÿ’ฌ

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

Opens up a command prompt inside a client, bestie. You'd use this from inside tmux to run commands interactively, like a little main character text box. ๐ŸŽ€

If template is there, it gets used as the command. And with -F, that template gets expanded as a format. โœจ

If -I shows up, inputs is a comma-separated list of the starting text for each prompt. If -p is given, prompts is a comma-separated list of prompts shown in order โ€” otherwise you just get one single prompt, built from template if present, or ':' if not. And -l disables splitting of inputs and prompts at commas, treating them literally. No splitting, no drama. ๐Ÿ’…

Before the command runs, the first occurrence of the string โ€˜%%โ€™ and all occurrences of โ€˜%1โ€™ get replaced with the response to the first prompt, all โ€˜%2โ€™ get replaced with the response to the second prompt, and so on for however many prompts you have. You can replace up to nine prompt responses (โ€˜%1โ€™ through โ€˜%9โ€™). And โ€˜%%%โ€™ is like โ€˜%%โ€™ but any quotation marks get escaped. ๐Ÿฆ‹

  • -1 โ€” makes the prompt accept only ONE key press, so the resulting input is a single character
  • -k โ€” like -1 but the key press gets translated to a key name
  • -N โ€” makes the prompt only accept numeric key presses
  • -C โ€” panes keep getting updated while the prompt is displayed
  • -i โ€” executes the command every time the prompt input changes instead of waiting for the user to exit the command prompt
  • -e โ€” makes BSpace cancel an empty prompt
  • -P โ€” opens the prompt inside a pane instead of on the status line

-T tells tmux what prompt-type you're working with. This changes what completions get offered when you hit Tab. The available types are: โ€˜commandโ€™, โ€˜searchโ€™. iykyk โœจ

Now, these keys have special meaning in the command prompt, and it depends on the value of the status-keys option. Here's the whole vibe check, vi girlies and emacs girlies both eating:

  • Cancel command prompt โ€” vi: q ยท emacs: Escape
  • Delete from cursor to start of word โ€” 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 โ€” emacs: Down
  • Get previous command from history โ€” 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 โ€” emacs: C-t

With -b, the prompt is shown in the background and the invoking client doesn't exit until it gets dismissed. ๐Ÿซถ


confirm-before ๐Ÿ™ˆ

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

Asks for confirmation before executing command, because we do NOT run things impulsively around here. ๐ŸŽ€ If -p is given, prompt is the prompt to display โ€” otherwise a prompt gets 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 doesn't exit until it gets dismissed. -y changes the default behaviour (that's if Enter alone is pressed) of the prompt to run the command. And -c changes the confirmation key to confirm-key; the default is โ€˜yโ€™. โญ


display-menu ๐Ÿ“

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)

Displays a menu on target-client. And target-pane gives the target for any commands run from that menu. Menus are iconic, we love a dropdown moment. ๐Ÿ’…

A menu gets 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 that menu item is chosen. The name and command are formats โ€” see the โ€œFORMATSโ€ and โ€œSTYLESโ€ sections. If the name begins with a hyphen (-), then the item is disabled (shown dim) and may not be chosen. And the name may be empty for a separator line, in which case both the key and command should be omitted. โœจ

  • -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 (see โ€œSTYLESโ€)
  • -S โ€” sets the style for the menu border (see โ€œSTYLESโ€)
  • -T โ€” 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 special values below.

Okay so the special position values, memorize these fr fr:

  • 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
  • L โ€” Flag: Both โ€” the position of the last menu
  • W โ€” Flag: Both โ€” the window position on the status line
  • S โ€” Flag: -y โ€” the line above or below the status line

Or it can be a format, which gets expanded including these additional variables ๐Ÿ‘‘

  • popup_centre_x โ€” Centered in the client
  • popup_centre_y โ€” Centered in the client
  • popup_height โ€” Height of menu or popup
  • popup_last_x โ€” Left of the last menu
  • popup_last_y โ€” Bottom of the last menu
  • 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 โ€” it just does not show up, no cap. ๐Ÿ˜ญ Pressing the key shortcut chooses the corresponding item. If the mouse is enabled and the menu was 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.

And these keys are available in menus:

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

display-message ๐Ÿ’Œ

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

Displays a message. If -p is given, the output is printed to stdout โ€” otherwise it's displayed in the target-client status line for up to delay milliseconds. If delay isn't 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 keeps getting updated while the message is displayed. If -l is given, message is printed unchanged โ€” no format expansion, literally as-is. Otherwise, the format of message is described in the โ€œFORMATSโ€ section, and information is taken from target-pane if -t is given, otherwise from the active pane. ๐ŸŒธ

If -j is given, message is parsed as JSON and printed. ๐Ÿฆ‹

-v prints verbose logging as the format is parsed, and -a lists the format variables and their values. Obsessed with a good debug moment.

-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)

Displays a popup running shell-command (or default-command when it's omitted) on target-client. A popup is a rectangular box drawn over the top of any panes โ€” floating window energy, main character behaviour, we love it. ๐Ÿ‘‘ If the command is run inside an existing popup, that popup gets modified. And in that case, only the -b, -B, -C, -E, -EE, -K, -N, -s, and -S options are accepted โ€” everything else is straight-up ignored. ๐Ÿ’€

-E closes the popup automatically when shell-command exits. Two -Es (-EE) closes the popup only if shell-command exited with success. And -k allows any key to dismiss the popup instead of only โ€˜Escapeโ€™ or โ€˜C-cโ€™. โœจ

  • -x, -y โ€” these two set where the popup lands, and they mean exactly the same thing they mean over in display-menu. same energy, different command ๐Ÿ’…
  • -w, -h โ€” popup width and height, and bestie both of these can be a percentage too (just slap a % on the end). leave them out entirely and you get half the terminal size, no biggie.
  • -B โ€” no border around the popup. bye border. ๐Ÿ™ˆ
  • -b โ€” sets what kind of characters get used to draw the popup borders. heads up though: if -B is in play, -b is just ignored, like it's not even there. for the possible values of border-lines, go peek at popup-border-lines.
  • -s โ€” the style for the popup itself, and -S โ€” the style for the popup border (see "STYLES").
  • -e โ€” takes the form VARIABLE=value and sets an environment variable for the popup. and yes you can stack it, specify it as many times as you want. โœจ
  • -T โ€” a format for the popup title (see "FORMATS").
  • -C โ€” closes any popup on the client. all of them. gone.
  • -N โ€” disables any -E, -EE, or -k option you specified earlier. like an undo button for those three.

show-prompt-history [-T prompt-type]

(alias: showphist)

Shows you the status prompt history for the prompt type prompt-type. if you skip -T? then it just shows you the history for all the types, because why gatekeep. also, go check command-prompt for what values prompt-type is allowed to be. ๐ŸŒธ

๐Ÿซง BUFFERS ๐Ÿซง

OK so tmux keeps a whole little collection of named paste buffers, and every single one of them is either explicitly named or automatically named. let's break that down:

  • 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 using set-buffer -n.
  • automatically named buffers just get handed a name like buffer0001, buffer0002, and so on, counting up.

Once you hit the buffer-limit option, the oldest automatically named buffer gets deleted to make room. and the explicitly named ones? they're not subject to buffer-limit at all, they're built different ๐Ÿ‘‘ โ€” and you can delete them yourself with the delete-buffer command.

You can add buffers using copy-mode, or with the set-buffer and load-buffer commands, and then paste them into a window with the paste-buffer command. and here's a handy one: if you run a buffer command and don't specify which buffer, it just assumes the most recently added automatically named buffer. iykyk.

Oh also โ€” there's a configurable history buffer maintained for each window too. by default it keeps up to 2000 lines, but you can change that with the history-limit option (see the set-option command above).

The buffer commands are as follows:


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

Puts a pane into buffer mode, where you can pick a buffer interactively from a list. every buffer gets shown on one line. there's a shortcut key shown on the left in brackets so you can just jump straight to one, or you can navigate the list and choose/manipulate stuff with the keys below. -Z zooms the pane. -y disables any confirmation prompts (living dangerously, love that).

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
  • c โ€” Clear the current filter
  • O โ€” Change sort order
  • r โ€” Reverse sort order
  • v โ€” Toggle preview
  • F1 or C-h โ€” Display help
  • q โ€” Exit mode

Once a buffer is chosen, %% gets replaced by the buffer name inside template, and the result is executed as a command. if you didn't give a template at all, then "paste-buffer -p -b '%%'" is what gets used. โœจ

  • -O โ€” the initial sort order, one of creation (time), name, or size.
  • -r โ€” reverses the sort order.
  • -f โ€” an initial filter, and the filter IS a format โ€” if it evaluates to zero the item in the list isn't shown, otherwise it is shown. and if a filter would lead to an empty list, it's just ignored (no empty-list violence here ๐Ÿ’€).
  • -F โ€” the format for each item in the list, and -K โ€” a format for each shortcut key. both of these get evaluated once for each line.
  • -N โ€” starts without the preview.
  • -k โ€” kills the pane when the mode is exited.
  • The choose-buffer command only works if at least one client is attached.

clear-history [-H] [-t target-pane]

(alias: clearhist)

Removes and frees the history for the specified pane. with -H it also wipes all the hyperlinks. clean slate bestie ๐Ÿงน

delete-buffer [-b buffer-name]

(alias: deleteb)

Deletes the buffer named buffer-name โ€” or, if you didn't name one, the most recently added automatically named buffer gets the boot.

list-buffers [-r] [-F format] [-f filter] [-O sort-order]

(alias: lsb)

Lists the global buffers. -F sets the format of each line, and -f sets a filter โ€” only buffers where the filter is true get shown. see the "FORMATS" section for that. -O picks the sort order, one of name, size, or creation (time), and -r flips that sort order around. ๐ŸŒˆ

load-buffer [-w] [-b buffer-name] [-t target-client] path

(alias: loadb)

Loads the contents of the specified paste buffer from path. if you hand it -w, the buffer also gets sent to the clipboard for target-client using the xterm(1) escape sequence โ€” if possible. and if path is -, the contents are read from stdin.

paste-buffer [-dprS] [-b buffer-name] [-s separator] [-t target-pane]

(alias: pasteb)

Inserts the contents of a paste buffer into the specified pane. don't specify a pane and it pastes into the current one. by default control characters are sanitized with vis(3); -S disables that. and with -d, it also deletes the paste buffer after.

when outputting, any linefeed (LF) characters in the paste buffer get replaced with a separator โ€” by default, carriage return (CR). you can set a custom separator with the -s flag. the -r flag means do no replacement (which is the same as a separator of LF). and if you pass -p, paste bracket control codes get inserted around the buffer, if the application has requested bracketed paste mode. ๐Ÿซถ

save-buffer [-a] [-b buffer-name] path

(alias: saveb)

Saves the contents of the specified paste buffer to path. the -a option appends to the file instead of overwriting it. and if path is -, the contents get written to stdout.

set-buffer [-aw] [-b buffer-name] [-t target-client] [-n new-buffer-name] data

(alias: setb)

Sets the contents of the specified buffer to data. give it -w and the buffer also gets sent to the clipboard for target-client using the xterm(1) escape sequence โ€” if possible. the -a option appends to the buffer instead of overwriting it. and the -n option renames the buffer to new-buffer-name.

show-buffer [-b buffer-name]

(alias: showb)

Displays the contents of the specified buffer. simple as that. ๐Ÿ’–


โœจ MISCELLANEOUS โœจ

Miscellaneous commands are as follows:

clock-mode [-t target-pane]

Displays a large clock. that's it that's the command. iconic honestly ๐Ÿ•

if-shell [-bF] [-t target-pane] shell-command command [command]

(alias: if)

Executes the first command if shell-command (run with /bin/sh) returns success โ€” or the second command otherwise. before it gets executed, shell-command is expanded using the rules from the "FORMATS" section, including the ones relevant to target-pane. with -b, shell-command runs in the background.

if you give it -F, then shell-command is not executed โ€” instead it's considered successful if it's neither empty nor zero (after formats are expanded). cute little logic check.

lock-server

(alias: lock)

Locks each client individually by running the command specified by the lock-command option. ๐Ÿ”’

run-shell [-bCE] [-c start-directory] [-d delay] [-t target-pane] [shell-command [argument ...]]

(alias: run)

Executes shell-command using /bin/sh โ€” or, with -C, a tmux command โ€” in the background, without creating a window. before being executed, shell-command gets expanded using the rules specified in the "FORMATS" section. and if you give it argument values, they're available as #{1}, #{2}, and so on. for example:

run-shell 'myscript.sh #{1} #{2}' foo bar

with -b, the command runs in the background. -d waits delay seconds before starting the command. -E redirects the command's stderr to stdout instead of just ignoring it. if -c is given, the current working directory gets set to start-directory. and if -C is not given, any output to stdout is displayed in view mode (in the pane specified by -t, or the current pane if -t is omitted) after the command finishes. if the command fails, the exit status is displayed too. ๐ŸŒŸ

wait-for [-ELSUlv] [-F format] [-w waiter] name

(alias: wait)

When used with no options at all, this prevents the client from exiting until it gets woken using wait-for -S with the same channel. when -L is used, the channel is locked, and any clients that try to lock that same channel get made to wait until the channel is unlocked with wait-for -U.

With -E, tmux waits for the next event with name. events include hook and notification names, and user @ events generated by set-hook -E or set-hook -B. if -F is given, format must also be true. if -v is given, event payload keys get printed (whether or not format is true). ๐Ÿ‘€

-l lists the waiters for name, and -w wakes waiter on name immediately.

๐Ÿ’… EXIT MESSAGES ๐Ÿ’…

So when a tmux client dips out, it leaves a little note behind, bestie. It's gonna be one of these:

  • detached (from session ...) โ€” the client just detached like a normal, well-adjusted queen. No drama.
  • detached and SIGHUP โ€” the client detached AND its parent yeeted a SIGHUP at it (like when you do detach-client -P). Rude but valid.
  • lost tty โ€” the client's tty(4) or pty(4) got destroyed out of nowhere. literally just evaporated ๐Ÿ˜ญ
  • terminated โ€” the client got taken out with SIGTERM.
  • too far behind โ€” client's in control mode and lowkey couldn't keep up with all the data tmux was throwing at it. not the client's fault, it's just a lot ๐Ÿซ 
  • exited โ€” the server exited because it had no sessions. empty house energy.
  • server exited โ€” the server exited when it caught a SIGTERM.
  • server exited unexpectedly โ€” the server crashed or otherwise bailed without telling the client why. the betrayal.

๐Ÿฆ‹ TERMINFO EXTENSIONS ๐Ÿฆ‹

Okay so tmux speaks some unofficial bonus features from terminfo(5). You do NOT normally need to set these by hand โ€” instead just use the terminal-features option, periodt. But here's the whole lore anyway because I love you:

  • 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. Cs takes a single string argument and uses it to set the colour; Cr takes no arguments and restores the default cursor colour. If it's set, you can do a sequence like this to 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 it's VT420 compatible.
  • Dsbp, Enbp โ€” disable and enable bracketed paste. Set automatically if the XT capability is present.
  • Dseks, Eneks โ€” disable and enable extended keys.
  • Dsesc, Enesc โ€” disable and enable application escape key mode.
  • Dsfcs, Enfcs โ€” disable and enable focus reporting. 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 โ€” enable the overline attribute.
  • Smulx โ€” set 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. so many underscores, we're so spoiled ๐Ÿ’…
  • Setulc, Setulc1, ol โ€” set the underscore colour or reset to the default. Setulc is for RGB colours and Setulc1 for ANSI or 256 colours. The Setulc argument is (red * 65536) + (green * 256) + blue where each is between 0 and 255.
  • Ss, Se โ€” set or reset the cursor style. If 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.

  • Spb โ€” set the state and progress for the OSC9;4 progress bar.
  • Swd โ€” set the opening sequence for the working directory notification. The sequence is terminated using the standard fsl capability.
  • Sxl โ€” indicates the terminal supports SIXEL.
  • Sync โ€” start (parameter is 1) or end (parameter is 2) a synchronized update.
  • Tc โ€” indicate 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 may 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 โ€” store 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 above.

๐Ÿ‘‘ CONTROL MODE ๐Ÿ‘‘

tmux serves a whole other textual interface called control mode, and it's giving "let the apps talk to tmux directly." It lets applications communicate with tmux using a simple text-only protocol. no frills, just vibes and bytes. ๐Ÿซถ

In control mode, a client sends tmux commands or command sequences terminated by newlines on standard input. Each command will produce exactly one block of output on standard output. An output block is a %begin line followed by the output (which may be empty), and it ends with a %end or %error. The %begin and its matching %end or %error 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 {"V":2,"L":{"t":"p","w":80,"h":24,"x":0,"y":0,"a":true,"i":0,"I":"%2"}}] @2 (active)
%end 1363006971 2 1

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

In control mode, tmux also outputs notifications. A notification will never occur inside an output block โ€” that's the rule, no cap.

The following notifications are defined:

  • %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 is not attached to any session or 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.
  • %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 and the window's visible layout is window-visible-layout. If the new-layouts flag is set, both layout fields use the new format string; see refresh-client -f. 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 new-name โ€” 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 ๐ŸŒธ

When tmux boots up, it peeks at these environment variables, like a little vibe check before the party starts:

  • EDITOR โ€” if the command in here contains the string vi, and VISUAL is not set, tmux goes with vi-style key bindings. This gets overridden by the mode-keys and status-keys options. (She's just a suggestion bestie, the options always win ๐Ÿ’…)
  • HOME โ€” the user's login directory. If it's unset, tmux goes and consults the passwd(5) database instead, like asking the group chat when your friend isn't picking up.
  • LC_CTYPE โ€” the character encoding locale(1). Okay this one does two separate jobs, so pay attention:
    • For output to the terminal: UTF-8 gets used if you gave the -u option, or if LC_CTYPE contains "UTF-8" or "UTF8". Otherwise it's ASCII-only, and every non-ASCII character gets replaced with underscores (_). ๐Ÿ’€
    • For input: tmux always runs with a UTF-8 locale, no negotiation. If en_US.UTF-8 is provided by the operating system, that's what's used and LC_CTYPE is straight-up ignored for input. Otherwise, LC_CTYPE tells tmux what the UTF-8 locale is called on this system. And if the locale named by LC_CTYPE isn't available, or isn't a UTF-8 locale? tmux exits with an error message. She said what she said ๐Ÿ˜ญ
  • LC_TIME โ€” the date and time locale(1) format. It's what feeds the locale-dependent strftime(3) format specifiers. โœจ
  • PWD โ€” the current working directory to be set in the global environment. This can be genuinely useful if it contains symbolic links. But heads up: if the value here doesn't match the actual current working directory, the variable is ignored, and the result of getcwd(3) is used instead. No lying in this household ๐Ÿ™ˆ
  • SHELL โ€” the absolute path to the default shell for new windows. See the default-shell option for the details.
  • TMUX_TMPDIR โ€” the parent directory of the directory that holds the server sockets. See the -L option for the whole story.
  • VISUAL โ€” if the command in this variable contains the string vi, use vi-style key bindings. Overridden by the mode-keys and status-keys options, same as EDITOR.

๐Ÿ“ FILES ๐Ÿ“

  • ~/.tmux.conf
  • $XDG_CONFIG_HOME/tmux/tmux.conf
  • ~/.config/tmux/tmux.conf

โ†’ these are the default tmux configuration file. Yes bestie, multiple locations, she's flexible like that ๐Ÿฆ‹

  • /etc/tmux.conf โ€” the system-wide configuration file.

โœจ EXAMPLES โœจ

Wanna spin up a brand new tmux session running vi(1)? Say less:

$ tmux new-session vi

Most commands have a shorter form, aka an alias. For new-session, that alias is new:

$ tmux new vi

Alternatively, you can just type the shortest unambiguous form of a command and it'll accept that. But if several commands match, it lists them out for you, like:

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

Inside an active session, you can make a new window by typing C-b c โ€” that's Ctrl followed by the b key, followed by the c key.

Windows can be navigated with: C-b 0 (jump to window 0), C-b 1 (jump to window 1), and so on and so on; C-b n grabs the next window; and C-b p goes to the previous one. Hop around like you own the place ๐Ÿ‘‘

A session can be detached with C-b d โ€” or by some outside event, like ssh(1) disconnecting on you, rude โ€” and then reattached with:

$ tmux attach-session

Type C-b ? and it lists the current key bindings for the current window. Use up and down to scroll through the list, or press q to bail out. ๐ŸŽ€

If you want commands to run when the tmux server starts up, drop them in the ~/.tmux.conf config file. Some common faves 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, like 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 one who made your terminal life cute fr fr ๐Ÿ’–


And that's the whole page bestie, you made it to the end!! ๐ŸŒˆ This version is the Debian one, dated September 23, 2026, for the page TMUX(1) โ€” which, yes, means you genuinely read all of it and I'm so proud of you, that's main character energy if I've ever seen it. Go forth and multiplex ๐Ÿ’…โœจ๐Ÿซถ

๐Ÿ“ฆ where this page comes from