TMUX(1)
π TMUX(1) β the terminal multiplexer, bestie edition π
okay so real talk: this is the manual page for tmux from the General Commands Manual section. It's long, it's iconic, and we're gonna get through it together. Grab a snack. π
β¨ NAME β¨
tmux β terminal multiplexer π¦
πΈ SYNOPSIS πΈ
tmux [-2CDhlNuVv] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [-T features] [command [flags]]
π DESCRIPTION π
Bestie. Listen. tmux is a terminal multiplexer. What that means, no cap, is that it lets a whole bunch of terminals get created, accessed, and controlled from one single screen. And the way it does it? You can detach from a screen and it justβ¦ keeps running in the background. Living its life. Then later you reattach whenever you want. Main character energy fr. π
When tmux starts up, it creates a new session with a single window, and shows it on your screen. Down at the bottom there's a status line showing info about the current session β that's also where you go to enter interactive commands. Lowkey the most useful strip of pixels you'll ever meet.
So here's the vocabulary, because it matters:
- A session is a single collection of pseudo terminals under the management of
tmux. - Each session has one or more windows linked to it.
- A window takes up the entire screen and may be split into rectangular panes.
- Each pane is its own separate pseudo terminal. (If you want the technical deets on pseudo terminals, that's the
pty(4)manual page's whole thing. Not our problem today. π«Ά)
Any number of tmux instances may connect to the same session, and any number of windows may be present in the same session. Once all sessions are killed, tmux exits. That's it. That's the whole lifecycle. π
Every session is persistent β it survives accidental disconnection (like an ssh(1) connection timeout, we've all been there) and it survives intentional detaching (with the C-b d key strokes). To come back, you just do:
$ tmux attach
In tmux, a session is displayed on screen by a client, and all sessions are managed by a single server. The server and each client are separate processes, and they communicate through a socket in /tmp. So it's giving⦠tiny little family of processes passing notes. Obsessed.
The options are as follows:
-2β Forcetmuxto assume the terminal supports 256 colours. This is equivalent to-T 256. β¨-Cβ Start in control mode (peep the βCONTROL MODEβ section for that whole situation). Given twice (-CC) it disables echo.-cshell-command β Execute shell-command using the default shell. If necessary, thetmuxserver will be started to retrieve thedefault-shelloption. This option is for compatibility withsh(1)whentmuxis used as a login shell.-Dβ Do not start thetmuxserver as a daemon. This also turns theexit-emptyoption off. With-D, command may not be specified.-ffile β Specify an alternative configuration file. By default,tmuxloads the system configuration file from/etc/tmux.conf, if present, then looks for a user configuration file at~/.tmux.confor$XDG_CONFIG_HOME/tmux/tmux.conf.
The configuration file is a set of tmux commands which are executed in sequence when the server is first started. tmux loads configuration files once when the server process has started. The source-file command may be used to load a file later.
tmux shows any error messages from commands in configuration files in the first session created, and continues to process the rest of the configuration file. (So yes bestie, one typo in your config won't nuke the whole thing. She's forgiving. π)
-hβ Print usage information and exit.-Lsocket-name βtmuxstores the server socket in a directory underTMUX_TMPDIR, or/tmpif it is unset. The default socket is nameddefault. This option allows a different socket name to be specified, allowing several independenttmuxservers to be run. Unlike-S, a full path is not necessary: the sockets are all created in a directorytmux-UIDunder the directory given byTMUX_TMPDIRor in/tmp. Thetmux-UIDdirectory is created bytmuxand must not be world readable, writable or executable.
If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it (note that this will fail if any parent directories are missing). π
-lβ Behave as a login shell. This flag currently has no effect and is for compatibility with other shells when usingtmuxas a login shell. It's giving decorative. π-Nβ Do not start the server even if the command would normally do so (for examplenew-sessionorstart-server).-Ssocket-path β Specify a full alternative path to the server socket. If-Sis specified, the default socket directory is not used and any-Lflag is ignored.-Tfeatures β Set terminal features for the client. This is a comma-separated list of features. See theterminal-featuresoption.-uβ Write UTF-8 output to the terminal even if the first environment variable ofLC_ALL,LC_CTYPE, orLANGthat is set does not contain"UTF-8"or"UTF8". π€ (we are not letting locale hold us back)-Vβ Report thetmuxversion.-vβ Request verbose logging. Log messages will be saved intotmux-client-PID.logandtmux-server-PID.logfiles in the current directory, where PID is the PID of the server or client process. If-vis specified twice, an additionaltmux-out-PID.logfile is generated with a copy of everythingtmuxwrites to the terminal.
The SIGUSR2 signal may be sent to the tmux server process to toggle logging between on (as if -v was given) and off. π₯
command [flags]β This specifies one of a set of commands used to controltmux, as described in the following sections. If no commands are specified, the command indefault-client-commandis assumed, which defaults tonew-session.
π DEFAULT KEY BINDINGS π
You can control tmux from an attached client with a prefix key β C-b (Ctrl-b) by default β followed by a command key. So it's like a little secret handshake: prefix, then the thing. π
The default command key bindings are:
C-bβ Send the prefix key (C-b) through to the application.C-oβ Rotate the panes in the current window forwards.C-zβ Suspend thetmuxclient.!β Break the current pane out of the window."β Split the current pane into two, top and bottom.#β List all paste buffers.$β Rename the current session.%β Split the current pane into two, left and right.&β Kill the current window.'β Prompt for a window index to select.(β Switch the attached client to the previous session.)β Switch the attached client to the next session.,β Rename the current window.-β Delete the most recently copied buffer of text..β Prompt for an index to move the current window.0to9β Select windows0to9.:β Enter thetmuxcommand 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 (seeselect-pane -m).Mβ Clear the marked pane.nβ Change to the next window.oβ Select the next pane in the current window.pβ Change to the previous window.qβ Briefly display pane indexes.rβ Force redraw of the attached client.sβ Select a new session for the attached client interactively.tβ Show the time.wβ Choose the current window interactively.xβ Kill the current pane.zβ Toggle zoom state of the current pane.{β Swap the current pane with the previous pane.}β Swap the current pane with the next pane.~β Show previous messages fromtmux, 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-1toM-7β Arrange panes in one of the seven preset layouts:even-horizontal,even-vertical,main-horizontal,main-horizontal-mirrored,main-vertical,main-vertical-mirrored, ortiled. πSpaceβ Arrange the current window in the next preset layout.M-nβ Move to the next window with a bell or activity marker.M-oβ Rotate the panes in the current window backwards.M-pβ Move to the previous window with a bell or activity marker.C-Up,C-Down,C-Left,C-Rightβ Resize the current pane in steps of one cell.M-Up,M-Down,M-Left,M-Rightβ Resize the current pane in steps of five cells.
Key bindings may be changed with the bind-key and unbind-key commands. π«Ά
β¨ COMMAND PARSING AND EXECUTION β¨
okay so bestie, tmux has a TON of commands that control literally everything it does. π
Every command has a name and can take zero or more flags and arguments. You can bind them to a key with the bind-key command, or run them from your shell prompt, a shell script, a config file, or the command prompt. For example, the same set-option command run from the shell prompt, from ~/.tmux.conf, and bound to a key might look like:
$ tmux set-option -g status-style bg=cyan
set-option -g status-style bg=cyan
bind-key C set-option -g status-style bg=cyan
Here, the command name is set-option, -g is a flag, and status-style and bg=cyan are arguments. No cap. π§’
tmux is lowkey obsessed with the difference between command parsing and execution. To execute a command, tmux needs it split up into its name and arguments. That's command parsing. If you run a command from the shell, the shell parses it; from inside tmux or from a config file, tmux does the parsing. Examples of when tmux parses commands are:
- in a configuration file;
- typed at the command prompt (see
command-prompt); - given to
bind-key; - passed as arguments to
if-shellorconfirm-before.
To execute commands, each client has a βcommand queueβ. A global command queue not attached to any client is used on startup for config files like ~/.tmux.conf. Parsed commands added to the queue are executed in order. Some commands, like if-shell and confirm-before, parse their argument to create a new command which is inserted immediately after themselves. This means arguments can be parsed twice or more β once when the parent command (like if-shell) is parsed, and again when it parses and executes its command. Commands like if-shell, run-shell, and display-panes stop execution of subsequent commands on the queue until something happens β if-shell and run-shell until a shell command finishes, and display-panes until a key is pressed. For example, the following commands:
new-session; new-window
if-shell "true" "split-window"
kill-session
Will execute new-session, new-window, if-shell, the shell command true(1), split-window, and kill-session in that order. Periodt. π
The βCOMMANDSβ section lists the tmux commands and their arguments.
πΈ PARSING SYNTAX πΈ
This section describes the syntax of commands parsed by tmux, for example in a configuration file or at the command prompt. Note that when commands are entered into the shell, they are parsed by the shell β see for example ksh(1) or csh(1). iykyk. π¦
Each command is terminated by a newline or a semicolon (;). Commands separated by semicolons together form a βcommand sequenceβ β if a command in the sequence encounters an error, no subsequent commands are executed. So it's giving "one bad apple spoils the whole bunch". π
It is recommended that a semicolon used as a command separator should be written as an individual token, for example from sh(1):
$ tmux neww \; splitw
Or:
$ tmux neww ';' splitw
Or from the tmux command prompt:
neww ; splitw
However, a trailing semicolon is also interpreted as a command separator, for example in these sh(1) commands:
$ tmux neww\; splitw
Or:
$ tmux 'neww;' splitw
As in these examples, when running tmux from the shell extra care must be taken to properly quote semicolons:
- 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 asneww ';' splitw) or escaped (such asneww \; splitw). - 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
- Semicolons that are not individual tokens or trailing another token should only be escaped once according to shell conventions; for example:
$ tmux neww 'foo-;-bar'
$ tmux neww foo-\;-bar
Comments are marked by the unquoted # character β any remaining text after a comment is ignored until the end of the line. So # is like the "not me" of syntax. π
If the last character of a line is \, the line is joined with the following line (the \ and the newline are completely removed). This is called line continuation and applies both inside and outside quoted strings and in comments, but not inside braces. Slay. β¨
Command arguments may be specified as strings surrounded by single (') quotes or double quotes ("), or as command lists surrounded by braces ({}). This is required when the argument contains any special character. Single and double quoted strings cannot span multiple lines except with line continuation. Braces can span multiple lines. Iconic. π
Outside of quotes and inside double quotes, these replacements are performed:
- Environment variables preceded by
$are replaced with their value from the global environment (see the βGLOBAL AND SESSION ENVIRONMENTβ section). - A leading
~or~useris expanded to the home directory of the current or specified user. \uXXXXor\uXXXXXXXXis 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:\eby the escape character;\rby a carriage return;\nby a newline; and\tby a tab. \ooois replaced by a character of the octal valueooo. Three octal digits are required, for example\001. The largest valid character is\377.- Any other characters preceded by
\are replaced by themselves (that is, the\is removed) and are not treated as having any special meaning β so for example\;will not mark a command sequence and\$will not expand an environment variable.
Braces are parsed as a configuration file (so conditions such as %if are processed) and then converted into a string. They are designed to avoid the need for additional escaping when passing a group of tmux commands as an argument (for example to if-shell). These two examples produce an identical command β note that no escaping is needed when using {}:
if-shell true {
display -p 'brace-dollar-foo: }$foo'
}
if-shell true "display -p 'brace-dollar-foo: }\$foo'"
Braces may be enclosed inside braces, for example:
bind x if-shell "true" {
if-shell "true" {
display "true!"
}
}
Environment variables may be set by using the syntax name=value, for example HOME=/home/user. Variables set during parsing are added to the global environment. A hidden variable may be set with %hidden, for example:
%hidden MYVAR=42
Hidden variables are not passed to the environment of processes created by tmux. See the βGLOBAL AND SESSION ENVIRONMENTβ section. So secretive, main character energy. π
Commands may be parsed conditionally by surrounding them with %if, %elif, %else and %endif. The argument to %if and %elif is expanded as a format (see βFORMATSβ) and if it evaluates to false (zero or empty), subsequent text is ignored until the closing %elif, %else or %endif. For example:
%if "#{==:#{host},myhost}"
set -g status-style bg=red
%elif "#{==:#{host},myotherhost}"
set -g status-style bg=green
%else
set -g status-style bg=blue
%endif
Will change the status line to red if running on myhost, green if running on myotherhost, or blue if running on another host. Conditionals may be given on one line, for example:
%if #{==:#{host},myhost} set -g status-style bg=red %endif
π COMMANDS π
okay so bestie, welcome to the command section β it's literally the whole tmux menu, and it's iconic. Most commands accept the optional -t argument (and sometimes -s too) with one of target-client, target-session, target-window, or target-pane. These specify the client, session, window or pane that a command should affect. vibe check passed. β¨
target-client β okay so this one should be the name of the client, typically the pty(4) file to which the client is connected, for example either of /dev/ttyp1 or ttyp1 for the client attached to /dev/ttyp1. If no client is specified, tmux attempts to work out the client currently in use; if that fails, an error is reported. Clients may be listed with the list-clients command. no cap. π
target-session is tried as, in order:
- A session ID prefixed with a
$. - An exact name of a session (as listed by the
list-sessionscommand). - The start of a session name, for example
βmysessβwould match a session namedβmysessionβ. - A
glob(7)pattern which is matched against the session name.
If the session name is prefixed with an β=β, only an exact match is accepted (so β=mysessβ will only match exactly βmysessβ, not βmysessionβ). periodt.
If a single session is found, it is used as the target session; multiple matches produce an error. If a session is omitted, the current session is used if available; if no current session is available, the most recently used is chosen. lowkey useful. π¦
target-window (or src-window or dst-window) specifies a window in the form session:window. The session follows the same rules as for target-session, and window is looked for in order as:
- A special token, listed below.
- A window index, for example
βmysession:1βis window 1 in sessionβmysessionβ. - A window ID, such as
@1. - An exact window name, such as
βmysession:mywindowβ. - The start of a window name, such as
βmysession:mywinβ. - As a
glob(7)pattern matched against the window name.
Like sessions, a β=β prefix will do an exact match only. An empty window name specifies the next unused index if appropriate (for example the new-window and link-window commands) otherwise the current window in session is chosen. it's giving precision. π
The following special tokens are available to indicate particular windows. Each has a single-character alternative form. π
{start},^β The lowest-numbered window{end},$β The highest-numbered window{last},!β The last (previously current) window{next},+β The next window by number{previous},-β The previous window by number
target-pane (or src-pane or dst-pane) may be a pane ID or takes a similar form to target-window but with the optional addition of a period followed by a pane index or pane ID, for example: βmysession:mywindow.1β. If the pane index is omitted, the currently active pane in the specified window is used. The following special tokens are available for the pane index: πΈ
{last},!β The last (previously active) pane{next},+β The next pane by number{previous},-β The previous pane by number{top}β The top pane{bottom}β The bottom pane{left}β The leftmost pane{right}β The rightmost pane{top-left}β The top-left pane{top-right}β The top-right pane{bottom-left}β The bottom-left pane{bottom-right}β The bottom-right pane{up-of}β The pane above the active pane{down-of}β The pane below the active pane{left-of}β The pane to the left of the active pane{right-of}β The pane to the right of the active pane
The tokens β+β and β-β may be followed by an offset, for example:
select-window -t:+2
In addition, target-session, target-window or target-pane may consist entirely of the token β{mouse}β (alternative form β=β) to specify the session, window or pane where the most recent mouse event occurred (see the βMOUSE SUPPORTβ section) or β{marked}β (alternative form β~β) to specify the marked pane (see select-pane -m). mouse girlies rise π
Sessions, window and panes are each numbered with a unique ID; session IDs are prefixed with a β$β, windows with a β@β, and panes with a β%β. These are unique and are unchanged for the life of the session, window or pane in the tmux server. The pane ID is passed to the child process of the pane in the TMUX_PANE environment variable. IDs may be displayed using the βsession_idβ, βwindow_idβ, or βpane_idβ formats (see the βFORMATSβ section) and the display-message, list-sessions, list-windows or list-panes commands. iykyk β
shell-command arguments are sh(1) commands. This may be a single argument passed to the shell, for example:
new-window 'vi ~/.tmux.conf'
Will run:
/bin/sh -c 'vi ~/.tmux.conf'
Additionally, the new-window, new-session, split-window, respawn-window and respawn-pane commands allow shell-command to be given as multiple arguments and executed directly (without βsh -cβ). This can avoid issues with shell quoting. For example:
$ tmux new-window vi ~/.tmux.conf
Will run vi(1) directly without invoking the shell. slay π
command [argument ...] refers to a tmux command, either passed with the command and arguments separately, for example:
bind-key F1 set-option status off
Or passed as a single string argument in .tmux.conf, for example:
bind-key F1 { set-option status off }
Example tmux commands include:
refresh-client -t/dev/ttyp2
rename-session -tfirst newname
set-option -wt:0 monitor-activity on
new-window ; split-window -d
bind-key R source-file ~/.tmux.conf \; \
display-message "source-file done"
Or from sh(1):
$ tmux kill-window -t :1
$ tmux new-window \; split-window -d
$ tmux new-session -d 'vi ~/.tmux.conf' \; split-window -d \; attach
β¨ CLIENTS AND SESSIONS β¨
The tmux server manages clients, sessions, windows and panes. Clients are attached to sessions to interact with them, either when they are created with the new-session command, or later with the attach-session command. Each session has one or more windows linked into it. Windows may be linked to multiple sessions and are made up of one or more panes, each of which contains a pseudo terminal. Commands for creating, linking and otherwise manipulating windows are covered in the βWINDOWS AND PANESβ section. main character energy π
The following commands are available to manage clients and sessions:
attach-session [-dErx] [-c working-directory] [-f flags] [-t
target-session]
(alias: attach)
If you run it from outside tmux, it attaches you to target-session in whatever terminal you're sitting in rn. target-session has to already exist β if you wanna make a brand new session, go look at the new-session command (use -A to create-or-attach, that's the move). And if you're already inside tmux? It just switches your currently attached session over to target-session. π
- If
-dis given, every other client attached to that session gets detached. - If
-xis given, tmux sendsSIGHUPto the parent process of the client as well as detaching the client, which typically makes it exit. -fsets a comma-separated list of client flags.
The flags are:
active-paneβ the client has an independent active paneignore-sizeβ the client does not affect the size of other clientsno-detach-on-destroyβ do not detach the client when the session it is attached to is destroyed if there are any other sessionsno-outputβ the client does not receive pane output in control modepause-after=seconds β output is paused once the pane is seconds behind in control moderead-onlyβ the client is read-onlywait-exitβ wait for an empty line input before exiting in control mode
A leading ! turns a flag off if the client is already attached. And -r is literally just an alias for -f read-only,ignore-size, bestie. When a client is read-only, only keys bound to the detach-client or switch-client commands have any effect. A client with the active-pane flag lets the active pane be selected independently of the window's active pane that clients without the flag use β and ngl this only affects the cursor position and the commands issued from that client; other features like hooks and styles keep using the window's active pane. π«Ά
If no server is started, attach-session will attempt to start it β but that's gonna fail unless sessions are created in the configuration file. π
The target-session rules for attach-session are slightly adjusted too: if tmux needs to select the most recently used session, it prefers the most recently used unattached session. β¨
-c sets the session working directory (the one used for new windows) to working-directory.
And if -E is used, the update-environment option will not be applied.
detach-client π
detach-client [-aP] [-E shell-command] [-s target-session] [-t target-client]
(alias: detach)
Detaches the current client if you bound it to a key, or the client you name with -t, or all clients currently attached to the session you name with -s.
-aβ kills all clients except the one given with-t-Pβ sendSIGHUPto the parent process of the client, typically causing it to exit-Eβ run shell-command to replace the client
has-session π΅οΈ
has-session [-t target-session]
(alias: has)
Reports an error and exits with 1 if the specified session does not exist. If it does exist? Exits with 0. That's it, that's the whole vibe check. πΈ
kill-server π
kill-server
Kills the tmux server and the clients, and destroys all sessions. Absolutely nuclear. No survivors. π₯
kill-session π
kill-session [-aC] [-t target-session]
Destroys the given session, closing any windows linked to it (and no other sessions), and detaching all clients attached to it.
-aβ all sessions but the specified one get killed-Cβ clears alerts (bell, activity, or silence) in all windows linked to the session
list-clients π
list-clients [-F format] [-f filter] [-t target-session]
(alias: lsc)
Lists all clients attached to the server. -F specifies the format of each line and -f a filter β only clients for which the filter is true are shown. See the βFORMATSβ section for the deets. If target-session is specified, it lists only clients connected to that session.
list-commands π
list-commands [-F format] [command]
(alias: lscm)
Lists the syntax of command, or β if you omit it β of all commands supported by tmux. Every single one. Iconic.
list-sessions π¦
list-sessions [-F format] [-f filter]
(alias: ls)
Lists all sessions managed by the server. -F specifies the format of each line and -f a filter β only sessions for which the filter is true are shown. See the βFORMATSβ section.
lock-client π
lock-client [-t target-client]
(alias: lockc)
Locks target-client β see the lock-server command.
lock-session π
lock-session [-t target-session]
(alias: locks)
Locks all clients attached to target-session.
new-session β¨πΆ
new-session [-AdDEPX] [-c start-directory] [-e environment] [-f flags] [-F format] [-n window-name] [-s session-name] [-t group-name] [-x width] [-y height] [shell-command [argument ...]]
(alias: new)
Creates a new session with name session-name. π
The new session is attached to the current terminal unless -d is given. window-name and shell-command are the name of and the shell command to execute in the initial window. With -d, the initial size comes from the global default-size option β -x and -y can specify a different size. A - uses the size of the current client, if any. If -x or -y is given, the default-size option is set for the session. -f sets a comma-separated list of client flags (go read attach-session).
If run from a terminal, any termios(4) special characters are saved and used for new windows in the new session.
The -A flag makes new-session behave like attach-session if session-name already exists β and if -A is given, -D behaves like -d to attach-session, and -X behaves like -x to attach-session. π
If -t is given, it specifies a session group. Sessions in the same group share the same set of windows β new windows get linked to all sessions in the group, and any windows closed get removed from all sessions. The current and previous window and any session options stay independent, and any session in a group may be killed without affecting the others. The group-name argument may be:
- the name of an existing group, in which case the new session is added to that group;
- the name of an existing session β the new session is added to the same group as that session, creating a new group if necessary;
- the name for a new group containing only the new session.
Heads up bestie:-nand shell-command are invalid if-tis used.
The -P option prints information about the new session after it has been created. By default it uses the format β#{session_name}:β but a different format may be specified with -F. π«Ά
If -E is used, the update-environment option will not be applied. -e takes the form βVARIABLE=valueβ and sets an environment variable for the newly created session β and yes, it may be specified multiple times. π
refresh-client π
refresh-client [-cDLRSU] [-A pane:state] [-B name:what:format] [-C size] [-f flags] [-l [target-pane]] [-r pane:report] [-t target-client] [adjustment]
(alias: refresh)
Refreshes the current client if bound to a key, or a single client if one is given with -t. If -S is specified, only the client's status line gets updated. β¨
The -U, -D, -L, -R, and -c flags let you change the visible portion of a window that's larger than the client. -U moves the visible part up by adjustment rows and -D down, -L left by adjustment columns and -R right. -c returns to tracking the cursor automatically. If adjustment is omitted, 1 is used. And ngl, note that the visible position is a property of the client, not of the window β so changing the current window in the attached session will reset it. π
-C sets the width and height of a control mode client or of a window for a control mode client. size must be one of βwidthxheightβ or βwindow ID:widthxheightβ, for example β80x24β or β@0:80x24β. -A allows a control mode client to trigger actions on a pane β the argument is a pane ID (with a leading β%β), a colon, then one of βonβ, βoffβ, βcontinueβ or βpauseβ. If βoffβ, tmux will not send output from the pane to the client and, if all clients have turned the pane off, will stop reading from the pane. If βcontinueβ, tmux will return to sending output to the pane if it was paused (manually or with the pause-after flag). If βpauseβ, tmux will pause the pane. -A may be given multiple times for different panes. π
-B sets a subscription to a format for a control mode client. The argument is split into three items by colons: name is a name for the subscription; what is a type of item to subscribe to; format is the format. After a subscription is added, changes to the format are reported with the %subscription-changed notification, at most once a second. If only the name is given, the subscription is removed. what may be empty to check the format only for the attached session, or one of: a pane ID such as β%0β; β%*β for all panes in the attached session; a window ID such as β@0β; or β@*β for all windows in the attached session. π¦
-f sets a comma-separated list of client flags β see attach-session. -r allows a control mode client to provide information about a pane via a report (such as the response to OSC 10). The argument is a pane ID (with a leading β%β), a colon, then a report escape sequence. π
-l requests the clipboard from the client using the xterm(1) escape sequence. If target-pane is given, the clipboard is sent (in encoded form), otherwise it is stored in a new paste buffer. π
-L, -R, -U and -D move the visible portion of the window left, right, up or down by adjustment, if the window is larger than the client. -c resets so that the position follows the cursor. See the window-size option.
rename-session π·οΈ
rename-session [-t target-session] new-name
(alias: rename)
Renames the session to new-name. Glow-up complete. π
server-access πͺ
server-access [-adlrw] [user]
Changes the access or read/write permission of user. The user running the tmux server (its owner) and the root user cannot be changed and are always permitted access. Periodt. π₯
-aand-dβ these give or revoke access for the specified user. And if that user is already attached, the-dflag makes their clients get detached. bye bestie π-rand-wβ change the permissions for user:-rmakes their clients read-only,-wmakes them writable.-lβ lists the current access permissions.
By default, the access list is empty and tmux creates sockets with file system permissions that prevent access by any user other than the owner (and root, obviously). Those permissions have to be changed manually β so like, you gotta go do it yourself.
β οΈ Great care should be taken not to allow access to untrusted users, even read-only. Fr fr, do not let the sketchy ones in. π«
π¬ show-messages
(alias: showmsgs)
Show server messages or information. Messages are stored, up to a maximum of the limit set by the message-limit server option. -J and -T show debugging information about jobs and terminals. π
show-messages [-JT] [-t target-client]
ποΈ source-file
(alias: source)
Execute commands from one or more files specified by path β and yes, path can be glob(7) patterns, so you can be fancy with it. β¨
- If
-Fis present, then path is expanded as a format. - If
-qis given, no error will be returned if path does not exist. (quiet queen energy, we love her) - With
-n, the file is parsed but no commands are executed. -vshows the parsed commands and line numbers if possible.
source-file [-Fnqv] [-t target-pane] path ...
π start-server
(alias: start)
Start the tmux server, if it isn't already running, without creating any sessions.
β οΈ Note that as by default the tmux server will exit with no sessions, this is only useful if a session is created in~/.tmux.conf,exit-emptyis turned off, or another command is run as part of the same command sequence. Likeβ¦ otherwise you just start it and it immediately ghosts you. π
For example:
$ tmux start \; show -g
π΄ suspend-client
(alias: suspendc)
Suspend a client by sending SIGTSTP (tty stop). Nap time bestie π
suspend-client [-t target-client]
π switch-client
(alias: switchc)
Switch the current session for client target-client to target-session. As a special case, -t may refer to a pane (a target that contains β:β, β.β or β%β), to change session, window and pane. In that case, -Z keeps the window zoomed if it was zoomed. π
If -l, -n or -p is used, the client is moved to the last, next or previous session respectively. -r toggles the client read-only and ignore-size flags (see the attach-session command).
If -E is used, the update-environment option will not be applied.
-T sets the client's key table; the next key from the client will be interpreted from key-table. This may be used to configure multiple prefix keys, or to bind commands to sequences of keys. For example, to make typing βabcβ run the list-keys command:
bind-key -Ttable2 c list-keys
bind-key -Ttable1 b switch-client -Ttable2
bind-key -Troot a switch-client -Ttable1
switch-client [-ElnprZ] [-c target-client] [-t target-session] [-T key-table]
πͺ WINDOWS AND PANES πͺ
Each window displayed by tmux may be split into one or more panes; each pane takes up a certain area of the display and is a separate terminal. A window may be split into panes using the split-window command. Windows may be split horizontally (with the -h flag) or vertically. Panes may be resized with the resize-pane command (bound to βC-Upβ, βC-Downβ βC-Leftβ and βC-Rightβ by default), the current pane may be changed with the select-pane command and the rotate-window and swap-pane commands may be used to swap panes without changing their position. Panes are numbered beginning from zero in the order they are created. π’
By default, a tmux pane permits direct access to the terminal contained in the pane. A pane may also be put into one of several modes:
- Copy mode β which permits a section of a window or its history to be copied to a paste buffer for later insertion into another window. This mode is entered with the
copy-modecommand, bound to β[β by default. Copied text can be pasted with thepaste-buffercommand, 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-clientandchoose-treecommands. π―
In copy mode an indicator is displayed in the top-right corner of the pane with the current position and the number of lines in the history.
Commands are sent to copy mode using the -X flag to the send-keys command. When a key is pressed, copy mode automatically uses one of two key tables, depending on the mode-keys option: copy-mode for emacs, or copy-mode-vi for vi. Key tables may be viewed with the list-keys command. π§
The following commands are supported in copy mode:
append-selectionβ Append the selection to the top paste buffer.append-selection-and-cancelβ (vi:A) Append the selection to the top paste buffer and exit copy mode.back-to-indentationβ (vi:^) (emacs:M-m) Move the cursor back to the indentation.begin-selectionβ (vi:Space) (emacs:C-Space) Begin selection.bottom-lineβ (vi:L) Move to the bottom line.cancelβ (vi:q) (emacs:Escape) Exit copy mode.clear-selectionβ (vi:Escape) (emacs:C-g) Clear the current selection.copy-end-of-line [-CP] [prefix]β Copy from the cursor position to the end of the line. prefix is used to name the new paste buffer.copy-end-of-line-and-cancel [-CP] [prefix]β Copy from the cursor position and exit copy mode.copy-pipe-end-of-line [-CP] [command] [prefix]β Copy from the cursor position to the end of the line and pipe the text to command. prefix is used to name the new paste buffer.copy-pipe-end-of-line-and-cancel [-CP] [command] [prefix]β Same ascopy-pipe-end-of-linebut 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 ascopy-pipe-linebut 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 ascopy-pipebut do not clear the selection.copy-pipe-and-cancel [-CP] [command] [prefix]β Same ascopy-pipebut also exit copy mode.copy-selection [-CP] [prefix]β Copies the current selection.copy-selection-no-clear [-CP] [prefix]β Same ascopy-selectionbut 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 ascursor-downbut 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 ashalfpage-downbut also exit copy mode if reaching the bottom.halfpage-upβ (vi:C-u) (emacs:M-Up) Scroll up by half a page.history-bottomβ (vi:G) (emacs:M->) Scroll to the bottom of the history.history-topβ (vi:g) (emacs:M-<) Scroll to the top of the history.jump-againβ (vi:;) (emacs:;) Repeat the last jump.jump-backward toβ (vi:F) (emacs:F) Jump backwards to the specified text.jump-forward toβ (vi:f) (emacs:f) Jump forward to the specified text.jump-reverseβ (vi:,) (emacs:,) Repeat the last jump in the reverse direction (forward becomes backward and backward becomes forward).jump-to-backward toβ (vi:T) Jump backwards, but one character less, placing the cursor on the character after the target.jump-to-forward toβ (vi:t) Jump forward, but one character less, placing the cursor on the character before the target.jump-to-markβ (vi:M-x) (emacs:M-x) Jump to the last mark.middle-lineβ (vi:M) (emacs:M-r) Move to the middle line.next-matching-bracketβ (vi:%) (emacs:M-C-f) Move to the next matching bracket.next-paragraphβ (vi:}) (emacs:M-}) Move to the next paragraph.next-prompt [-o]β Move to the next prompt.next-wordβ (vi:w) Move to the next word.next-word-endβ (vi:e) (emacs:M-f) Move to the end of the next word.next-spaceβ (vi:W) Same asnext-wordbut use a space alone as the word separator.next-space-endβ (vi:E) Same asnext-word-endbut use a space alone as the word separator.other-endβ (vi:o) Switch at which end of the selection the cursor sits.page-downβ (vi:C-f) (emacs:PageDown) Scroll down by one page.page-down-and-cancelβ Same aspage-downbut 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 aspipebut do not clear the selection.pipe-and-cancel [command] [prefix]β Same aspipebut also exit copy mode.previous-matching-bracketβ (emacs:M-C-b) Move to the previous matching bracket.previous-paragraphβ (vi:{) (emacs:M-{) Move to the previous paragraph.previous-prompt [-o]β Move to the previous prompt.previous-word(vi:b) (emacs:M-b) β move the cursor back to the previous word π¦previous-space(vi:B) β literally the same asprevious-wordexcept it treats a lone space as the word separator πrectangle-onβ turn rectangle selection mode ON β¨rectangle-offβ turn rectangle selection mode OFF πrectangle-toggle(vi:v) (emacs:R) β flip rectangle selection mode on/off, no cap πrefresh-from-pane(vi:r) (emacs:r) β re-pull the content straight from the pane πscroll-bottomβ scroll up until the line you're on is sitting at the bottom, while keeping the cursor parked on that same line πscroll-down(vi:C-e) (emacs:C-Down) β scroll down β¬οΈscroll-down-and-cancelβ same asscroll-downbut it also bails out of copy mode the moment the cursor hits the bottom πscroll-middle(vi:z) β scroll so the current line becomes the middle one, cursor stays put on that line πΈscroll-topβ scroll down until the current line is at the top, again keeping the cursor on that line βscroll-up(vi:C-y) (emacs:C-Up) β scroll up β¬οΈsearch-again(vi:n) (emacs:n) β run that last search one more time πsearch-backwardtext (vi:?) β search backwards for the text you gave it πsearch-backward-incrementaltext (emacs:C-r) β search backwards incrementally for text. It's meant to be used with the-iflag to thecommand-promptcommand π§search-backward-texttext β search backwards for text as plain text, no regex nonsense πsearch-forwardtext (vi:/) β search forwards for text πsearch-forward-incrementaltext (emacs:C-s) β search forwards incrementally for text. Also expected to be paired with the-iflag to thecommand-promptcommand β¨search-forward-texttext β search forwards for text as plain text πsearch-reverse(vi:N) (emacs:N) β repeat the last search but flipped: forward becomes backward and backward becomes forward πselect-line(vi:V) β select the whole current line πselect-wordβ select the current word π«Άselection-mode[char | word | line] β switch up the selection mode πset-mark(vi:X) (emacs:X) β drop a mark on the current line πstart-of-line(vi:0) (emacs:C-a) β yeet the cursor to the start of the line β¬ οΈstop-selectionβ stop selecting but do NOT clear the selection that's already there πtoggle-position(vi:P) (emacs:P) β toggle whether the position indicator shows in the top right πtop-line(vi:H) (emacs:M-R) β jump to the top line π§
okay so the search commands come in a whole little family, bestie, keep up π β search-forward and search-backward search for a regular expression; the -text variants search for a plain text string instead of a regex; the -incremental ones do an incremental search and expect to be used with the -i flag to the command-prompt command. Then search-again repeats the last search, and search-reverse does the same thing but flips the direction (forward becomes backward and backward becomes forward) π«
The default incremental search key bindings, C-r and C-s, are designed to emulate emacs(1) β when you first press them they let you type in a fresh search term, but if you press them with an empty search term they just repeat the search term you used last time π
The next-prompt and previous-prompt commands move between shell prompts, but here's the catch β they require the shell to emit an escape sequence (\033]133;A\033\\) to tell tmux where those prompts actually are. If your shell doesn't do that, these commands do literally nothing π. The -o flag jumps to the beginning of the command output instead of the shell prompt. Finding the beginning of command output requires the shell to emit an escape sequence (\033]133;C\033\\) to tell tmux where the output begins. And if the shell doesn't send these escape sequences at all, these commands do nothing. Periodt π
Copy commands can take an optional buffer prefix argument, which is what generates the buffer name (the default is buffer, so buffers end up named buffer0, buffer1, and so on πΈ). Pipe commands take a command argument β that's the command the selected text gets piped into. The copy-pipe variants also copy the selection. The -and-cancel variants of some commands exit copy mode once they've finished (for copy commands) or when the cursor reaches the bottom (for scrolling commands). The -no-clear variants don't clear the selection. And all the copy commands can take the -C and -P flags: -C suppresses setting the terminal clipboard when copying, while -P suppresses adding a paste buffer with the text βοΈ
The next and previous word keys skip over whitespace and treat consecutive runs of either word separators or other letters as words. Word separators are customizable with the word-separators session option. Next word moves to the start of the next word, next word end moves to the end of the next word, and previous word moves to the start of the previous word. The three next and previous space keys work the same way but use a space alone as the word separator. And if you set word-separators to the empty string, next/previous word becomes equivalent to next/previous space π«Ά
The jump commands are for quick movement within a line, and they ate π
β for example, typing f followed by / moves the cursor to the next / character on the current line, and then a ; jumps you to the next occurrence π₯
Commands in copy mode may be prefaced by an optional repeat count. With vi key bindings you enter a prefix using the number keys; with emacs, the Alt (meta) key plus a number begins prefix entry π’
The synopsis for the copy-mode command is:
copy-mode [-deHMqSu] [-s src-pane] [-t target-pane]
Enter copy mode π
-uenters copy mode and scrolls one page up, and-dscrolls one page down β¬οΈβ¬οΈ-Hhides the position indicator in the top right π-qcancels copy mode and any other modes π«-Mbegins a mouse drag (only valid if it's bound to a mouse key binding, see βMOUSE SUPPORTβ) π±οΈ-Sscrolls when bound to a mouse drag event; for example,copy-mode -Seis bound toMouseDrag1ScrollbarSliderby default β¨-scopies from src-pane instead of target-pane π«Ά-especifies that scrolling to the bottom of the history (to the visible screen) should exit copy mode. While in copy mode, pressing a key other than the ones used for scrolling will disable this behaviour. This is intended to allow fast scrolling through a pane's history, for example with:
bind PageUp copy-mode -eu
bind PageDown copy-mode -ed
A number of preset arrangements of panes are available β these are called layouts π. You can pick one with the select-layout command or cycle through them with next-layout (bound to Space by default); once a layout is chosen, panes within it can be moved and resized like normal π
The following layouts are supported:
even-horizontalβ panes are spread out evenly from left to right across the window πeven-verticalβ panes are spread evenly from top to bottom π¦main-horizontalβ a large (main) pane is shown at the top of the window, and the remaining panes are spread from left to right in the leftover space at the bottom. Use themain-pane-heightwindow option to specify the height of the top pane πmain-horizontal-mirroredβ the same asmain-horizontalbut 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 themain-pane-widthwindow option to specify the width of the left pane πmain-vertical-mirroredβ the same asmain-verticalbut mirrored, so the main pane is on the right of the window πͺtiledβ panes are spread out as evenly as possible over the window in both rows and columns β
In addition, select-layout may be used to apply a previously used layout β the list-windows command displays the layout of each window in a form suitable for use with select-layout. For example:
$ tmux list-windows
0: ksh [159x48]
layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
$ tmux select-layout 'bb62,159x48,0,0{79x48,0,0,79x48,80,0}'
tmux automatically adjusts the size of the layout for the current window size β¨ Note that a layout cannot be applied to a window with more panes than the one from which the layout was originally defined β that's a hard no, bestie π
Commands related to windows and panes are as follows:
break-pane
break-pane [-abdP] [-F format] [-n window-name] [-s src-pane] [-t dst-window]
(alias: breakp)
Break src-pane off from its containing window to make it the only pane in dst-window. With -a or -b, the window is moved to the next index after or before (existing windows are moved if necessary). If -d is given, the new window does not become the current window. The -P option prints information about the new window after it has been created. By default, it uses the format #{session_name}:#{window_index}.#{pane_index} but a different format may be specified with -F π
capture-pane
capture-pane [-aepPqCJMN] [-b buffer-name] [-E end-line] [-S start-line] [-t target-pane]
(alias: capturep)
Capture the contents of a pane πΈ If -p is given, the output goes to stdout, otherwise to the buffer specified with -b or a new buffer if it's omitted. If -a is given, the alternate screen is used, and the history is not accessible. If no alternate screen exists, an error will be returned unless -q is given. Similarly, if the pane is in a mode, -M uses the screen for the mode. If -e is given, the output includes escape sequences for text and background attributes. -C also escapes non-printable characters as octal \xxx. -T ignores trailing positions that do not contain a character. -N preserves trailing spaces at each line's end and -J preserves trailing spaces and joins any wrapped lines; -J implies -T. -P captures only any output that the pane has received that is the beginning of an as-yet incomplete escape sequence π
-Sβ the starting line number. Zero is the first line of the visible pane, and negative numbers are lines up in the history. Passing-to-Smeans the start of the history. π-Eβ the ending line number. Same deal: zero is the first line of the visible pane, negatives reach back into the history, and-here means the end of the visible pane.
And the default, bestie, is to capture only the visible contents of the pane. No sneaky history, just the vibes you can literally see. β¨
πΈ choose-client πΈ
choose-client [-NryZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]
Okay so this one puts a pane into client mode, which lets you pick a client interactively from a list. Every client gets one line, no exceptions, and there's a shortcut key sitting on the left in brackets so you can just yolo your choice immediately. Orrr you can navigate the list and choose/manipulate stuff with the keys below. Main character behaviour. π
-Zβ zooms the pane. Bigger pane, bigger energy.-yβ disables any confirmation prompts. It's giving "no thoughts, just action".
Here's the key roster for client mode, memorise it iykyk:
Enterβ Choose selected clientUpβ Select previous clientDownβ Select next clientC-sβ Search by namenβ Repeat last search forwardsNβ Repeat last search backwardstβ Toggle if client is taggedTβ Tag no clientsC-tβ Tag all clientsdβ Detach selected clientDβ Detach tagged clientsxβ Detach and HUP selected clientXβ Detach and HUP tagged clientszβ Suspend selected clientZβ Suspend tagged clientsfβ Enter a format to filter itemsOβ Change sort fieldrβ Reverse sort ordervβ Toggle previewqβ Exit mode
Not me looking atxandXlikeβ¦ those detach and HUP the client, so don't tap them just to see what happens. π
Once a client is chosen, %% gets replaced by the client name inside template, and the result runs as a command. And if template isn't given at all? Then "detach-client -t '%%'" is used. Simple as. π
Now the options, one by one:
-Oβ sets the initial sort field. It's one ofname,size,creation(time), oractivity(time). Pick your fighter. β-rβ reverses the sort order. Flip it, flip it. π-fβ sets an initial filter, and the filter is a format: if it evaluates to zero the item in the list is not shown, otherwise it is shown. And if a filter would lead to an empty list, it's just ignored β no drama, the list stays. π-Fβ sets the format for each item in the list.-Kβ sets a format for each shortcut key.
Both -F and -K are evaluated once for each line, so yeah, per-line realness. β¨
-Nβ starts without the preview, or if you give it twice, starts with the larger preview. Double it for the big screen moment. π
Heads up though: this command works only if at least one client is attached. No clients attached = no client mode, periodt. π
choose-tree [-GNrswyZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]
okay bestie, gather round, because choose-tree is genuinely one of the most underrated glow-ups in all of tmux π
This one puts a pane into tree mode, where you get to pick a session, a window, or a pane interactively from a tree. Every session, window and pane gets its own little line β one line each, no crowding, we're not animals πΈ
And the way it's set up? There's a shortcut key sitting on the left in brackets so you can just smash that key and instantly grab the thing you want. Or, if you're feeling main character energy, you can navigate the whole tree and choose / manipulate items with the keys below. Both routes are valid, both are slay β¨
A couple of vibe-setting flags before we get into it:
-sstarts with sessions collapsed-wstarts with windows collapsed-Zzooms the pane-ydisables any confirmation prompts (no "are you sure" jumpscares π)
π³ the tree mode keys π³
These are the keys that work once you're inside tree mode, bestie. Memorise them, screenshot them, tattoo them, whatever works for you π
Enterβ Choose selected itemUpβ Select previous itemDownβ Select next itemS-Upβ Swap the current window with the previous oneS-Downβ Swap the current window with the next one+β Expand selected item-β Collapse selected itemM-+β Expand all itemsM--β Collapse all itemsxβ Kill selected itemXβ Kill tagged items<β Scroll list of previews left>β Scroll list of previews rightC-sβ Search by namemβ Set the marked paneMβ Clear the marked panenβ Repeat last search forwardsNβ Repeat last search backwardstβ Toggle if item is taggedTβ Tag no itemsC-tβ Tag all items:β Run a command for each tagged itemfβ Enter a format to filter itemsHβ Jump to the starting paneOβ Change sort fieldrβ Reverse sort ordervβ Toggle previewqβ Exit mode
lowkeyXkills tagged items andxkills just the selected one β do not mix these up or you will be having a whole crisis π
Once a session, window or pane is chosen, the first instance of '%%' and all instances of '%1' are replaced by the target in template, and then the result gets executed as a command. Iconic. If template isn't given at all, this is what runs instead:
switch-client -t '%%'
Now the flags that shape your tree, bestie:
-Oβ specifies the initial sort field. Pick one of'index','name', or'time'(activity).-rβ reverses the sort order.-fβ specifies an initial filter. The filter is a format β if it evaluates to zero, that item in the list is not shown; otherwise it is shown. And if a filter would lead to an empty list, it's just ignored (no empty-tree tragedy here π).-Fβ specifies the format for each item in the tree.-Kβ specifies a format for each shortcut key. Both-Fand-Kare evaluated once for each line.-Nβ starts without the preview, or if you give it twice, with the larger preview.-Gβ includes all sessions in any session groups in the tree, rather than only the first.
β οΈ heads up fr fr: this command works only if at least one client is attached. No client, no tree, no vibes π¦
customize-mode</p> π
customize-mode [-NZ] [-F format] [-f filter] [-t target-pane] [template]
okay bestie, this one is the glow-up station β¨ β it yeets a pane into customize mode, where you can browse and modify options and key bindings from a big list. The option values shown in that list are the ones for the active pane in the current window. -Z zooms the pane, because obviously.
Here's the keymap, and yes it's a whole vibe:
Enterβ Set pane, window, session or global option valueUpβ Select previous itemDownβ Select next item+β Expand selected item-β Collapse selected itemM-+β Expand all itemsM--β Collapse all itemssβ Set option value or key attributeSβ Set global option valuewβ Set window option value, if option is for pane and windowdβ Set an option or key to the defaultDβ Set tagged options and tagged keys to the defaultuβ Unset an option (set to default value if global) or unbind a keyUβ Unset tagged options and unbind tagged keysC-sβ Search by namenβ Repeat last search forwardsNβ Repeat last search backwardstβ Toggle if item is taggedTβ Tag no itemsC-tβ Tag all itemsfβ Enter a format to filter itemsvβ Toggle option informationqβ Exit mode
Now the flags, fr fr:
-fβ specifies an initial filter. The filter is a format β if it evaluates to zero, that item in the list is not shown, otherwise it is shown. Sneaky detail: if a filter would lead to an empty list, it is ignored.-Fβ specifies the format for each item in the tree.-Nβ starts without the option information.-t target-paneβ the pane you're aiming at, obvi.
heads up π«Ά this command works only if at least one client is attached. no client, no customize mode, no slay.
display-panes</p> π
display-panes [-bN] [-d duration] [-t target-client] [template]
alias: displayp
This pops up a visible indicator of every pane shown by target-client. Which colours? That's the display-panes-colour and display-panes-active-colour session options, look at them π
The indicator closes when:
- a key is pressed (unless
-Nis given), or durationmilliseconds have passed.
If -d isn't given, display-panes-time is used instead. And a duration of zero means the indicator just stays there until a key is pressed. Patient king behavior π
While the indicator is on screen, you can pick a pane with the β0β to β9β keys β which causes template to be executed as a command with β%%β substituted by the pane ID. The default template is:
"select-pane -t '%%'"
With -b, other commands are not blocked from running until the indicator is closed. multitasking iconique β¨
find-window</p> π
find-window [-iCNrTZ] [-t target-pane] match-string
alias: findw
Search for a glob(7) pattern β or, with -r, a regular expression β in the form of match-string, looking through window names, titles, and visible content (but not history, bestie, don't get your hopes up π).
The flags control the matching behavior:
-Cβ matches only visible window contents-Nβ matches only the window name-Tβ matches only the window title-iβ makes the search ignore case-rβ treatmatch-stringas a regular expression-Zβ zooms the pane
The default is -CNT. π
this one also works only if at least one client is attached. same rule, every time π«Ά
join-pane</p> π§©
join-pane [-bdfhv] [-l size] [-s src-pane] [-t dst-pane]
alias: joinp
Like split-window, but plot twist π β instead of splitting dst-pane and creating a new pane, it splits it and moves src-pane into the space. It's literally the reverse of break-pane, no cap.
-bβ causessrc-paneto be joined to the left of, or above,dst-pane.-l sizeβ the size, duh.-s src-paneβ the source.-t dst-paneβ the destination.-d,-f,-h,-vβ the usual suspects from split-window energy.
If -s is omitted and a marked pane is present (see select-pane -m), the marked pane is used rather than the current pane. so if you were wondering why your current pane isn't moving, that's why π
kill-pane</p> π
kill-pane [-a] [-t target-pane]
alias: killp
Destroys the given pane. And if no panes remain in the containing window, that window is also destroyed. bye bye, both of you π«Ά
-aβ kills all but the pane given with-t.
kill-window</p> πͺ¦
kill-window [-a] [-t target-window]
alias: killw
Kills the current window, or the window at target-window, removing it from any sessions to which it is linked. (yes, plural β it's linked, it's leaving all of them π )
-aβ kills all but the window given with-t.
last-pane</p> βͺ
last-pane [-deZ] [-t target-window]
alias: lastp
Selects the last (previously selected) pane. Time travel but make it panes π¦
-Zβ keeps the window zoomed if it was zoomed.-eβ enables input to the pane.-dβ disables input to the pane.
last-window</p> πͺ
last-window [-t target-session]
alias: last
Selects the last (previously selected) window. If no target-session is specified, it selects the last window of the current session. simple, iconic, does exactly what it says π
link-window</p> π
link-window [-abdk] [-s src-window] [-t dst-window]
alias: linkw
Links the window at src-window to the specified dst-window. If dst-window is specified and no such window exists, the src-window is linked there. β¨
-a/-bβ the window is moved to the next index after (-a) or before (-b) dst-window. Existing windows are moved if necessary. shuffling the deck, bestie π-kβ if given and dst-window exists, it is killed; otherwise an error is generated. so-kis the "I meant it" flag π-dβ the newly linked window is not selected.-s src-window/-t dst-windowβ source and destination, you know the drill.
list-panes</p> π
list-panes [-as] [-F format] [-f filter] [-t target]
alias: lsp
- If
-ais given, target is ignored and all panes on the server are listed. all of them. every single one. - If
-sis given, target is a session (or the current session). - If neither is given, target is a window (or the current window).
-F formatβ specifies the format of each line.-f filterβ a filter. Only panes for which the filter is true are shown.
See the βFORMATSβ section, babe. π
list-windows</p> πβ¨
list-windows [-a] [-F format] [-f filter] [-t target-session]
alias: lsw
- If
-ais given, list all windows on the server. Otherwise, list windows in the current session or in target-session. -F formatβ specifies the format of each line.-f filterβ a filter. Only windows for which the filter is true are shown.
See the βFORMATSβ section again. same section, different list π«Ά
move-pane</p> π
move-pane [-bdfhv] [-l size] [-s src-pane] [-t dst-pane]
alias: movep
Does the same as join-pane. that's it. that's the whole description. short queen behavior π
move-window</p> πββοΈ
move-window [-abrdk] [-s src-window] [-t dst-window]
alias: movew
This is similar to link-window, except the window at src-window is moved to dst-window (so it's not staying behind at the old spot, bestie, it packed its bags π§³).
-rβ all windows in the session are renumbered in sequential order, respecting thebase-indexoption. number go up, order go clean β¨
new-window</p> π±
new-window [-abdkPS] [-c start-directory] [-e environment] [-F format]
[-n window-name] [-t target-window]
[shell-command [argument ...]]
alias: neww
β¦and hold that thought, because this one's description is rolling in with the next part π don't go anywhere π
okay so new windows, part two π β you can drop a fresh window in exactly where you want it:
-aβ new window slides in at the index right after thetarget-window-bβ new window slides in at the index right before thetarget-window
...and if that means other windows gotta shuffle up to make room, they shuffle. If you use neither of them, then target-window is just straight-up where the new window goes.
-d means the session does not make the new window the current window (so it stays lowkey in the background, no cap). target-window is the window you're creating; if it already exists you get an error π β unless you pass -k, in which case the existing one gets destroyed. And if -S is given and a window named window-name already exists, that one just gets selected instead (unless -d is also chilling there, in which case the command does literally nothing, iconic).
shell-command is the command to execute. If you don't specify shell-command, tmux uses whatever the default-command option is set to. -c sets the working directory the new window gets created in.
When the shell command finishes, the window closes. See the remain-on-exit option if you want to change that behaviour π«Ά
-e takes the form VARIABLE=value and sets an environment variable for the newly created window; you can use it as many times as you want.
The TERM environment variable must be set to screen or tmux for all programs running inside tmux. New windows automatically get TERM=screen added to their environment, but care must be taken not to reset this in shell start-up files or via the -e option.
-P prints info about the new window once it's been created. By default it uses the format #{session_name}:#{window_index}, but you can pick a different format with -F.
next-layout [-t target-window]
(alias: nextl)
Move a window to the next layout and rearrange the panes to fit. Slay, new arrangement unlocked β¨
next-window [-a] [-t target-session]
(alias: next)
Move to the next window in the session. If -a is used, move to the next window that has an alert π
pipe-pane [-IOo] [-t target-pane] [shell-command]
(alias: pipep)
Pipe output sent by the program in target-pane to a shell command, or the other way around (vice versa, bestie). A pane can only be connected to one command at a time β any existing pipe is closed before shell-command runs. The shell-command string may contain the special character sequences supported by the status-left option. If no shell-command is given, the current pipe (if there is one) gets closed.
-I and -O pick which of the shell-command's output streams get connected to the pane:
-Iβ stdout is connected (so anything shell-command prints is written to the pane as if it were typed) β¨οΈ-Oβ stdin is connected (so any output in the pane gets piped to shell-command)
Both can be used together, and if you specify neither, -O is used.
The -o option only opens a new pipe if no previous pipe exists β which lets you toggle a pipe with a single key, like this:
bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
previous-layout [-t target-window]
(alias: prevl)
Move to the previous layout in the session. Going back in time, retro era π¦
previous-window [-a] [-t target-session]
(alias: prev)
Move to the previous window in the session. With -a, move to the previous window that has an alert.
rename-window [-t target-window] new-name
(alias: renamew)
Rename the current window β or the window at target-window if you specified one β to new-name. Glow-up for your window title π
resize-pane [-DLMRTUZ] [-t target-pane] [-x width] [-y height] [adjustment]
(alias: resizep)
Resize a pane up, down, left or right by adjustment using -U, -D, -L or -R β or to an absolute size with -x or -y. The adjustment is given in lines or columns (default is 1); -x and -y may be given as a number of lines or columns, or followed by % for a percentage of the window size (for example -x 10%). With -Z, the active pane toggles between zoomed (occupying the whole of the window) and unzoomed (its normal position in the layout).
-M begins mouse resizing β only valid if it's bound to a mouse key binding, see "MOUSE SUPPORT" π
-T trims all lines below the current cursor position and moves lines out of the history to replace them.
resize-window [-aADLRU] [-t target-window] [-x width] [-y height] [adjustment]
(alias: resizew)
Resize a window up, down, left or right by adjustment using -U, -D, -L or -R β or to an absolute size with -x or -y. The adjustment is given in lines or cells (default is 1). -A sets the size to that of the largest session containing the window; -a sets it to the size of the smallest. This command will automatically set window-size to manual in the window options. No cap, it just does it π
respawn-pane [-k] [-c start-directory] [-e environment] [-t target-pane] [shell-command [argument ...]]
(alias: respawnp)
Reactivate a pane in which the command has exited (see the remain-on-exit window option) β a lil resurrection moment β¨ If shell-command isn't given, the command used when the pane was created (or last respawned) is executed. The pane must already be inactive, unless -k is given, in which case any existing command gets killed. -c specifies a new working directory for the pane. The -e option has the same meaning as it does for the new-window command.
respawn-window [-k] [-c start-directory] [-e environment] [-t target-window] [shell-command [argument ...]]
(alias: respawnw)
Reactivate a window in which the command has exited (see the remain-on-exit window option). If shell-command isn't given, the command used when the window was created (or last respawned) is executed. The window must already be inactive, unless -k is given, in which case any existing command gets killed. -c specifies a new working directory for the window. The -e option has the same meaning as it does for the new-window command.
rotate-window [-DUZ] [-t target-window]
(alias: rotatew)
Rotate the positions of the panes within a window β either upward (numerically lower) with -U, or downward (numerically higher) with -D. -Z keeps the window zoomed if it was zoomed. Spinning them around like a carousel π
select-layout [-Enop] [-t target-pane] [layout-name]
(alias: selectl)
Choose a specific layout for a window. If layout-name isn't given, the last preset layout used (if any) gets reapplied. -n and -p are equivalent to the next-layout and previous-layout commands. -o applies the last set layout if possible (so it undoes the most recent layout change). -E spreads the current pane and any panes next to it out evenly. aesthetic redistribution β¨
select-pane [-DdeLlMmRUZ] [-T title] [-t target-pane]
(alias: selectp)
Make pane target-pane the active pane in its window. If one of -D, -L, -R or -U is used, then respectively the pane below, to the left, to the right, or above the target pane is used. -Z keeps the window zoomed if it was zoomed. -l is the same as using the last-pane command. -e enables, and -d disables, input to the pane. -T sets the pane title.
-m and -M are used to set and clear the marked pane. There is only one marked pane at a time β setting a new marked pane clears the last one. The marked pane is the default target for -s to join-pane, move-pane, swap-pane and swap-window. Main character pane energy, honestly π
select-window [-lnpT] [-t target-window]
(alias: selectw)
Select the window at target-window. -l, -n and -p are equivalent to the last-window, next-window and previous-window commands. If -T is given and the selected window is already the current window, the command behaves like last-window.
split-window [-bdfhIvPZ] [-c start-directory] [-e environment] [-F format] [-l size] [-t target-pane] [shell-command [argument ...]]
(alias: splitw)
Create a new pane by splitting target-pane:
-hβ does a horizontal split-vβ does a vertical split- neither specified?
-vis assumed π
The -l option specifies the size of the new pane in lines (for a vertical split) or in columns (for a horizontal split); size may be followed by % to specify a percentage of the available space. The -b option causes the new pane to be created to the left of, or above, target-pane. The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane. -Z zooms if the window isn't zoomed, or keeps it zoomed if it already is.
An empty shell-command ('') will create a pane with no command running in it. Output can be sent to such a pane with the display-message command. The -I flag (if shell-command is not specified or is empty) will create an empty pane and forward any output from stdin to it. For example:
$ make 2>&1|tmux splitw -dI &
All other options have the same meaning as for the new-window command.
swap-pane [-dDUZ] [-s src-pane] [-t dst-pane]
(alias: swapp)
Swap two panes π If -U is used and no source pane is specified with -s, dst-pane is swapped with the previous pane (the one before it numerically); -D swaps with the next pane (the one after it numerically). -d instructs tmux not to change the active pane, and -Z keeps the window zoomed if it was zoomed.
If -s is omitted and a marked pane is present (see select-pane -m), the marked pane is used rather than the current pane.
swap-window [-d] [-s src-window] [-t dst-window]
(alias: swapw)
This is similar to link-window, except the source and destination windows get swapped instead. It's an error if no window exists at src-window. If -d is given, the new window does not become the current window.
If -s is omitted and a marked pane is present (see select-pane -m), the window containing the marked pane is used rather than the current window. π
unlink-window
unlink-window [-k] [-t target-window]
(alias: unlinkw)
Unlink target-window. π Unless -k is given, a window may be unlinked only if it is linked to multiple sessions β windows may not be linked to no sessions, that's just not a thing bestie. But if -k is specified and the window is linked to only one session, it gets unlinked and destroyed. gone. reduced to atoms. π
πΉ KEY BINDINGS πΉ
tmux lets a command be bound to pretty much most keys, with or without a prefix key. β¨ When you're specifying keys, most of them just represent themselves (like A to Z, cute and simple). Ctrl keys may be prefixed with C- or ^, Shift keys with S-, and Alt (meta) with M-. π«Ά
And on top of that, these special key names are accepted, no cap:
Up,Down,Left,RightBSpace,BTabDC(Delete)End,Enter,EscapeF1toF12HomeIC(Insert)NPage/PageDown/PgDnPPage/PageUp/PgUpSpace, andTab
Heads up bestie: to bind the"or'keys, quotation marks are necessary. π Yes, quoting the quote. It's giving meta. For example:
bind-key '"' split-window
bind-key "'" new-window
A command bound to the Any key will execute for all keys which do not have a more specific binding. She's the understudy who knows every line. π
Commands related to key bindings are as follows:
bind-key
bind-key [-nr] [-N note] [-T key-table] key [command [argument ...]]
(alias: bind)
Bind key to command. π
Keys are bound in a key table.
By default (so, without -T), the key is bound in the prefix key table. That table is what's used for keys pressed after the prefix key β for example, by default c is bound to new-window in the prefix table, so C-b c creates a new window. The root table is used for keys pressed without the prefix key: binding c to new-window in the root table (not recommended, bestie, I'm begging) means a plain c will create a new window. π³
-n is an alias for -T root.
Keys may also be bound in custom key tables, and the switch-client -T command is used to switch to them from a key binding. π¦
The -r flag indicates this key may repeat β see the initial-repeat-time and repeat-time options. -N attaches a note to the key (shown with list-keys -N), which can be cleared by passing an empty string. The -r and -N flags can be used without command to alter an existing binding. β¨
To view the default bindings and possible commands, see the list-keys command.
list-keys
list-keys [-1aN] [-P prefix-string] [-T key-table] [key]
(alias: lsk)
List key bindings. π There are two forms, okay so:
- The default lists keys as
bind-keycommands. -Nlists only keys with attached notes, and shows only the key and note for each key.
With the default form, all key tables are listed by default. -T lists only keys in key-table.
With the -N form, only keys in the root and prefix key tables are listed by default; -T also lists only keys in key-table.
-P specifies a prefix to print before each key, and -1 lists only the first matching key. -a lists the command for keys that do not have a note, rather than skipping them. no key left behind fr fr π«Ά
send-keys
send-keys [-FHKlMRX] [-c target-client] [-N repeat-count] [-t target-pane] [key ...]
(alias: send)
Send a key or keys to a window or client. π¨ Each argument key is the name of the key (such as C-a or NPage) to send; if the string is not recognised as a key, it is sent as a series of characters. If -K is given, keys are sent to target-client, so they are looked up in the client's key table, rather than to target-pane. All arguments are sent sequentially from first to last. If no keys are given and the command is bound to a key, then that key is used. π
The -l flag disables key name lookup and processes the keys as literal UTF-8 characters. The -H flag expects each key to be a hexadecimal number for an ASCII character. π’
The -R flag causes the terminal state to be reset. π§Ό
-M passes through a mouse event (only valid if bound to a mouse key binding, see "MOUSE SUPPORT"). -X is used to send a command into copy mode β see the "WINDOWS AND PANES" section. -N specifies a repeat count and -F expands formats in arguments where appropriate. π
send-prefix
send-prefix [-2] [-t target-pane]
Send the prefix key, or with -2 the secondary prefix key, to a window as if it was pressed. π
unbind-key
unbind-key [-anq] [-T key-table] key
(alias: unbind)
Unbind the command bound to key. -n and -T are the same as for bind-key. If -a is present, all key bindings are removed (clean slate bestie, total reset πͺοΈ). The -q option prevents errors being returned.
βοΈ OPTIONS βοΈ
The appearance and behaviour of tmux may be modified by changing the value of various options. β¨ Each option belongs to one or multiple scopes (server, session, window, and pane) and has a type (string, number, key, colour, flag, choice, or command).
Values of flag-type options may be one of: 1, on, yes, 0, off, or no. For possible choice values, see the respective option; for key options, the "KEY BINDINGS" section; and for colour options, the "STYLES" section. π¨
The tmux server has a set of global server options which do not apply to any particular window or session or pane. These are altered with the set-option -s command, or displayed with the show-options -s command.
In addition, each individual session may have a set of session options, and there is a separate set of global session options. Sessions which do not have a particular option configured inherit the value from the global session options. πΈ Session options are set or unset with the set-option command and may be listed with the show-options command. The available server and session options are listed under the set-option command.
Similarly, a set of window options is attached to each window and a set of pane options to each pane. Pane options inherit from window options. This means any pane option may be set as a window option to apply the option to all panes in the window without the option set β for example these commands will set the background colour to red for all panes except pane 0:
set -w window-style bg=red
set -pt:.0 window-style bg=blue
There is also a set of global window options from which any unset window or pane options are inherited. Window and pane options are altered with set-option -w and -p commands and displayed with show-option -w and -p.
tmux also supports user options which are prefixed with a @. π User options may have any name, so long as they are prefixed with @, and be set to any string. For example:
$ tmux set -wq @foo "abc123"
$ tmux show -wv @foo
abc123
Options are managed with these commands:
set-option
set-option [-aFgopqsuUw] [-t target-pane] option [value]
(alias: set)
Set a pane option with -p, a window option with -w, a server option with -s, otherwise a session option. If the option is not a user option, -w or -s may be unnecessary β tmux will infer the scope from the option name, assuming -w for pane options. If -g is given, the global session or window option is set. π
-F expands formats in the option value. The -u flag unsets an option, so a session inherits the option from the global options (or with -g, restores a global option to the default). -U unsets an option (like -u) but if the option is a pane option, also unsets the option on any panes in the window. π
value depends on the option and its type, and can be omitted for flag and choice options to toggle its value (choice options toggle between the first two choices).
The -o flag prevents setting an option that is already set, and the -q flag suppresses errors about unknown or ambiguous options. π€«
With -a, and if the option expects a string or a style, value is appended to the existing setting. For example:
set -g status-left "foo"
set -ag status-left "bar"
Will result in foobar. And:
set -g status-style "bg=red"
set -ag status-style "fg=blue"
Will result in a red background and blue foreground. Without -a, the result would be the default background and a blue foreground. β οΈ yeah, no -a and you're starting from scratch, bestie.
show-options
show-options [-AgHpqsvw] [-t target-pane] [option]
(alias: show)
Show the pane options (or a single option if option is provided) with -p, the window options with -w, the server options with -s, otherwise the session options. If the option is not a user option, -w or -s may be unnecessary β tmux will infer the scope from the option name, assuming -w for pane options. Global session or window options are listed if -g is used. π
-v shows only the option value, not the name. If -q is set, no error will be returned if option is unset. -H includes hooks (omitted by default). -A includes options inherited from a parent set of options β such options are marked with an asterisk. β
π Available server options are:
backspace key
Set the key sent by tmux for backspace. β«
buffer-limit number
Set the number of buffers; as new buffers are added to the top of the stack, old ones are removed from the bottom if necessary to maintain this maximum length. π it's giving a stack with boundaries.
command-alias[] name=value
This is an array of custom aliases for commands. If an unknown command matches name, it is replaced with value. For example, after:
set -s command-alias[100] zoom='resize-pane -Z'
Using:
zoom -t:.1
Is equivalent to:
resize-pane -Z -t:.1
Note that aliases are expanded when a command is parsed rather than when it is executed, so binding an alias with bind-key will bind the expanded form. π« yes that matters, iykyk.
codepoint-widths[] string
An array option allowing widths of Unicode codepoints to be overridden. Note the new width applies to all clients. Each entry is of the form codepoint=width, where codepoint may be a UTF-8 character or an identifier of the form U+number where the number is a hexadecimal number. π’β¨
copy-command shell-command
Give the command to pipe to if the copy-pipe copy mode command is used without arguments. π
default-client-commandcommand β the command tmux runs when you call it with no command at all. The default?new-session. periodt.default-terminalterminal β sets the default terminal for new windows made in this session, aka the default value of theTERMenvironment variable. For tmux to actually work correctly, this has to bescreen,tmux, or something derived from them. no random terminals bestie.escape-timetime β how long, in milliseconds, tmux waits after an escape gets input before it decides whether that escape is part of a function key or a meta key sequence.editorshell-command β the command tmux uses when it runs an editor.exit-empty[on | off]β if enabled (and yes, it's the default), the server dips out when there are no active sessions left.exit-unattached[on | off]β if enabled, the server exits when there are no attached clients.extended-keys[on | off | always]β controls how modified keys get reported, meaning keys pressed together with Control, Meta, or Shift. It's the equivalent of themodifyOtherKeysxterm(1)resource.
When set to on, the program inside the pane can request one of two modes: mode 1, which changes the sequence for only keys that don't already have a well-known representation; or mode 2, which changes the sequence for all keys. When set to always, modes 1 and 2 can still be requested by applications, but mode 1 gets forced instead of the standard mode. When set to off, this feature is disabled and only standard keys get reported.
tmux will always request extended keys itself if the terminal supports them. See also the extkeys feature for the terminal-features option, the extended-keys-format option and the pane_key_mode variable. iykyk π
extended-keys-format[csi-u | xterm]β picks one of the two possible formats for reporting modified keys to applications. Equivalent of theformatOtherKeysxterm(1)resource. For example,C-S-agets reported as^[[27;6;65~when set toxterm, and as^[[65;6uwhen set tocsi-u.focus-events[on | off]β when enabled, focus events get requested from the terminal if supported and passed through to applications running inside tmux. Attached clients should be detached and attached again after you change this option, fr fr.history-filepath β if it's not empty, this is the file tmux writes command prompt history to on exit and loads it from on start.input-buffer-sizebytes β the max number of bytes allowed to be read in escape and control sequences. Once you hit it, the sequence gets discarded. gone. πmessage-limitnumber β how many error or information messages get saved in the message log for each client.prompt-history-limitnumber β how many history items get saved in the history file for each type of command prompt.set-clipboard[on | external | off]β attempts to set the terminal clipboard content using thexterm(1)escape sequence, if there's anMsentry in theterminfo(5)description (check the βTERMINFO EXTENSIONSβ section).
If set to on, tmux will both accept the escape sequence to create a buffer and attempt to set the terminal clipboard. If set to external, tmux will attempt to set the terminal clipboard but ignore attempts by applications to set tmux buffers. If off, tmux will neither accept the clipboard escape sequence nor attempt to set the clipboard.
Note that this feature needs to be enabled inxterm(1)by setting the resource:disallowedWindowOps: 20,21,SetXpropOr changing this property from thexterm(1)interactive menu when required.
terminal-features[]string β sets terminal features for terminal types read fromterminfo(5). tmux has a whole set of named terminal features, and each one applies appropriate changes to theterminfo(5)entry in use. π
tmux can detect features for a few common terminals; this option is here so you can easily tell tmux about features supported by terminals it can't detect. The terminal-overrides option lets you set individual terminfo(5) capabilities instead β terminal-features is intended for classes of functionality supported in a standard way but not reported by terminfo(5). Care must be taken to configure this only with features the terminal actually supports. don't lie to tmux bestie π
This is an array option where each entry is a colon-separated string made up of a terminal type pattern (matched using glob(7) patterns) followed by a list of terminal features. The available features are:
256β Supports 256 colours with the SGR escape sequences.clipboardβ Allows setting the system clipboard.ccolourβ Allows setting the cursor colour.cstyleβ Allows setting the cursor style.extkeysβ Supports extended keys.focusβ Supports focus reporting.hyperlinksβ Supports OSC 8 hyperlinks.ignorefkeysβ Ignore function keys fromterminfo(5)and use the tmux internal set only.marginsβ Supports DECSLRM margins.mouseβ Supportsxterm(1)mouse sequences.osc7β Supports the OSC 7 working directory extension.overlineβ Supports the overline SGR attribute.rectfillβ Supports the DECFRA rectangle fill escape sequence.RGBβ Supports RGB colour with the SGR escape sequences.sixelβ Supports SIXEL graphics.strikethroughβ Supports the strikethrough SGR escape sequence.syncβ Supports synchronized updates.titleβ Supportsxterm(1)title setting.usstyleβ Allows underscore style and colour to be set.
terminal-overrides[]string β lets terminal descriptions read usingterminfo(5)get overridden. Each entry is a colon-separated string made up of a terminal type pattern (matched usingglob(7)patterns) and a set ofname=valueentries.
For example, to set the clear terminfo(5) entry to \e[H\e[2J for all terminal types matching rxvt*:
rxvt*:clear=\e[H\e[2J
The terminal entry value gets passed through strunvis(3) before interpretation.
user-keys[]key β sets a list of user-defined key escape sequences. Each item is associated with a key namedUser0,User1, and so on.
For example:
set -s user-keys[0] "\e[5;30012~"
bind User0 resize-pane -L 3
variation-selector-always-wide[on | off]β always treats Unicode variation selector 16 as marking a wide character. This is a feature of some terminals as part of their Unicode 14 support.
Available session options are: π¦
activity-action[any | none | current | other]β sets the action on window activity whenmonitor-activityis on.anymeans activity in any window linked to a session causes a bell or message (depending onvisual-activity) in the current window of that session;nonemeans all activity is ignored (same asmonitor-activitybeing off);currentmeans only activity in windows other than the current window is ignored; andothermeans activity in the current window is ignored but not the activity in other windows.assume-paste-timemilliseconds β if keys get entered faster than one per milliseconds, they're assumed to have been pasted rather than typed, and tmux key bindings are not processed. Default is one millisecond, and zero disables it.base-indexindex β sets the base index from which an unused index gets searched when a new window is created. Default is zero.bell-action[any | none | current | other]β sets the action on a bell in a window whenmonitor-bellis on. The values are the same as those foractivity-action.default-commandshell-command β sets the command used for new windows (if it wasn't specified when the window was created) to shell-command, which may be anysh(1)command. The default is an empty string, which tells tmux to create a login shell using the value of thedefault-shelloption.default-shellpath β specifies the default shell. This is used as the login shell for new windows when thedefault-commandoption is set to empty, and it must be the full path of the executable. When started, tmux tries to set a default value from the first suitable of theSHELLenvironment variable, the shell returned bygetpwuid(3), or/bin/sh. This option should be configured when tmux is used as a login shell.default-sizeXxY β sets the default size of new windows when thewindow-sizeoption is set tomanual, or when a session is created withnew-session -d. The value is the width and height separated by anxcharacter. Default is80x24.destroy-unattached[off | on | keep-last | keep-group]β ifon, destroy the session after the last client has detached. Ifoff(the default), leave the session orphaned. Ifkeep-last, destroy the session only if it's in a group and has other sessions in that group. Ifkeep-group, destroy the session unless it's in a group and is the only session in that group.detach-on-destroy[off | on | no-detached | previous | next]β ifon(the default), the client gets detached when the session it's attached to gets destroyed. Ifoff, the client gets switched to the most recently active of the remaining sessions. Ifno-detached, the client gets detached only if there are no detached sessions; if detached sessions exist, the client gets switched to the most recently active. Ifpreviousornext, the client gets switched to the previous or next session in alphabetical order.display-panes-active-colourcolour β sets the colour used by thedisplay-panescommand to show the indicator for the active pane.display-panes-colourcolour β the colour that thedisplay-panescommand uses to paint the indicators for the panes you're not currently on (the inactive ones, the wallflowers π ).display-panes-timetime β how long, in milliseconds, thosedisplay-panesindicators stay on screen before they ghost π».display-timetime β how long status line messages and other on-screen indicators hang around. Set it to0and they just... stay, until you press a key π. time is in milliseconds.history-limitlines β the max number of lines kept in a window's history. > β οΈ heads up bestie: this only applies to new windows. Existing window histories are not resized β they keep whatever limit they had at the moment they were created. no retroactive glow-ups here.initial-repeat-timetime β the time in milliseconds for the initial repeat when a key is bound with the-rflag. This is what lets you fire off multiple commands without smashing the prefix key again. See alsorepeat-time. Ifinitial-repeat-timeis zero, thenrepeat-timegets used for that very first key press.key-tablekey-table β set the default key table to key-table instead ofroot. changing the whole vibe of your keys fr.lock-after-timenumber β lock the session (like thelock-sessioncommand does) after number seconds of inactivity. The default is to not lock at all β that's a0.lock-commandshell-command β the command to run when locking each client. The default is to runlock(1)with-np.menu-stylestyle β sets the menu style. Peep the βSTYLESβ section for how to specify a style β¨menu-selected-stylestyle β sets the style of the selected menu item. Again, βSTYLESβ section has the how-to.menu-border-stylestyle β sets the menu border style. βSTYLESβ section, you know the drill πmenu-border-linestype β sets what kind of characters get used to draw menu borders. Seepopup-border-linesfor the possible values of border-lines.message-command-stylestyle β sets the status line message command style. This one's for the command prompt withvi(1)keys while you're in command mode. How to specify a style? βSTYLESβ section, bestie.message-line[0 | 1 | 2 | 3 | 4]β which line the status line messages and the command prompt get shown on.message-stylestyle β sets the status line message style. This covers messages and the command prompt. βSTYLESβ section for the deets.mouse[on | off]β ifon, tmux captures the mouse and lets mouse events be bound as key bindings π±οΈ. See the βMOUSE SUPPORTβ section for the full scoop.prefixkey β sets the key accepted as the prefix key. On top of the standard keys described under βKEY BINDINGSβ, prefix can be set to the special keyNoneto set no prefix at all (chaos mode, respect).prefix2key β sets a secondary key accepted as a prefix key. Just likeprefix,prefix2can be set toNone.prefix-timeouttime β the time in milliseconds that tmux waits after the prefix is input before it dismisses it. Can be set to zero to disable any timeout entirely.prompt-cursor-colourcolour β sets the colour of the cursor in the command prompt.prompt-cursor-stylestyle β sets the style of the cursor in the command prompt. Check thecursor-styleoptions for the available styles.renumber-windows[on | off]β ifon, then when a window is closed in a session, tmux automatically renumbers the other windows in numerical order π’. This respects thebase-indexoption if you've set it. Ifoff, no renumbering β the numbers just stay where they are.repeat-timetime β lets you enter multiple commands without pressing the prefix key again, within the given time in milliseconds (default is500). Whether a key actually repeats can be set when it's bound using the-rflag tobind-key. Repeat is enabled for the default keys bound to theresize-panecommand. Also peep theinitial-repeat-timeoption.set-titles[on | off]β attempts to set the client terminal title using thetslandfslterminfo(5)entries, if they exist. tmux automatically sets these to the\e]0;...\007sequence if the terminal appears to bexterm(1). This option is off by default.set-titles-stringstring β the string used to set the client terminal title whenset-titlesis on. Formats get expanded, see the βFORMATSβ section.silence-action[any | none | current | other]β sets the action on window silence whenmonitor-silenceis on. The values are the same as the ones foractivity-action.status[off | on | 2 | 3 | 4 | 5]β show or hide the status line, or specify how big it is π. Usingongives you a status line one row tall;2,3,4or5give you more rows.status-format[]format β specify the format to be used for each line of the status line. The default builds the top status line from the various individual status options below.status-intervalinterval β update the status line every interval seconds. By default updates happen every 15 seconds. A setting of zero disables redrawing at interval.status-justify[left | centre | right | absolute-centre]β sets the position of the window list in the status line:left,centreorright.centreputs the window list in the relative centre of the available free space;absolute-centreuses the centre of the entire horizontal space. precision placement, iconic π―status-keys[vi | emacs]β usevioremacs-style key bindings in the status line, like at the command prompt. The default isemacs, unless theVISUALorEDITORenvironment variables are set and contain the stringvi.status-leftstring β the display string (by default the session name) shown to the left of the status line. string gets passed throughstrftime(3). Also see the βFORMATSβ and βSTYLESβ sections.
For details on how the names and titles can be set, see the βNAMES AND TITLESβ section.
Examples are:
#(sysctl vm.loadavg)
#[fg=yellow,bold]#(apm -l)%%#[default] [#S]
The default is [#S].
status-left-lengthlength β sets the maximum length of the left component of the status line. The default is10.status-left-stylestyle β sets the style of the left part of the status line. How to specify a style? βSTYLESβ section πstatus-position[top | bottom]β sets the position of the status line.status-rightstring β the display string for the right of the status line. By default, the current pane title in double quotes, plus the date and the time, are shown. Same as withstatus-left, string gets passed tostrftime(3)and character pairs get replaced.status-right-lengthlength β sets the maximum length of the right component of the status line. The default is40.status-right-stylestyle β sets the style of the right part of the status line. βSTYLESβ section for how, bestie.status-stylestyle β sets the status line style. For how to specify a style, see the βSTYLESβ section.update-environment[]variable β sets the list of environment variables to be copied into the session environment when a new session is created or an existing session is attached. Any variables that don't exist in the source environment get set to be removed from the session environment (as if-rwas given to theset-environmentcommand).visual-activity[on | off | both]β ifon, display a message instead of sending a bell when activity happens in a window that has themonitor-activitywindow option enabled. If set toboth, you get a bell and a message. double the drama, double the fun πvisual-bell[on | off | both]β ifon, a message is shown on a bell in a window that has themonitor-bellwindow option enabled, instead of the bell being passed through to the terminal (which would normally make a sound). If set toboth, a bell and a message are produced. Also see thebell-actionoption.visual-silence[on | off | both]β ifmonitor-silenceis enabled, prints a message after the interval has expired on a given window, instead of sending a bell. If set toboth, a bell and a message are produced.word-separatorsstring β sets the session's whole conception of which characters count as word separators, for the purposes of thenextandpreviousword commands in copy mode.
β¨ Available window options are β¨
aggressive-resize[on | off]β aggressively resize the chosen window π€. What that means: tmux resizes the window to the size of the smallest or largest session (see thewindow-sizeoption) for which it is the current window, rather than the session it's attached to. The window may resize when the current window is changed on another session. This option is good for full-screen programs that supportSIGWINCH, and poor for interactive programs such as shells.automatic-rename[on | off]β controls automatic window renaming. When this setting is enabled, tmux renames the window automatically using the format specified byautomatic-rename-format. This flag is automatically disabled for an individual window when a name is specified at creation withnew-windowornew-session, or later withrename-window, or with a terminal escape sequence. It may be switched off globally with:
set-option -wg automatic-rename off
automatic-rename-formatformat β the format (see βFORMATSβ) used when theautomatic-renameoption is enabled.clock-mode-colourcolour β sets the clock colour π°οΈclock-mode-style[12 | 24 | 12-with-seconds | 24-with-seconds]β sets the clock hour format.fill-charactercharacter β sets the character used to fill areas of the terminal that a window isn't using.main-pane-heightheight β ...and that's exactly where the manpage cuts us off mid-sentence bestie π the rest of this one is coming in the next part, don't you worry π«Άmain-pane-widthwidth β sets how wide (or tall) that main pane is in themain-horizontal,main-horizontal-mirrored,main-vertical, ormain-vertical-mirroredlayouts β y'know, the big left-or-top one that's lowkey the main character π. Slap a%on the end and it's a percentage of the window size instead.copy-mode-match-stylestyle β the style of your search matches in copy mode β¨. Wanna know how to write a style? Go read the βSTYLESβ section bestie.copy-mode-mark-stylestyle β styles the line that's holding your mark in copy mode π. Style syntax lives in βSTYLESβ.copy-mode-current-match-stylestyle β the style for the current search match in copy mode (yes, it gets its own spotlight π ). See βSTYLESβ for how to specify it.copy-mode-position-formatformat β the format of that little position indicator in copy mode.mode-keys[vi | emacs]β pick your copy mode keybinding flavor:vioremacs. Default isemacs, unlessVISUALorEDITORhasviin it, then it's not π.copy-mode-position-stylestyle β styles the position indicator in copy mode. Style how-to: βSTYLESβ section, always.copy-mode-selection-stylestyle β styles your selection in copy mode π¦. βSTYLESβ section has the deets.mode-stylestyle β sets the style for window modes in general. Yep, βSTYLESβ section.monitor-activity[on | off]β keeps an eye out for activity in the window π. Windows with activity get highlighted in the status line, periodt.monitor-bell[on | off]β watches for a bell in the window π. Windows with a bell get highlighted in the status line too.monitor-silence[interval] β watches for silence (no activity at all) in the window within interval seconds π€«. Windows that have been quiet for that long get highlighted in the status line. Set the interval to zero and the monitoring is off.other-pane-heightheight β sets the height of the other panes (so, not the main one) in themain-horizontalandmain-horizontal-mirroredlayouts. If it's set to0(which is the default), it does literally nothing π. If bothmain-pane-heightandother-pane-heightare set, the main pane grows taller to make the other panes the specified height β but it will never shrink to do it, no cap. Add a%suffix and it's a percentage of the window size.other-pane-widthwidth β exactly likeother-pane-heightbut it sets the width of other panes in themain-verticalandmain-vertical-mirroredlayouts.pane-active-border-stylestyle β the pane border style for the pane that's currently active π₯. Style syntax: βSTYLESβ section. Attributes are ignored, fyi.pane-base-indexindex β likebase-index, but it sets the starting index for pane numbers.pane-border-formatformat β the text that shows up in pane border status lines.pane-border-indicators[off | colour | arrows | both]β shows which pane is active by colouring only half the border (in windows with exactly two panes), by drawing arrow markers, by doing both, or by doing neither π―.pane-border-linestype β picks the character type used to draw pane borders. type can be one of:singleβ single lines using ACS or UTF-8 charactersdoubleβ double lines using UTF-8 charactersheavyβ heavy lines using UTF-8 characterssimpleβ simple ASCII charactersnumberβ the pane numberspacesβ space characters
Also: double and heavy will fall back to standard ACS line drawing when UTF-8 isn't supported, jsyk.
pane-border-status[off | top | bottom]β turns pane border status lines off, or sets where they sit (top or bottom).pane-border-stylestyle β the pane border style for every pane except the active one. βSTYLESβ section for syntax. Attributes are ignored.popup-stylestyle β sets the popup style π. Check the βSTYLESβ section for how to specify it. Attributes are ignored.popup-border-stylestyle β sets the popup border style. βSTYLESβ section again. Attributes ignored, always.popup-border-linestype β the character type used for drawing popup borders. type can be one of:singleβ single lines using ACS or UTF-8 characters (this is the default)roundedβ a variation ofsinglewith rounded corners using UTF-8 charactersdoubleβ double lines using UTF-8 charactersheavyβ heavy lines using UTF-8 characterssimpleβ simple ASCII characterspaddedβ simple ASCII space characternoneβ no border at all π
And same as before: double and heavy fall back to standard ACS line drawing when UTF-8 isn't supported.
pane-scrollbars[off | modal | on]β when it's enabled, a character-based scrollbar shows up on the left or right of every pane. The filled section of that scrollbar, aka the βsliderβ, shows the position and size of the visible part of the pane content π.
Set it to on and the scrollbar is there all the time. Set it to modal and it only appears when the pane is in copy mode or view mode. Whenever the scrollbar is visible, the pane gets narrowed by the scrollbar's width and the text inside gets reflowed. If it's modal, the pane only gets narrowed while the scrollbar is visible.
Also peep pane-scrollbars-style while you're here.
pane-scrollbars-stylestyle β sets the scrollbars style. βSTYLESβ section, you know the drill. The foreground colour is used for the slider, the background for the rest of the scrollbar. Thewidthattribute sets how wide the scrollbar is and thepadattribute sets the padding between the scrollbar and the pane. Every other attribute is ignored.pane-scrollbars-position[left | right]β picks which side of the pane the scrollbars show up on.pane-status-current-stylestyle β status line style for the currently active pane. βSTYLESβ section β¨.pane-status-stylestyle β status line style for a single pane. βSTYLESβ section.session-status-current-stylestyle β status line style for the currently active session π . βSTYLESβ section.session-status-stylestyle β status line style for a single session. βSTYLESβ section.tiled-layout-max-columnsnumber β caps how many columns the tiled layout can have. A value of0(the default) means no limit at all. When there is a limit, panes get arranged so they don't exceed that column count, with any extra panes stacked into additional rows π§±.window-status-activity-stylestyle β status line style for windows with an activity alert. βSTYLESβ section.window-status-bell-stylestyle β status line style for windows with a bell alert. βSTYLESβ section.window-status-current-formatstring β just likewindow-status-format, except it's the format used when the window is the current window.window-status-current-stylestyle β status line style for the currently active window π. βSTYLESβ section.window-status-formatstring β sets the format the window is displayed with in the status line window list. Go read the βFORMATSβ and βSTYLESβ sections.window-status-last-stylestyle β status line style for the last active window. βSTYLESβ section.window-status-separatorstring β the separator drawn between windows in the status line. The default is a single space character.window-status-stylestyle β status line style for a single window. βSTYLESβ section.window-sizelargest | smallest | manual | latestβ configures how tmux figures out the window size π. Set it tolargestand it uses the size of the largest attached session;smallestand it uses the smallest.manualmeans a new window's size comes from thedefault-sizeoption and windows get resized automatically. Withlatest, tmux uses the size of the client that had the most recent activity. Also go look at theresize-windowcommand and theaggressive-resizeoption.wrap-search[on | off]β if this is set, searches wrap around the end of the pane contents π. Default ison.
Available pane options are: π«Ά
allow-passthrough[on | off | all]β lets programs inside the pane bypass tmux using a terminal escape sequence (\ePtmux;...\e\\). If it'son, passthrough sequences are only allowed when the pane is visible. If it'sall, they're allowed even when the pane is invisible π».allow-rename[on | off]β lets programs inside the pane change the window name using a terminal escape sequence (\ek...\e\\).allow-set-title[on | off]β lets programs inside the pane change the title using the terminal escape sequences (\e]2;...\e\\or\e]0;...\e\\).alternate-screen[on | off]β configures whether programs running inside the pane can use the terminal alternate screen feature, which is what allows thesmcupandrmcupterminfo(5) capabilities. The alternate screen feature preserves the window's contents when an interactive application starts and restores them on exit, so whatever output was visible before the app started reappears unchanged after it exits πͺ.cursor-colourcolour β sets the colour of the cursor.cursor-stylestyle β sets the style of the cursor. The available styles are:default,blinking-block,block,blinking-underline,underline,blinking-bar,bar.pane-colours[]colour β the default colour palette π¨. Each entry in the array defines the colour tmux uses when the colour with that index is requested. The index can be anywhere from zero to 255.remain-on-exit[on|off|failed] β bestie, when this is on, a pane does NOT get destroyed just because the program inside it exited. If you set it tofailed, it only holds onto the pane when the program's exit status is not zero (aka it flopped π). Wanna bring the pane back to life? Hit it with therespawn-panecommand. π«remain-on-exit-formatstring β this sets the text that shows up at the bottom of exited panes, but only whenremain-on-exitis enabled. It's giving little epitaph vibes. πͺ¦scroll-on-clear[on|off] β when the whole screen gets cleared and this is on, tmux scrolls all the screen contents into the history before wiping it. So nothing gets lost, periodt. β¨synchronize-panes[on|off] β duplicates your input into all the other panes in the same window that also have this option on. Lowkey a superpower. π«Ά Note: it only applies to panes that aren't in any mode.window-active-stylestyle β sets the pane style when that pane is the active one. Wanna know how to specify a style? Go read the βSTYLESβ section, iykyk. πwindow-stylestyle β sets the pane style, full stop. Same deal: how to specify it lives in the βSTYLESβ section. π
πͺ HOOKS πͺ
Okay so this is the fun part. tmux lets you run commands on all kinds of triggers, and those triggers are called hooks. Most tmux commands have an after hook, and there are also a bunch of hooks that aren't tied to any command at all. β¨
Hooks are stored as array options, and when a hook fires, its members get executed in order. Just like options, different hooks can be global or belong to a session, window or pane. You configure hooks with the set-hook or set-option commands, and you look at them with show-hooks or show-options -H. These two commands are literally equivalent, no cap:
set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'
set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red'
Setting a hook without specifying an array index clears the hook and sets the first member of the array. Fresh start energy. π§Ό
A command's after hook runs once the command finishes β except when the command is being run as part of a hook itself (nested hooks don't trigger after hooks, noted π). They're named with an after- prefix. For example, this command adds a hook that selects the even-vertical layout after every split-window:
set-hook -g after-split-window "selectl even-vertical"
If a command fails, the command-error hook fires. For example, you could use it to write to a log file:
set-hook -g command-error "run-shell \"echo 'a tmux command failed' >>/tmp/log\""
All the notifications listed in the βCONTROL MODEβ section are hooks too (without any arguments), with the exception of %exit. On top of those, here are the additional hooks available: π
alert-activityβ runs when a window has activity. Seemonitor-activity.alert-bellβ runs when a window has received a bell. Seemonitor-bell.alert-silenceβ runs when a window has been silent. Seemonitor-silence.client-activeβ runs when a client becomes the latest active client of its session.client-attachedβ runs when a client is attached.client-detachedβ runs when a client is detached.client-focus-inβ runs when focus enters a client.client-focus-outβ runs when focus exits a client.client-resizedβ runs when a client is resized.client-session-changedβ runs when a client's attached session is changed.client-light-themeβ runs when a client switches to a light theme. βοΈclient-dark-themeβ runs when a client switches to a dark theme. πcommand-errorβ runs when a command fails. πpane-diedβ runs when the program running in a pane exits, butremain-on-exitis on so the pane hasn't closed yet.pane-exitedβ runs when the program running in a pane exits.pane-focus-inβ runs when the focus enters a pane, if thefocus-eventsoption is on.pane-focus-outβ runs when the focus exits a pane, if thefocus-eventsoption is on.pane-set-clipboardβ runs when the terminal clipboard is set using thexterm(1)escape sequence.session-createdβ runs when a new session is created.session-closedβ runs when a session is closed.session-renamedβ runs when a session is renamed.window-layout-changedβ runs when a window layout is changed.window-linkedβ runs when a window is linked into a session.window-renamedβ runs when a window is renamed.window-resizedβ runs when a window is resized. Heads up: this may fire after theclient-resizedhook has run. β±οΈwindow-unlinkedβ runs when a window is unlinked from a session.
Hooks are managed with these commands:
set-hook[-agpRuw] [-ttarget-pane] hook-name [command] β without-R, this sets (or, with-u, unsets) the hook hook-name to command. The flags are the same as the ones forset-option. With-R, it runs hook-name immediately. π₯show-hooks[-gpw] [-ttarget-pane] [hook] β shows hooks. The flags are the same as forshow-options. π
π MOUSE SUPPORT π
If the mouse option is on (and ngl, the default is off), tmux lets you bind mouse events as keys. Each key's name is made up of a mouse event (like MouseUp1) plus a location suffix. Here are all the location suffixes, bestie: β¨
Paneβ the contents of a paneBorderβ a pane borderStatusβ the status line window listStatusLeftβ the left part of the status lineStatusRightβ the right part of the status lineStatusDefaultβ any other part of the status lineScrollbarSliderβ the scrollbar sliderScrollbarUpβ above the scrollbar sliderScrollbarDownβ below the scrollbar slider
And these are the mouse events you've got to work with:
WheelUp,WheelDownMouseDown1,MouseUp1,MouseDrag1,MouseDragEnd1MouseDown2,MouseUp2,MouseDrag2,MouseDragEnd2MouseDown3,MouseUp3,MouseDrag3,MouseDragEnd3SecondClick1,SecondClick2,SecondClick3DoubleClick1,DoubleClick2,DoubleClick3TripleClick1,TripleClick2,TripleClick3
Okay so the SecondClick events are fired for the second click of a double click, even if there might be a third click coming that will fire TripleClick instead of DoubleClick. The drama of it all. π
Each event should be suffixed with a location, like MouseDown1Status for example. π―
The special token {mouse} or = can be used as target-window or target-pane in commands bound to mouse key bindings. It resolves to the window or pane the mouse event actually happened over. For example: the window in the status line that button 1 was released over for a MouseUp1Status binding, or the pane the wheel was scrolled over for a WheelDownPane binding. So smart, honestly. π§
The send-keys -M flag can be used to forward a mouse event to a pane. π«°
The default key bindings let the mouse select and resize panes, copy text, and change windows using the status line. These take effect if the mouse option is turned on. Main character mouse energy, fr fr. ππ
β¨ FORMATS β¨
Okay bestie, this is the part where tmux gets fancy. Some commands take a -F flag with a format argument β that's just a lil string that controls how the command's output gets printed. π
Format variables live inside #{ and }, like #{session_name}. The full list of variables is in the table below, but you can also just drop in the name of a tmux option to get that option's value, or the name of an environment variable. Some variables have a shorter alias, like #S. And there's some escape-y business:
##gets replaced by a single##,gets replaced by a,#}gets replaced by a}
π Conditionals
Conditionals happen when you slap a ? on the front. For each pair of two arguments: if the variable in the first of the pair exists and is not zero, the second of the pair is chosen β otherwise it keeps going. If no condition from the paired arguments matches, the default value is chosen. If there's an unpaired final argument, that's the default. And if there isn't one, the default is the empty string. β¨
Some examples, fr:
#{?session_attached,attached,not attached}will include the stringattachedif the session is attached, and the stringnot attachedif it's unattached#{?automatic-rename,yes,no}will includeyesif automatic-rename is enabled, ornoif not#{?#{n:window_name},#{window_name} - }will include the window name with a dash separator if there is a window name, or the empty string if the window name is empty#{?session_format,format1,window_format,format2,format3}will include format1 for a session format, format2 for a window format, or format3 for neither a session nor a window format
Conditionals can be nested arbitrarily β go off. But heads up: inside a conditional, , and } must be escaped as #, and #}, unless they're part of a #{...} replacement. Like, for example:
#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W
π Comparisons & boolean stuff
String comparisons? Easy. Just prefix two comma-separated alternatives with ==, !=, <, >, <= or >= and a colon. So #{==:#{host},myhost} gets replaced by 1 if you're running on myhost, otherwise by 0.
||and&&evaluate to true if any or all of the comma-separated alternatives are true, e.g.#{||:#{pane_in_mode},#{alternate_on}}!evaluates to true if the value is false and vice versa, e.g.#{!:#{pane_in_mode}}!!converts a value to a canonical boolean form β1for true,0for false. So#{!!:non-empty string}evaluates to 1
π¦ Pattern matching
An m specifies a glob(7) pattern or regular expression comparison. First argument is the pattern, second is the string to compare. An optional argument specifies flags:
rmeans the pattern is a regular expression instead of the default glob(7) patternimeans ignore case
For example: #{m:*foo*,#{host}} or #{m/ri:^A,MYVAR}.
A C performs a search for a glob(7) pattern or regular expression in the pane content and evaluates to zero if it's not found, or a line number if it is. Like m, an r flag means search for a regular expression, and i ignores case. For example: #{C/r:^Start}
π₯ Numeric operators
Math time, bestie. Numeric operators work by prefixing two comma-separated alternatives with an e and an operator. An optional f flag can go after the operator to use floating point numbers β otherwise integers are used. That can be followed by a number giving how many decimal places to use for the result.
The available operators are:
- addition
+ - subtraction
- - multiplication
* - division
/ - modulus
mor%(note that%must be escaped as%%in formats which are also expanded by strftime(3)) - numeric comparison operators
==,!=,<,<=,>and>=
For example, #{e|*|f|4:5.5,3} multiplies 5.5 by 3 for a result with four decimal places, and #{e|%%:7,3} returns the modulus of 7 and 3.
areplaces a numeric argument by its ASCII equivalent, so#{a:98}results inbcreplaces a tmux colour by its six-digit hexadecimal RGB value
πΈ Slicing, padding, counting, repeating
You can cap how long the resulting string gets by prefixing it with =, a number and a colon. Positive numbers count from the start of the string, negative from the end.
#{=5:pane_title}will include at most the first five characters of the pane title#{=-5:pane_title}will include the last five characters
A suffix or prefix can be given as a second argument β if provided, it gets appended or prepended to the string if the length has been trimmed. So #{=/5/...:pane_title} will append ... if the pane title is more than five characters. π
Similarly, p pads the string to a given width: #{p10:pane_title} will result in a width of at least 10 characters. A positive width pads on the left, a negative one pads on the right.
nexpands to the length of the variable, e.g.#{n:window_name}wexpands to its width when displayedRrepeats the first argument by a number of times given by the second argument, so#{R:a,3}will result inaaa
π Time, paths, escaping, expansion
Prefixing a time variable with t: converts it to a string. So if #{window_activity} gives 1445765102, then #{t:window_activity} gives Sun Oct 25 09:25:02 2015. Adding p (t/p) will use a shorter but less accurate time format for times in the past. A custom format may be given using an f suffix (note that % must be escaped as %% if the format is separately being passed through strftime(3), for example in the status-left option): #{t/f/%%H#:%%M:window_activity} β see strftime(3). β
b:andd:prefixes are basename(3) and dirname(3) of the variable respectivelyq:will escape sh(1) special characters, or with anhsuffix, escape hash characters (so#becomes##)E:will expand the format twice β for example#{E:status-left}is the result of expanding the content of the status-left option rather than the option itselfT:is likeE:but also expands strftime(3) specifiersS:,W:,P:orL:will loop over each session, window, pane or client and insert the format once for each
L:, S: and W: can take an optional sort argument: /i, /n, /t to sort by index, name, or last activity time; additionally /r to sort in reverse order. /r can also be used with P: to reverse the sort order by pane index. For example, S/nr: sorts sessions by name in reverse order. π
For each, two comma-separated formats may be given: the second is used for the current window, active pane, or active session. For example, to get a list of windows formatted like the status line:
#{W:#{E:window-status-format} ,#{E:window-status-current-format} }
N: checks if a window (without any suffix or with the w suffix) or a session (with the s suffix) name exists β for example N/w:foo is replaced with 1 if a window named foo exists.
π§ Substitutions & stacking modifiers
A prefix of the form s/foo/bar/: will substitute foo with bar throughout. The first argument may be an extended regular expression, and a final argument may be i to ignore case β for example s/a(.)/\1x/i: would change abABab into bxBxbx. A different delimiter character may also be used, to avoid collisions with literal slashes in the pattern. For example, s|foo/|bar/|: will substitute foo/ with bar/ throughout. π
Multiple modifiers may be separated with a semicolon (;) as in #{T;=10:status-left}, which limits the resulting strftime(3)-expanded string to at most 10 characters.
π Shell commands in formats
In addition, the last line of a shell command's output may be inserted using #(). For example, #(uptime) will insert the system's uptime. π
When constructing formats, tmux does not wait for #() commands to finish; instead, the previous result from running the same command is used, or a placeholder if the command has not been run before. If the command hasn't exited, the most recent line of output will be used, but the status line will not be updated more than once a second. Commands are executed using /bin/sh and with the tmux global environment set (see the βGLOBAL AND SESSION ENVIRONMENTβ section).
π Literal strings
An l specifies that a string should be interpreted literally and not expanded. For example #{l:#{?pane_in_mode,yes,no}} will be replaced by #{?pane_in_mode,yes,no}. No cap. π
okay bestie, here's the big list of variables you can drop into your formats, where appropriate. Some of them have an alias too β none of the ones in this chunk do, but stay tuned. β¨
active_window_indexβ the index of the active window in the session πalternate_onβ1if the pane is hanging out in the alternate screenalternate_saved_xβ saved cursor X in the alternate screenalternate_saved_yβ saved cursor Y in the alternate screenbuffer_createdβ when the buffer was created πbuffer_fullβ the full buffer content, the whole thingbuffer_nameβ name of the bufferbuffer_sampleβ a lil sample of the start of the buffer πbuffer_sizeβ size of the specified buffer, in bytesclient_activityβ the time the client last had activityclient_cell_heightβ height of each client cell, in pixelsclient_cell_widthβ width of each client cell, in pixelsclient_control_modeβ1if the client is in control modeclient_createdβ the time the client was created π±client_discardedβ bytes discarded when the client fell behind πclient_flagsβ the list of client flagsclient_heightβ height of the clientclient_key_tableβ the current key tableclient_last_sessionβ name of the client's last sessionclient_nameβ name of the clientclient_pidβ PID of the client processclient_prefixβ1if the prefix key has been pressed πclient_readonlyβ1if the client is read-onlyclient_sessionβ name of the client's sessionclient_termfeaturesβ the client's terminal features, if anyclient_termnameβ terminal name of the clientclient_termtypeβ terminal type of the client, if availableclient_ttyβ the pseudo terminal of the clientclient_uidβ UID of the client processclient_userβ user of the client processclient_utf8β1if the client supports UTF-8 πclient_widthβ width of the clientclient_writtenβ bytes written to the clientcommandβ name of the command in use, if anycommand_list_aliasβ command alias ifcommand_list_nameβ the command's name, when you're listing commands πcommand_list_usageβ the command's usage, also when you're listing commandsconfig_filesβ the list of configuration files that got loaded πcursor_blinkingβ1if the cursor is blinking, bestie β¨copy_cursor_hyperlinkβ the hyperlink sitting under the cursor in copy mode πcopy_cursor_lineβ the line the cursor is on in copy modecopy_cursor_wordβ the word under the cursor in copy modecopy_cursor_xβ cursor X position in copy modecopy_cursor_yβ cursor Y position in copy modecurrent_fileβ the current configuration file πcursor_characterβ the character at the cursor in the panecursor_colourβ the cursor colour in the pane π¨cursor_flagβ the pane cursor flagcursor_shapeβ the cursor shape in the panecursor_very_visibleβ1if the cursor is in very visible mode πcursor_xβ cursor X position in the panecursor_yβ cursor Y position in the panehistory_bytesβ number of bytes in the window historyhistory_limitβ maximum window history lineshistory_sizeβ size of history in lineshookβ name of the running hook, if there is one πͺhook_clientβ name of the client where the hook was run, if anyhook_paneβ ID of the pane where the hook was run, if anyhook_sessionβ ID of the session where the hook was run, if anyhook_session_nameβ name of the session where the hook was run, if anyhook_windowβ ID of the window where the hook was run, if anyhook_window_nameβ name of the window where the hook was run, if anyhost(#H) β hostname of the local host π₯οΈhost_short(#h) β hostname of the local host, minus the domain nameinsert_flagβ the pane insert flagkeypad_cursor_flagβ the pane keypad cursor flagkeypad_flagβ the pane keypad flaglast_session_indexβ index of the last sessionlast_window_indexβ index of the last window in the sessionlineβ the line number in the list πloop_last_flagβ 1 if this is the last window, pane, session, or client in theW:,P:,S:, orL:loop πmouse_all_flagβ pane mouse all flag πmouse_any_flagβ pane mouse any flagmouse_button_flagβ pane mouse button flagmouse_hyperlinkβ the hyperlink under the mouse, if any πmouse_lineβ the line under the mouse, if anymouse_sgr_flagβ pane mouse SGR flagmouse_standard_flagβ pane mouse standard flagmouse_status_lineβ which status line the mouse event took place onmouse_status_rangeβ the range type or argument of the mouse event on the status linemouse_utf8_flagβ pane mouse UTF-8 flagmouse_wordβ the word under the mouse, if any π€mouse_xβ mouse X position, if anymouse_yβ mouse Y position, if anynext_session_idβ the unique session ID that the next new session is gonna get πorigin_flagβ pane origin flagpane_activeβ 1 if this is the active pane β¨pane_at_bottomβ 1 if the pane is chillin' at the bottom of the windowpane_at_leftβ 1 if the pane is at the left of the windowpane_at_rightβ 1 if the pane is at the right of the windowpane_at_topβ 1 if the pane is at the top of the windowpane_bgβ pane background colour π¨pane_bottomβ the bottom of the panepane_current_commandβ the current command, if availablepane_current_pathβ the current path, if available πpane_deadβ 1 if the pane is dead πpane_dead_signalβ the exit signal of the process in a dead panepane_dead_statusβ the exit status of the process in a dead panepane_dead_timeβ the exit time of the process in a dead pane β°pane_fgβ pane foreground colourpane_formatβ 1 if the format is for a panepane_heightβ the height of the pane πpane_idβ the unique pane ID, and yes bestie it's got an alias:#Dπpane_in_modeβ the number of modes the pane is in
More format variables, bestie β same energy, no skips π
pane_index(#P) β the index of the pane, like its little number in the lineup πpane_input_offβ1if input to the pane is disabled (so it's just vibing, not taking orders) πpane_key_modeβ the extended key reporting mode in this panepane_lastβ1if it's the last panepane_leftβ the left of the panepane_markedβ1if this is the marked pane β¨pane_marked_setβ1if a marked pane is setpane_modeβ the name of the pane mode, if there is onepane_pathβ the path of the pane (and yes, the application can set it) πpane_pidβ the PID of the first process in the panepane_pipeβ1if the pane is being pipedpane_rightβ the right of the panepane_search_stringβ the last search string in copy mode πpane_start_commandβ the command the pane was started withpane_start_pathβ the path the pane was started withpane_synchronizedβ1if the pane is synchronizedpane_tabsβ the pane's tab positionspane_title(#T) β the title of the pane (the application can set this too) β¨pane_topβ the top of the panepane_ttyβ the pseudo terminal of the panepane_unseen_changesβ1if there were changes in the pane while in modepane_widthβ the width of the panepidβ the server PIDrectangle_toggleβ1if rectangle selection is activatedscroll_positionβ the scroll position in copy modescroll_region_lowerβ the bottom of the scroll region in the panescroll_region_upperβ the top of the scroll region in the panesearch_countβ the count of search resultssearch_count_partialβ1if the search count is a partial countsearch_matchβ the search match, if there is onesearch_presentβ1if a search started in copy modeselection_activeβ1if a selection started and changes with the cursor in copy modeselection_end_xβ the X position of the end of the selectionselection_end_yβ the Y position of the end of the selectionselection_presentβ1if selection
mid-table energy rn π β the row above got cut off, but its tail said "started in copy mode". carry on bestie β¨
selection_start_xβ the X position where your selection startsselection_start_yβ the Y position where your selection startsserver_sessionsβ how many sessions the server hassession_activeβ1if the session is activesession_activityβ the time the session was last activesession_activity_flagβ1if any window in the session has activitysession_alertsβ list of window indexes that have alertssession_attachedβ number of clients this session is attached tosession_attached_listβ list of clients this session is attached tosession_bell_flagβ1if any window in the session has a bellsession_createdβ the time the session was createdsession_formatβ1if the format is for a sessionsession_groupβ name of the session groupsession_group_attachedβ number of clients that the sessions in the group are attached tosession_group_attached_listβ list of clients that the sessions in the group are attached tosession_group_listβ list of the sessions in the groupsession_group_many_attachedβ1if multiple clients are attached to the sessions in the groupsession_group_sizeβ size of the session groupsession_groupedβ1if the session is in a groupsession_idβ the unique session ID πsession_indexβ the index of the sessionsession_last_attachedβ the time the session was last attachedsession_many_attachedβ1if multiple clients are attachedsession_markedβ1if this session contains the marked pane πsession_name,#Sβ the name of the session β¨session_pathβ the working directory of the sessionsession_silence_flagβ1if any window in the session has a silence alert π€«session_stackβ window indexes in most recent ordersession_windowsβ number of windows in the sessionsocket_pathβ the server socket pathsixel_supportβ1if the server has support for SIXELstart_timeβ the server start timeuidβ the server UIDuserβ the server user
okay bestie, we're still in the format variable vault and the window ones are literally serving π no cap, every single one matters.
versionβ Server version β¨window_activeβ 1 if the window is active πwindow_active_clientsβ Number of clients viewing this window πwindow_active_clients_listβ List of clients viewing this window πwindow_active_sessionsβ Number of sessions on which this window is active πΈwindow_active_sessions_listβ List of sessions on which this window is active π«Άwindow_activityβ Time of window last activity β°window_activity_flagβ 1 if the window has activity π₯window_bell_flagβ 1 if the window has bell πwindow_biggerβ 1 if the window is larger than the client πwindow_cell_heightβ Height of each cell in pixels πwindow_cell_widthβ Width of each cell in pixels πwindow_end_flagβ 1 if the window has the highest index πwindow_flags(#F) β Window flags with#escaped as##π yes, reallywindow_formatβ 1 if the format is for a window πͺwindow_heightβ Height of window πwindow_idβ Unique window ID βwindow_index(#I) β Index of window π’window_last_flagβ 1 if the window is the last used π°οΈwindow_layoutβ Window layout description, ignoring zoomed window panes πwindow_linkedβ 1 if the window is linked across sessions πwindow_linked_sessionsβ Number of sessions this window is linked to π§window_linked_sessions_listβ List of sessions this window is linked to πwindow_marked_flagβ 1 if the window contains the marked pane πwindow_name(#W) β Name of window πwindow_offset_xβ X offset into window if larger than client βοΈwindow_offset_yβ Y offset into window if larger than client βοΈwindow_panesβ Number of panes in window π§©window_raw_flagsβ Window flags with nothing escaped π«’window_silence_flagβ 1 if the window has silence alert π€«window_stack_indexβ Index in session most recent stack π₯window_start_flagβ 1 if the window has the lowest index π₯window_visible_layoutβ Window layout description, respecting zoomed window panes ποΈwindow_widthβ how wide the window is πwindow_zoomed_flagβ1if the window is zoomed,0if notwrap_flagβ the pane wrap flag
β¨ STYLES β¨
okay so tmux has a whole buffet of options to specify the colour and attributes of aspects of the interface β like status-style for the status line, bestie. π
And on top of that, embedded styles may be specified inside format options, such as status-left, by wrapping them in #[ and ]. cute, right?
A style may be the single term default to specify the default style (which may come from an option, for example status-style in the status line) or a space or comma separated list of the following:
fg=colourβ sets the foreground colour. Thecolouris one of:black,red,green,yellow,blue,magenta,cyan,white; if supported the bright variantsbrightblack,brightred, ...;colour0tocolour255from the 256-colour set;defaultfor the default colour;terminalfor the terminal default colour; or a hexadecimal RGB string such as#ffffff. π¨bg=colourβ sets the background colour.us=colourβ sets the underscore colour.noneβ set no attributes (turn off any active attributes). poof, gone β¨acs,bright(orbold),dim,underscore,blink,reverse,hidden,italics,overline,strikethrough,double-underscore,curly-underscore,dotted-underscore,dashed-underscoreβ set an attribute. Any of the attributes may be prefixed withnoto unset it.acsis the terminal alternate character set.align=left(ornoalign),align=centre,align=rightβ align text to the left, centre or right of the available space, if appropriate.fill=colourβ fill the available space with a background colour, if appropriate.list=on,list=focus,list=left-marker,list=right-marker,nolistβ mark the position of the various window list components in thestatus-formatoption. So:list=onmarks the start of the list;list=focusis the part of the list that should be kept in focus if the entire list won't fit in the available space (typically the current window); andlist=left-markerandlist=right-markermark the text to be used to mark that text has been trimmed from the left or right of the list if there is not enough space.noattrβ do not copy attributes from the default style. πpush-default,pop-defaultβ store the current colours and attributes as the default, or reset to the previous default. Apush-defaultaffects any subsequent use of thedefaultterm until apop-default. Only one default may be pushed (eachpush-defaultreplaces the previous saved default). lowkey stack overflow vibes but make it fashion πrange=left,range=right,range=session|X,range=window|X,range=pane|X,range=user|X,norangeβ mark a range for mouse events in thestatus-formatoption. When a mouse event occurs in therange=leftorrange=rightrange, theStatusLeftandStatusRightkey bindings are triggered.
range=session|X, range=window|X and range=pane|X are ranges for a session, window or pane. These trigger the Status mouse key with the target session, window or pane given by the X argument. X is a session ID, window index in the current session or a pane ID. For these, the mouse_status_range format variable will be set to session, window or pane.
range=user|X is a user-defined range; it triggers the Status mouse key. The argument X will be available in the mouse_status_range format variable. X must be at most 15 bytes in length. π
Examples are:
fg=yellow bold underscore blink
bg=black,fg=default,noreverse
πΈ NAMES AND TITLES πΈ
okay this one trips people up so listen up bestie π«Ά β tmux distinguishes between names and titles.
Windows and sessions have names, which may be used to specify them in targets and are displayed in the status line and various lists: the name is the tmux identifier for a window or session.
Only panes have titles. A pane's title is typically set by the program running inside the pane using an escape sequence (like it would set the xterm(1) window title in X(7)). Windows themselves do not have titles β a window's title is the title of its active pane. tmux itself may set the title of the terminal in which the client is running, see the set-titles option.
A session's name is set with the new-session and rename-session commands. A window's name is set with one of:
- A command argument (such as
-nfornew-windowornew-session). - An escape sequence (if the
allow-renameoption is turned on):
$ printf '\033kWINDOW_NAME\033\\'
- Automatic renaming, which sets the name to the active command in the window's active pane. See the
automatic-renameoption. β¨
When a pane is first created, its title is the hostname. A pane's title can be set via the title setting escape sequence, for example:
$ printf '\033]2;My Title\033\\'
It can also be modified with the select-pane -T command. π
π GLOBAL AND SESSION ENVIRONMENT π
When the server is started, tmux copies the environment into the global environment; and in addition, each session has a session environment. When a window is created, the session and global environments are merged. If a variable exists in both, the value from the session environment is used. The result is the initial environment passed to the new process.
The update-environment session option may be used to update the session environment from the client when a new session is created or an old one reattached. tmux also initialises the TMUX variable with some internal information to allow commands to be executed from inside, and the TERM variable with the correct terminal setting of screen.
Variables in both session and global environments may be marked as hidden. Hidden variables are not passed into the environment of new processes and instead can only be used by tmux itself (for example in formats, see the βFORMATSβ section). sneaky. iconic. π
Commands to alter and view the environment are:
set-environment [-Fhgru] [-t target-session] variable [value](alias:setenv) β set or unset an environment variable. If-gis used, the change is made in the global environment; otherwise, it is applied to the session environment for target-session. If-Fis present, then value is expanded as a format. The-uflag unsets a variable.-rindicates the variable is to be removed from the environment before starting a new process.-hmarks the variable as hidden.show-environment [-hgs] [-t target-session] [variable](alias:showenv) β display the environment for target-session or the global environment with-g. If variable is omitted, all variables are shown. Variables removed from the environment are prefixed with-. If-sis used, the output is formatted as a set of Bourne shell commands.-hshows hidden variables (omitted by default). π
π STATUS LINE π
tmux includes an optional status line which is displayed in the bottom line of each terminal. π
By default, the status line is enabled and one line in height (it may be disabled or made multiple lines with the status session option) and contains, from left-to-right: the name of the current session in square brackets; the window list; the title of the active pane in double quotes; and the time and date. β
Each line of the status line is configured with the status-format option. The default is made of three parts: configurable left and right sections (which may contain dynamic content such as the time or output from a shell command, see the status-left, status-left-length, status-right, and status-right-length options below), and a central window list. By default, the window list shows the index, name and (if any) flag of the windows present in the current session in ascending numerical order. It may be customised with the window-status-format and window-status-current-format options. The flag is one of the following symbols appended to the window name:
*β denotes the current window π-β marks the last window (previously selected)#β window activity is monitored and activity has been detected β¨!β window bells are monitored and a bell has occurred in the window π~β the window has been silent for themonitor-silenceinterval π€«Mβ the window contains the marked paneZβ the window's active pane is zoomed π
The # symbol relates to the monitor-activity window option. The window name is printed in inverted colours if an alert (bell, activity or silence) is present. it's giving "your window is doing something, bestie, look at it" π
The colour and attributes of the status line may be configured, the entire status line using the status-style session option and individual windows using the window-status-style window option.
The status line is automatically refreshed at interval if it has changed, the interval may be controlled with the status-interval session option. set and forget, she keeps herself fresh β¨
Commands related to the status line are as follows:
clear-prompt-history[-T prompt-type]β (alias:clearphist)
Clear status prompt history for prompt type prompt-type. If -T is omitted, then clear history for all types. See command-prompt for possible values for prompt-type. bye bye old prompts, we don't need you π§Ή
command-prompt[-1bFiklN][-I inputs][-p prompts][-t target-client][-T prompt-type][template]
Open the command prompt in a client. This may be used from inside tmux to execute commands interactively. the glow-up of just typing what you want π
If template is specified, it is used as the command. With -F, template is expanded as a format.
If -I is present, inputs is a comma-separated list of the initial text for each prompt. If -p is given, prompts is a comma-separated list of prompts which are displayed in order; otherwise a single prompt is displayed, constructed from template if it is present, or : if not. -l disables splitting of inputs and prompts at commas and treats them literally.
Before the command is executed, the first occurrence of the string %% and all occurrences of %1 are replaced by the response to the first prompt, all %2 are replaced with the response to the second prompt, and so on for further prompts. Up to nine prompt responses may be replaced (%1 to %9). %%% is like %% but any quotation marks are escaped. so many percent signs, but she's a template queen fr fr π
-1 makes the prompt only accept one key press, in this case the resulting input is a single character. -k is like -1 but the key press is translated to a key name. -N makes the prompt only accept numeric key presses. -i executes the command every time the prompt input changes instead of when the user exits the command prompt.
-T tells tmux the prompt type. This affects what completions are offered when Tab is pressed. Available types are: command, search, target and window-target.
The following keys have a special meaning in the command prompt, depending on the value of the status-keys option:
- Cancel command prompt β vi:
q, emacs:Escape - Delete from cursor to start of word β vi: (none), emacs:
C-w - Delete entire command β vi:
d, emacs:C-u - Delete from cursor to end β vi:
D, emacs:C-k - Execute command β vi:
Enter, emacs:Enter - Get next command from history β vi: (none), emacs:
Down - Get previous command from history β vi: (none), emacs:
Up - Insert top paste buffer β vi:
p, emacs:C-y - Look for completions β vi:
Tab, emacs:Tab - Move cursor left β vi:
h, emacs:Left - Move cursor right β vi:
l, emacs:Right - Move cursor to end β vi:
$, emacs:C-e - Move cursor to next word β vi:
w, emacs:M-f - Move cursor to previous word β vi:
b, emacs:M-b - Move cursor to start β vi:
0, emacs:C-a - Transpose characters β vi: (none), emacs:
C-t
With -b, the prompt is shown in the background and the invoking client does not exit until it is dismissed. she's multitasking, she's in the background, she's that girl π
confirm-before[-by][-c confirm-key][-p prompt][-t target-client]commandβ (alias:confirm)
Ask for confirmation before executing command. If -p is given, prompt is the prompt to display; otherwise a prompt is constructed from command. It may contain the special character sequences supported by the status-left option. With -b, the prompt is shown in the background and the invoking client does not exit until it is dismissed. -y changes the default behaviour (if Enter alone is pressed) of the prompt to run the command. -c changes the confirmation key to confirm-key; the default is y. are you SURE bestie? say yes π«Ά
display-menu[-OM][-b border-lines][-c target-client][-C starting-choice][-H selected-style][-s style][-S border-style][-t target-pane][-T title][-x position][-y position]name key command[name key command ...]β (alias:menu)
Display a menu on target-client. target-pane gives the target for any commands run from the menu.
okay bestie, so a menu is passed as a series of arguments: first the menu item name, second the key shortcut (or empty for none), and third the command to run when the menu item is chosen. π
The name and command are formats, so peek at the βFORMATSβ and βSTYLESβ sections. If the name begins with a hyphen (-), then the item is disabled (shown dim) and may not be chosen. The name may be empty for a separator line, in which case both the key and command should be omitted. no cap.
-bβ sets the type of characters used for drawing menu borders. Seepopup-border-linesfor possible values for border-lines.-Hβ sets the style for the selected menu item (see βSTYLESβ).-sβ sets the style for the menu.-Sβ sets the style for the menu border (see βSTYLESβ).-Tβ is a format for the menu title (see βFORMATSβ).-Cβ sets the menu item selected by default, if the menu is not bound to a mouse key binding.-xand-yβ give the position of the menu. Both may be a row or column number, or one of the following special values:Cβ (Flag: Both) The centre of the terminalRβ (Flag:-x) The right side of the terminalPβ (Flag: Both) The bottom left of the paneMβ (Flag: Both) The mouse positionWβ (Flag: Both) The window position on the status lineSβ (Flag:-y) The line above or below the status line
Or a format, which is expanded including the following additional variables:
popup_centre_xβ Centered in the clientpopup_centre_yβ Centered in the clientpopup_heightβ Height of menu or popuppopup_mouse_bottomβ Bottom of at the mousepopup_mouse_centre_xβ Horizontal centre at the mousepopup_mouse_centre_yβ Vertical centre at the mousepopup_mouse_topβ Top at the mousepopup_mouse_xβ Mouse X positionpopup_mouse_yβ Mouse Y positionpopup_pane_bottomβ Bottom of the panepopup_pane_leftβ Left of the panepopup_pane_rightβ Right of the panepopup_pane_topβ Top of the panepopup_status_line_yβ Above or below the status linepopup_widthβ Width of menu or popuppopup_window_status_line_xβ At the window position in status linepopup_window_status_line_yβ At the status line showing the window
Each menu consists of items followed by a key shortcut shown in brackets. If the menu is too large to fit on the terminal, it is not displayed. Pressing the key shortcut chooses the corresponding item. If the mouse is enabled and the menu is opened from a mouse key binding, releasing the mouse button with an item selected chooses that item and releasing the mouse button without an item selected closes the menu. -O changes this behaviour so that the menu does not close when the mouse button is released without an item selected β the menu is not closed and a mouse button must be clicked to choose an item. π₯
-M tells tmux the menu should handle mouse events; by default only menus opened from mouse key bindings do so.
The following keys are available in menus:
Enterβ Choose selected itemUpβ Select previous itemDownβ Select next itemqβ Exit menu
π¬ display-message
display-message [-aCIlNpv] [-c target-client] [-d delay] [-t target-pane] [message]
(alias: display)
Display a message. If -p is given, the output is printed to stdout, otherwise it is displayed in the target-client status line for up to delay milliseconds. If delay is not given, the display-time option is used; a delay of zero waits for a key press. -N ignores key presses and closes only after the delay expires. If -C is given, the pane will continue to be updated while the message is displayed. If -l is given, message is printed unchanged. Otherwise, the format of message is described in the βFORMATSβ section; information is taken from target-pane if -t is given, otherwise the active pane.
-v prints verbose logging as the format is parsed and -a lists the format variables and their values.
-I forwards any input read from stdin to the empty pane given by target-pane.
πΈ display-popup πΈ
display-popup [-BCEkN] [-b border-lines] [-c target-client] [-d
start-directory] [-e environment] [-h height] [-s style] [-S
border-style] [-t target-pane] [-T title] [-w width] [-x
position] [-y position] [shell-command [argument ...]]
(alias: popup)
okay bestie this one is iconic β it pops a whole rectangle of vibes right on top of your panes π
It runs shell-command (or default-command if you don't give it one) on target-client.
So like, what even is a popup? It's a rectangular box drawn over the top of any panes. And here's the important part: panes are not updated while a popup is present. They're just sitting there frozen behind it, being dramatic π«Ά
And plot twist: if you run the command inside an existing popup, that popup gets modified instead of a new one appearing. But in that case only the -b, -B, -C, -E, -EE, -K, -N, -s, and -S options are accepted β everything else just gets ignored, no cap.
The flags, one by one, mwah:
-Eβ closes the popup automatically whenshell-commandexits. Two-Es (-EE) closes the popup only ifshell-commandexited with success. β¨-kβ lets any key dismiss the popup, instead of onlyβEscapeβorβC-cβ. Literally any key. The power π-xand-yβ give the position of the popup, and they have the same meaning as for thedisplay-menucommand.-wand-hβ give the width and height. Both may be a percentage (followed byβ%β). If omitted, half of the terminal size is used β so a chill 50/50 situation π-Bβ does not surround the popup by a border. Naked popup. Vulnerable popup. π-bborder-linesβ sets the type of characters used for drawing popup borders. Careful tho: when-Bis specified, the-boption is ignored. Seepopup-border-linesfor possible values forborder-lines.-sstyleβ sets the style for the popup, and-Sborder-stylesets the style for the popup border (see βSTYLESβ). π-eenvironmentβ takes the formβVARIABLE=valueβand sets an environment variable for the popup. You can specify it multiple times, so stack 'em like bracelets π-Ttitleβ a format for the popup title (see βFORMATSβ).-Cβ closes any popup on the client. Bye popup π-Nβ disables any previously specified-E,-EE, or-koption. It's the uno-reverse card π-ctarget-client,-dstart-directory,-ttarget-pane,-Kβ these show up in the synopsis up there βοΈ and the page doesn't spell them out any further right here, so go peep the fuller docs if you need the tea on those.
π¦ show-prompt-history π¦
show-prompt-history [-T prompt-type]
(alias: showphist)
Displays the status prompt history for prompt type prompt-type. If -T is omitted, then it shows the history for all types. See command-prompt for possible values for prompt-type.
basically it's your receipts for everything you've ever typed into a prompt π iconic behavior honestly.
π BUFFERS π
okay bestie so tmux keeps a whole lil collection of named paste buffers, like a stack of sticky notes but digital π Each buffer can be either explicitly or automatically named.
- Explicitly named buffers get their name when you create them with the
set-bufferorload-buffercommands, OR when you rename an automatically named buffer withset-buffer -n. - Automatically named buffers just get handed a name like
buffer0001,buffer0002and so on, like the universe naming your Sims π§
When the buffer-limit option gets reached, the oldest automatically named buffer gets deleted, no cap. Explicitly named buffers? They are NOT subject to buffer-limit, they're literally main character energy π and you can delete them with the delete-buffer command.
Buffers can be added using copy-mode, or with the set-buffer and load-buffer commands, and pasted into a window using the paste-buffer command. If you use a buffer command and don't specify a buffer, tmux assumes the most recently added automatically named buffer β it just knows bestie β¨
There's also a configurable history buffer maintained for each window. By default, up to 2000 lines are kept, and you can change that with the history-limit option (peep the set-option command above, iykyk).
The buffer commands are as follows:
πΈ the buffer commands πΈ
choose-buffer [-NryZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]
Puts a pane into buffer mode, where a buffer may be chosen interactively from a list π Each buffer is shown on one line. A shortcut key shows up on the left in brackets so you can pick immediately, or you can navigate the list and choose/manipulate an item with the keys below. -Z zooms the pane. -y disables any confirmation prompts.
The following keys may be used in buffer mode:
Enterβ Paste selected bufferUpβ Select previous bufferDownβ Select next bufferC-sβ Search by name or contentnβ Repeat last search forwardsNβ Repeat last search backwardstβ Toggle if buffer is taggedTβ Tag no buffersC-tβ Tag all bufferspβ Paste selected bufferPβ Paste tagged buffersdβ Delete selected bufferDβ Delete tagged bufferseβ Open the buffer in an editorfβ Enter a format to filter itemsOβ Change sort fieldrβ Reverse sort ordervβ Toggle previewqβ Exit mode
After a buffer is chosen, %% is replaced by the buffer name in template and the result executed as a command. If template is not given, "paste-buffer -p -b '%%'" is used.
-O specifies the initial sort field: one of time (creation), name or size. -r reverses the sort order. -f specifies an initial filter: the filter is a format β if it evaluates to zero, the item in the list is not shown, otherwise it is shown. If a filter would lead to an empty list, it is ignored. -F specifies the format for each item in the list and -K a format for each shortcut key; both are evaluated once for each line. -N starts without the preview. This command works only if at least one client is attached.
clear-history [-H] [-t target-pane](alias:clearhist) β Remove and free the history for the specified pane.-Halso removes all hyperlinks π«Άdelete-buffer [-b buffer-name](alias:deleteb) β Delete the buffer named buffer-name, or the most recently added automatically named buffer if not specified. bye bestie πlist-buffers [-F format] [-f filter](alias:lsb) β List the global buffers.-Fspecifies the format of each line and-fa filter. Only buffers for which the filter is true are shown. See the βFORMATSβ section.load-buffer [-w] [-b buffer-name] [-t target-client] path(alias:loadb) β Load the contents of the specified paste buffer from path. If-wis given, the buffer is also sent to the clipboard for target-client using thexterm(1)escape sequence, if possible. If path is-, the contents are read from stdin.paste-buffer [-dpr] [-b buffer-name] [-s separator] [-t target-pane](alias:pasteb) β Insert the contents of a paste buffer into the specified pane. If not specified, paste into the current one. With-d, also delete the paste buffer. When output, any linefeed (LF) characters in the paste buffer are replaced with a separator, by default carriage return (CR). A custom separator may be specified using the-sflag. The-rflag means to do no replacement (equivalent to a separator of LF). If-pis specified, paste bracket control codes are inserted around the buffer if the application has requested bracketed paste mode β¨save-buffer [-a] [-b buffer-name] path(alias:saveb) β Save the contents of the specified paste buffer to path. The-aoption appends to rather than overwriting the file. If path is-, the contents are written to stdout.set-buffer [-aw] [-b buffer-name] [-t target-client] [-n new-buffer-name] data(alias:setb) β Set the contents of the specified buffer to data. If-wis given, the buffer is also sent to the clipboard for target-client using thexterm(1)escape sequence, if possible. The-aoption appends to rather than overwriting the buffer. The-noption renames the buffer to new-buffer-name πshow-buffer [-b buffer-name](alias:showb) β Display the contents of the specified buffer.
π« MISCELLANEOUS π«
okay so these are the little odds and ends of commands, the random side quests, and honestly some of them are lowkey iconic. here we go bestie:
clock-mode [-t target-pane]β shows a big ol' clock. just a giant clock. in your pane. time is fake but the clock is real πif-shell [-bF] [-t target-pane] shell-command command [command](alias:if) β runs the firstcommandifshell-command(which gets run with/bin/sh) comes back successful, and the secondcommandif it doesn't. before it even runs,shell-commandgets expanded using the rules from the "FORMATS" section, including the ones that care about target-pane. with-b,shell-commandruns in the background. and if you pass-F, thenshell-commandis not actually executed at all β instead it counts as success as long as it's neither empty nor zero (after the formats get expanded). wild, but okay β¨lock-server(alias:lock) β locks every client individually by running whatever command thelock-commandoption says. πrun-shell [-bCE] [-c start-directory] [-d delay] [-t target-pane] [shell-command](alias:run) β runsshell-commandusing/bin/sh, or (with-C) runs a tmux command in the background without creating a window. before it runs,shell-commandgets expanded with the "FORMATS" rules.-bmeans run it in the background.-dwaits delay seconds before kicking the command off.-Eredirects the command's stderr to stdout instead of just ignoring it. if you give-c, the current working directory gets set to start-directory. and if-Cis not given, anything the command prints to stdout shows up in view mode (in the pane from-t, or the current pane if you didn't bother) once the command finishes. if the command fails, the exit status gets displayed too. πwait-for [-L | -S | -U] channel(alias:wait) β with no options, it stops the client from exiting until someone wakes it withwait-for -Son the same channel. with-L, the channel gets locked, and any client that tries to lock that same channel is made to wait until it's unlocked withwait-for -U. it's giving traffic controller energy π¦
π EXIT MESSAGES π
when a tmux client detaches, it prints a lil message on the way out. it's gonna be one of these:
detached (from session ...)β the client detached normally, no drama, all good. β¨detached and SIGHUPβ the client detached and its parent sent theSIGHUPsignal (like, for example, withdetach-client -P). πlost ttyβ the client'stty(4)orpty(4)got unexpectedly destroyed. rip. πterminatedβ the client was killed withSIGTERM.too far behindβ the client is in control mode and couldn't keep up with the data coming from tmux. it's literally falling behind, bestie πββοΈexitedβ the server exited when it had no sessions left.server exitedβ the server exited because it gotSIGTERM.server exited unexpectedlyβ the server crashed or otherwise exited without telling the client why. rude. π€
π TERMINFO EXTENSIONS π
so tmux understands some unofficial extensions to terminfo(5). normally you do not need to set these by hand β instead you should be using the terminal-features option. but here's the full list anyway, because knowledge is power:
AXβ an existing extension that tells tmux the terminal supports default colours.Bidiβ tells tmux the terminal supports the VTE bidirectional text extensions.Cs,Crβ set the cursor colour. the first one takes a single string argument and uses it to set the colour; the second takes no arguments and restores the default cursor colour. if it's set, a sequence like this can change the cursor colour from inside tmux:
$ printf '\033]12;red\033\\'
the colour is an X(7) colour, see XParseColor(3). π¨
Cmg,Clmg,Dsmg,Enmgβ set, clear, disable or enable DECSLRM margins. these get set automatically if the terminal reports that it's VT420 compatible.Dsbp,Enbpβ disable and enable bracketed paste. these get set automatically if theXTcapability is present.Dseks,Eneksβ disable and enable extended keys.Dsfcs,Enfcsβ disable and enable focus reporting. these get set automatically if theXTcapability is present.Hlsβ set or clear a hyperlink annotation.Nobrβ tells tmux the terminal does not use bright colors for bold display.Rectβ tells tmux the terminal supports rectangle operations.Smolβ enables the overline attribute.Smulxβ sets a styled underscore. the single parameter is one of:0for no underscore,1for normal underscore,2for double underscore,3for curly underscore,4for dotted underscore and5for dashed underscore. underscore lore fr β¨Setulc,Setulc1,olβ set the underscore colour or reset to the default.Setulcis for RGB colours andSetulc1is for ANSI or 256 colours. theSetulcargument is(red * 65536) + (green * 256) + bluewhere each value is between 0 and 255.Ss,Seβ set or reset the cursor style. if it's set, a sequence like this can change the cursor to an underline:
$ printf '\033[4 q'
if Se is not set, Ss with argument 0 will be used to reset the cursor style instead.
Swdβ sets the opening sequence for the working directory notification. the sequence gets terminated using the standardfslcapability.Sxlβ indicates that the terminal supports SIXEL. πΌοΈSyncβ start (parameter is1) or end (parameter is2) a synchronized update.Tcβ indicates the terminal supports the 'direct colour' RGB escape sequence (for example,\e[38;2;255;255;255m).
if supported, this is used for the initialize colour escape sequence (which can be enabled by adding the 'initc' and 'ccc' capabilities to the tmux terminfo(5) entry).
this is equivalent to the RGB terminfo(5) capability.
Msβ stores the current buffer in the host terminal's selection (clipboard). see theset-clipboardoption above and thexterm(1)man page.XTβ this is an existing extension capability that tmux uses to mean the terminal supports thexterm(1)title set sequences, and to automatically set some of the capabilities listed above. the multitasker of capabilities π
π CONTROL MODE π
tmux serves up a textual interface called control mode, and it's honestly so cool. it lets applications talk to tmux using a simple text-only protocol. main character energy for real.
in control mode, a client sends tmux commands or command sequences terminated by newlines on standard input. each command produces one block of output on standard output. an output block is a %begin line followed by the output (which may be empty). the output block ends with a %end or %error. %begin and its matching %end or %error each have three arguments: an integer time (as seconds from epoch), command number and flags (currently not used). for example:
%begin 1363006971 2 1
0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
%end 1363006971 2 1
the refresh-client -C command can be used to set the size of a client in control mode.
in control mode, tmux outputs notifications. a notification will never occur inside an output block. periodt.
the following notifications are defined, and yes, bestie, we're going through all of them:
%client-detached clientβ the client has detached.%client-session-changed client session-id nameβ the client is now attached to the session with ID session-id, which is named name.%config-error errorβ an error has happened in a configuration file.%continue pane-idβ the pane has been continued after being paused (if thepause-afterflag is set, seerefresh-client -A).%exit [reason]β the tmux client is exiting immediately, either because it's not attached to any session or because an error occurred. if present, reason describes why the client exited.%extended-output pane-id age ...: valueβ new form of%outputsent when thepause-afterflag is set. age is the time in milliseconds for which tmux had buffered the output before it was sent. any subsequent arguments up until a single ':' are for future use and should be ignored. iykyk π«Ά%layout-change window-id window-layout window-visible-layout window-flagsβ the layout of a window with ID window-id changed. the new layout is window-layout. the window's visible layout is window-visible-layout and the window flags are window-flags.%message messageβ a message sent with thedisplay-messagecommand.%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 thepause-afterflag 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. seerefresh-client -B. any arguments after pane-id up until a single ':' are for future use and should be ignored.%unlinked-window-add window-idβ the window with ID window-id was created but is not linked to the current session.%unlinked-window-close window-idβ the window with ID window-id, which is not linked to the current session, was closed.%unlinked-window-renamed window-idβ the window with ID window-id, which is not linked to the current session, was renamed.%window-add window-idβ the window with ID window-id was linked to the current session.%window-close window-idβ the window with ID window-id closed.%window-pane-changed window-id pane-idβ the active pane in the window with ID window-id changed to the pane with ID pane-id.%window-renamed window-id nameβ the window with ID window-id was renamed to name.
πΏ ENVIRONMENT πΏ
okay so when tmux boots up, it does a lil vibe check on these environment variables π bestie they're lowkey important:
EDITORβ if whatever command lives in here has the string 'vi' in it andVISUALis unset, tmux gives you vi-style key bindings π but heads up, themode-keysandstatus-keysoptions can override this, so they're the main characters here.HOMEβ your login directory, the classic. if it's unset, tmux goes and consults thepasswd(5)database instead, no cap.LC_CTYPEβ the character encodinglocale(1)π¦ and it's doing two whole separate jobs, she's booked and busy:- for output to the terminal, UTF-8 gets used if the
-uoption is given or ifLC_CTYPEcontains"UTF-8"or"UTF8". otherwise? only ASCII characters get written and any non-ASCII character gets replaced with underscores ('_') π - for input, tmux always runs with a UTF-8 locale. if
en_US.UTF-8is provided by the operating system, it gets used andLC_CTYPEis just ignored for input. otherwiseLC_CTYPEtells tmux what the UTF-8 locale is called on your current system.
- for output to the terminal, UTF-8 gets used if the
β οΈ and if the locale specified by LC_CTYPE isn't available, or isn't a UTF-8 locale, tmux exits with an error message. periodt, no session for you.
LC_TIMEβ the date and time formatlocale(1)β¨ it's used for locale-dependentstrftime(3)format specifiers, that's the whole job.PWDβ the current working directory that gets set in the global environment. this one's useful if it contains symbolic links π«Ά but plot twist: if the value of the variable does not match the actual current working directory, the variable is ignored and the result ofgetcwd(3)is used instead. she's strict like that.SHELLβ the absolute path to the default shell for new windows πΈ see thedefault-shelloption for the details, iykyk.TMUX_TMPDIRβ the parent directory of the directory that contains the server sockets π see the-Loption for details.VISUALβ if the command specified in this variable contains the string 'vi', you get vi-style key bindings. overridden by themode-keysandstatus-keysoptions, same deal asEDITOR.
π FILES π
the sacred texts bestie, here's where tmux looks for its config:
~/.tmux.conf$XDG_CONFIG_HOME/tmux/tmux.conf~/.config/tmux/tmux.confβ the default tmux configuration file β¨/etc/tmux.confβ the system-wide configuration file π
β¨ EXAMPLES β¨
okay bestie let's actually do something, here's the hands-on part π
want a brand new tmux session running vi(1)? bet:
$ tmux new-session vi
most commands have a shorter form, aka an alias π for new-session, that alias is new:
$ tmux new vi
alternatively, the shortest unambiguous form of a command is accepted π¦ and if there are several options that could match, tmux lists them for you:
$ tmux n
ambiguous command: n, could be: new-session, new-window, next-window
now, inside an active session, you can create a new window by typing 'C-b c' β that's Ctrl, then the 'b' key, then the 'c' key π
windows can be navigated with: 'C-b 0' (to select window 0), 'C-b 1' (to select window 1), and so on; 'C-b n' to select the next window; and 'C-b p' to select the previous window π§
a session can be detached using 'C-b d' (or by an external event, like ssh(1) disconnection, rude) and reattached with:
$ tmux attach-session
typing 'C-b ?' lists the current key bindings in the current window π up and down navigate the list, or 'q' exits from it.
commands to be run when the tmux server is started may be placed in the ~/.tmux.conf configuration file πΈ common examples include:
changing the default prefix key:
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
turning the status line off, or changing its colour:
set-option -g status off
set-option -g status-style bg=blue
setting other options, such as the default command, or locking after 30 minutes of inactivity:
set-option -g default-command "exec /bin/ksh"
set-option -g lock-after-time 1800
creating new key bindings:
bind-key b set-option status
bind-key / command-prompt "split-window 'exec man %%'"
bind-key S command-prompt "new-window -n %1 'ssh %1'"
π SEE ALSO π
π AUTHORS π
Nicholas Marriott < nicholas.marriott@gmail.com > β the icon, the legend, the moment fr fr π«Ά
and that's the whole page bestie, you made it to the end, so proud of you ππ this beauty came from the Debian folks and is dated September 12, 2026 β go forth and multiplex, you absolute main character πβ¨π
π¦ where this page comes from
- epel 10: opentmux 0.1-2.el10_3 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
- fedora 43: opentmux 0.1-2.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
- fedora 44: opentmux 0.1-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND SSH-short AND LicenseRef-Fedora-Public-Domain
- Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms