1.\" $OpenBSD$ 2.\" 3.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER 14.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 15.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd January 6, 2020 18.Dt TMUX 1 19.Os 20.Sh NAME 21.Nm tmux 22.Nd terminal multiplexer 23.Sh SYNOPSIS 24.Nm tmux 25.Bk -words 26.Op Fl 2CluvV 27.Op Fl c Ar shell-command 28.Op Fl f Ar file 29.Op Fl L Ar socket-name 30.Op Fl S Ar socket-path 31.Op Ar command Op Ar flags 32.Ek 33.Sh DESCRIPTION 34.Nm 35is a terminal multiplexer: 36it enables a number of terminals to be created, accessed, and 37controlled from a single screen. 38.Nm 39may be detached from a screen 40and continue running in the background, 41then later reattached. 42.Pp 43When 44.Nm 45is started it creates a new 46.Em session 47with a single 48.Em window 49and displays it on screen. 50A status line at the bottom of the screen 51shows information on the current session 52and is used to enter interactive commands. 53.Pp 54A session is a single collection of 55.Em pseudo terminals 56under the management of 57.Nm . 58Each session has one or more 59windows linked to it. 60A window occupies the entire screen 61and may be split into rectangular panes, 62each of which is a separate pseudo terminal 63(the 64.Xr pty 4 65manual page documents the technical details of pseudo terminals). 66Any number of 67.Nm 68instances may connect to the same session, 69and any number of windows may be present in the same session. 70Once all sessions are killed, 71.Nm 72exits. 73.Pp 74Each session is persistent and will survive accidental disconnection 75(such as 76.Xr ssh 1 77connection timeout) or intentional detaching (with the 78.Ql C-b d 79key strokes). 80.Nm 81may be reattached using: 82.Pp 83.Dl $ tmux attach 84.Pp 85In 86.Nm , 87a session is displayed on screen by a 88.Em client 89and all sessions are managed by a single 90.Em server . 91The server and each client are separate processes which communicate through a 92socket in 93.Pa /tmp . 94.Pp 95The options are as follows: 96.Bl -tag -width "XXXXXXXXXXXX" 97.It Fl 2 98Force 99.Nm 100to assume the terminal supports 256 colours. 101.It Fl C 102Start in control mode (see the 103.Sx CONTROL MODE 104section). 105Given twice 106.Xo ( Fl CC ) Xc 107disables echo. 108.It Fl c Ar shell-command 109Execute 110.Ar shell-command 111using the default shell. 112If necessary, the 113.Nm 114server will be started to retrieve the 115.Ic default-shell 116option. 117This option is for compatibility with 118.Xr sh 1 119when 120.Nm 121is used as a login shell. 122.It Fl f Ar file 123Specify an alternative configuration file. 124By default, 125.Nm 126loads the system configuration file from 127.Pa @SYSCONFDIR@/tmux.conf , 128if present, then looks for a user configuration file at 129.Pa ~/.tmux.conf . 130.Pp 131The configuration file is a set of 132.Nm 133commands which are executed in sequence when the server is first started. 134.Nm 135loads configuration files once when the server process has started. 136The 137.Ic source-file 138command may be used to load a file later. 139.Pp 140.Nm 141shows any error messages from commands in configuration files in the first 142session created, and continues to process the rest of the configuration file. 143.It Fl L Ar socket-name 144.Nm 145stores the server socket in a directory under 146.Ev TMUX_TMPDIR 147or 148.Pa /tmp 149if it is unset. 150The default socket is named 151.Em default . 152This option allows a different socket name to be specified, allowing several 153independent 154.Nm 155servers to be run. 156Unlike 157.Fl S 158a full path is not necessary: the sockets are all created in the same 159directory. 160.Pp 161If the socket is accidentally removed, the 162.Dv SIGUSR1 163signal may be sent to the 164.Nm 165server process to recreate it (note that this will fail if any parent 166directories are missing). 167.It Fl l 168Behave as a login shell. 169This flag currently has no effect and is for compatibility with other shells 170when using tmux as a login shell. 171.It Fl S Ar socket-path 172Specify a full alternative path to the server socket. 173If 174.Fl S 175is specified, the default socket directory is not used and any 176.Fl L 177flag is ignored. 178.It Fl u 179Write UTF-8 output to the terminal even if the first environment 180variable of 181.Ev LC_ALL , 182.Ev LC_CTYPE , 183or 184.Ev LANG 185that is set does not contain 186.Qq UTF-8 187or 188.Qq UTF8 . 189.It Fl v 190Request verbose logging. 191Log messages will be saved into 192.Pa tmux-client-PID.log 193and 194.Pa tmux-server-PID.log 195files in the current directory, where 196.Em PID 197is the PID of the server or client process. 198If 199.Fl v 200is specified twice, an additional 201.Pa tmux-out-PID.log 202file is generated with a copy of everything 203.Nm 204writes to the terminal. 205.Pp 206The 207.Dv SIGUSR2 208signal may be sent to the 209.Nm 210server process to toggle logging between on (as if 211.Fl v 212was given) and off. 213.It Fl V 214Report the 215.Nm 216version. 217.It Ar command Op Ar flags 218This specifies one of a set of commands used to control 219.Nm , 220as described in the following sections. 221If no commands are specified, the 222.Ic new-session 223command is assumed. 224.El 225.Sh DEFAULT KEY BINDINGS 226.Nm 227may be controlled from an attached client by using a key combination of a 228prefix key, 229.Ql C-b 230(Ctrl-b) by default, followed by a command key. 231.Pp 232The default command key bindings are: 233.Pp 234.Bl -tag -width "XXXXXXXXXX" -offset indent -compact 235.It C-b 236Send the prefix key (C-b) through to the application. 237.It C-o 238Rotate the panes in the current window forwards. 239.It C-z 240Suspend the 241.Nm 242client. 243.It ! 244Break the current pane out of the window. 245.It \&" 246.\" " 247Split the current pane into two, top and bottom. 248.It # 249List all paste buffers. 250.It $ 251Rename the current session. 252.It % 253Split the current pane into two, left and right. 254.It & 255Kill the current window. 256.It ' 257Prompt for a window index to select. 258.It \&( 259Switch the attached client to the previous session. 260.It \&) 261Switch the attached client to the next session. 262.It , 263Rename the current window. 264.It - 265Delete the most recently copied buffer of text. 266.It . 267Prompt for an index to move the current window. 268.It 0 to 9 269Select windows 0 to 9. 270.It : 271Enter the 272.Nm 273command prompt. 274.It ; 275Move to the previously active pane. 276.It = 277Choose which buffer to paste interactively from a list. 278.It \&? 279List all key bindings. 280.It D 281Choose a client to detach. 282.It L 283Switch the attached client back to the last session. 284.It \&[ 285Enter copy mode to copy text or view the history. 286.It \&] 287Paste the most recently copied buffer of text. 288.It c 289Create a new window. 290.It d 291Detach the current client. 292.It f 293Prompt to search for text in open windows. 294.It i 295Display some information about the current window. 296.It l 297Move to the previously selected window. 298.It m 299Mark the current pane (see 300.Ic select-pane 301.Fl m ) . 302.It M 303Clear the marked pane. 304.It n 305Change to the next window. 306.It o 307Select the next pane in the current window. 308.It p 309Change to the previous window. 310.It q 311Briefly display pane indexes. 312.It r 313Force redraw of the attached client. 314.It s 315Select a new session for the attached client interactively. 316.It t 317Show the time. 318.It w 319Choose the current window interactively. 320.It x 321Kill the current pane. 322.It z 323Toggle zoom state of the current pane. 324.It { 325Swap the current pane with the previous pane. 326.It } 327Swap the current pane with the next pane. 328.It ~ 329Show previous messages from 330.Nm , 331if any. 332.It Page Up 333Enter copy mode and scroll one page up. 334.It Up, Down 335.It Left, Right 336Change to the pane above, below, to the left, or to the right of the current 337pane. 338.It M-1 to M-5 339Arrange panes in one of the five preset layouts: even-horizontal, 340even-vertical, main-horizontal, main-vertical, or tiled. 341.It Space 342Arrange the current window in the next preset layout. 343.It M-n 344Move to the next window with a bell or activity marker. 345.It M-o 346Rotate the panes in the current window backwards. 347.It M-p 348Move to the previous window with a bell or activity marker. 349.It C-Up, C-Down 350.It C-Left, C-Right 351Resize the current pane in steps of one cell. 352.It M-Up, M-Down 353.It M-Left, M-Right 354Resize the current pane in steps of five cells. 355.El 356.Pp 357Key bindings may be changed with the 358.Ic bind-key 359and 360.Ic unbind-key 361commands. 362.Sh COMMAND PARSING AND EXECUTION 363.Nm 364supports a large number of commands which can be used to control its 365behaviour. 366Each command is named and can accept zero or more flags and arguments. 367They may be bound to a key with the 368.Ic bind-key 369command or run from the shell prompt, a shell script, a configuration file or 370the command prompt. 371For example, the same 372.Ic set-option 373command run from the shell prompt, from 374.Pa ~/.tmux.conf 375and bound to a key may look like: 376.Bd -literal -offset indent 377$ tmux set-option -g status-style bg=cyan 378 379set-option -g status-style bg=cyan 380 381bind-key C set-option -g status-style bg=cyan 382.Ed 383.Pp 384Here, the command name is 385.Ql set-option , 386.Ql Fl g 387is a flag and 388.Ql status-style 389and 390.Ql bg=cyan 391are arguments. 392.Pp 393.Nm 394distinguishes between command parsing and execution. 395In order to execute a command, 396.Nm 397needs it to be split up into its name and arguments. 398This is command parsing. 399If a command is run from the shell, the shell parses it; from inside 400.Nm 401or from a configuration file, 402.Nm 403does. 404Examples of when 405.Nm 406parses commands are: 407.Bl -dash -offset indent 408.It 409in a configuration file; 410.It 411typed at the command prompt (see 412.Ic command-prompt ) ; 413.It 414given to 415.Ic bind-key ; 416.It 417passed as arguments to 418.Ic if-shell 419or 420.Ic confirm-before . 421.El 422.Pp 423To execute commands, each client has a 424.Ql command queue . 425A global command queue not attached to any client is used on startup 426for configuration files like 427.Pa ~/.tmux.conf . 428Parsed commands added to the queue are executed in order. 429Some commands, like 430.Ic if-shell 431and 432.Ic confirm-before , 433parse their argument to create a new command which is inserted immediately 434after themselves. 435This means that arguments can be parsed twice or more - once when the parent command (such as 436.Ic if-shell ) 437is parsed and again when it parses and executes its command. 438Commands like 439.Ic if-shell , 440.Ic run-shell 441and 442.Ic display-panes 443stop execution of subsequent commands on the queue until something happens - 444.Ic if-shell 445and 446.Ic run-shell 447until a shell command finishes and 448.Ic display-panes 449until a key is pressed. 450For example, the following commands: 451.Bd -literal -offset indent 452new-session; new-window 453if-shell "true" "split-window" 454kill-session 455.Ed 456.Pp 457Will execute 458.Ic new-session , 459.Ic new-window , 460.Ic if-shell , 461the shell command 462.Xr true 1 , 463.Ic split-window 464and 465.Ic kill-session 466in that order. 467.Pp 468The 469.Sx COMMANDS 470section lists the 471.Nm 472commands and their arguments. 473.Sh PARSING SYNTAX 474This section describes the syntax of commands parsed by 475.Nm , 476for example in a configuration file or at the command prompt. 477Note that when commands are entered into the shell, they are parsed by the shell 478- see for example 479.Xr ksh 1 480or 481.Xr csh 1 . 482.Pp 483Each command is terminated by a newline or a semicolon (;). 484Commands separated by semicolons together form a 485.Ql command sequence 486- if a command in the sequence encounters an error, no subsequent commands are 487executed. 488.Pp 489Comments are marked by the unquoted # character - any remaining text after a 490comment is ignored until the end of the line. 491.Pp 492If the last character of a line is \e, the line is joined with the following 493line (the \e and the newline are completely removed). 494This is called line continuation and applies both inside and outside quoted 495strings and in comments, but not inside braces. 496.Pp 497Command arguments may be specified as strings surrounded by single (') quotes, 498double quotes (") or braces ({}). 499.\" " 500This is required when the argument contains any special character. 501Single and double quoted strings cannot span multiple lines except with line 502continuation. 503Braces can span multiple lines. 504.Pp 505Outside of quotes and inside double quotes, these replacements are performed: 506.Bl -dash -offset indent 507.It 508Environment variables preceded by $ are replaced with their value from the 509global environment (see the 510.Sx GLOBAL AND SESSION ENVIRONMENT 511section). 512.It 513A leading ~ or ~user is expanded to the home directory of the current or 514specified user. 515.It 516\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to 517the given four or eight digit hexadecimal number. 518.It 519When preceded (escaped) by a \e, the following characters are replaced: \ee by 520the escape character; \er by a carriage return; \en by a newline; and \et by a 521tab. 522.It 523\eooo is replaced by a character of the octal value ooo. 524Three octal digits are required, for example \e001. 525The largest valid character is \e377. 526.It 527Any other characters preceded by \e are replaced by themselves (that is, the \e 528is removed) and are not treated as having any special meaning - so for example 529\e; will not mark a command sequence and \e$ will not expand an environment 530variable. 531.El 532.Pp 533Braces are similar to single quotes in that the text inside is taken literally 534without any replacements but this also includes line continuation. 535Braces can span multiple lines in which case a literal newline is included in the 536string. 537They are designed to avoid the need for additional escaping when passing a group 538of 539.Nm 540or shell commands as an argument (for example to 541.Ic if-shell 542or 543.Ic pipe-pane ) . 544These two examples produce an identical command - note that no escaping is 545needed when using {}: 546.Bd -literal -offset indent 547if-shell true { 548 display -p 'brace-dollar-foo: }$foo' 549} 550 551if-shell true "\en display -p 'brace-dollar-foo: }\e$foo'\en" 552.Ed 553.Pp 554Braces may be enclosed inside braces, for example: 555.Bd -literal -offset indent 556bind x if-shell "true" { 557 if-shell "true" { 558 display "true!" 559 } 560} 561.Ed 562.Pp 563Environment variables may be set by using the syntax 564.Ql name=value , 565for example 566.Ql HOME=/home/user . 567Variables set during parsing are added to the global environment. 568.Pp 569Commands may be parsed conditionally by surrounding them with 570.Ql %if , 571.Ql %elif , 572.Ql %else 573and 574.Ql %endif . 575The argument to 576.Ql %if 577and 578.Ql %elif 579is expanded as a format (see 580.Sx FORMATS ) 581and if it evaluates to false (zero or empty), subsequent text is ignored until 582the closing 583.Ql %elif , 584.Ql %else 585or 586.Ql %endif . 587For example: 588.Bd -literal -offset indent 589%if "#{==:#{host},myhost}" 590set -g status-style bg=red 591%elif "#{==:#{host},myotherhost}" 592set -g status-style bg=green 593%else 594set -g status-style bg=blue 595%endif 596.Ed 597.Pp 598Will change the status line to red if running on 599.Ql myhost , 600green if running on 601.Ql myotherhost , 602or blue if running on another host. 603Conditionals may be given on one line, for example: 604.Bd -literal -offset indent 605%if #{==:#{host},myhost} set -g status-style bg=red %endif 606.Ed 607.Sh COMMANDS 608This section describes the commands supported by 609.Nm . 610Most commands accept the optional 611.Fl t 612(and sometimes 613.Fl s ) 614argument with one of 615.Ar target-client , 616.Ar target-session , 617.Ar target-window , 618or 619.Ar target-pane . 620These specify the client, session, window or pane which a command should affect. 621.Pp 622.Ar target-client 623should be the name of the client, 624typically the 625.Xr pty 4 626file to which the client is connected, for example either of 627.Pa /dev/ttyp1 628or 629.Pa ttyp1 630for the client attached to 631.Pa /dev/ttyp1 . 632If no client is specified, 633.Nm 634attempts to work out the client currently in use; if that fails, an error is 635reported. 636Clients may be listed with the 637.Ic list-clients 638command. 639.Pp 640.Ar target-session 641is tried as, in order: 642.Bl -enum -offset Ds 643.It 644A session ID prefixed with a $. 645.It 646An exact name of a session (as listed by the 647.Ic list-sessions 648command). 649.It 650The start of a session name, for example 651.Ql mysess 652would match a session named 653.Ql mysession . 654.It 655An 656.Xr fnmatch 3 657pattern which is matched against the session name. 658.El 659.Pp 660If the session name is prefixed with an 661.Ql = , 662only an exact match is accepted (so 663.Ql =mysess 664will only match exactly 665.Ql mysess , 666not 667.Ql mysession ) . 668.Pp 669If a single session is found, it is used as the target session; multiple matches 670produce an error. 671If a session is omitted, the current session is used if available; if no 672current session is available, the most recently used is chosen. 673.Pp 674.Ar target-window 675(or 676.Ar src-window 677or 678.Ar dst-window ) 679specifies a window in the form 680.Em session Ns \&: Ns Em window . 681.Em session 682follows the same rules as for 683.Ar target-session , 684and 685.Em window 686is looked for in order as: 687.Bl -enum -offset Ds 688.It 689A special token, listed below. 690.It 691A window index, for example 692.Ql mysession:1 693is window 1 in session 694.Ql mysession . 695.It 696A window ID, such as @1. 697.It 698An exact window name, such as 699.Ql mysession:mywindow . 700.It 701The start of a window name, such as 702.Ql mysession:mywin . 703.It 704As an 705.Xr fnmatch 3 706pattern matched against the window name. 707.El 708.Pp 709Like sessions, a 710.Ql = 711prefix will do an exact match only. 712An empty window name specifies the next unused index if appropriate (for 713example the 714.Ic new-window 715and 716.Ic link-window 717commands) 718otherwise the current window in 719.Em session 720is chosen. 721.Pp 722The following special tokens are available to indicate particular windows. 723Each has a single-character alternative form. 724.Bl -column "XXXXXXXXXX" "X" 725.It Sy "Token" Ta Sy "" Ta Sy "Meaning" 726.It Li "{start}" Ta "^" Ta "The lowest-numbered window" 727.It Li "{end}" Ta "$" Ta "The highest-numbered window" 728.It Li "{last}" Ta "!" Ta "The last (previously current) window" 729.It Li "{next}" Ta "+" Ta "The next window by number" 730.It Li "{previous}" Ta "-" Ta "The previous window by number" 731.El 732.Pp 733.Ar target-pane 734(or 735.Ar src-pane 736or 737.Ar dst-pane ) 738may be a pane ID or takes a similar form to 739.Ar target-window 740but with the optional addition of a period followed by a pane index or pane ID, 741for example: 742.Ql mysession:mywindow.1 . 743If the pane index is omitted, the currently active pane in the specified 744window is used. 745The following special tokens are available for the pane index: 746.Bl -column "XXXXXXXXXXXXXX" "X" 747.It Sy "Token" Ta Sy "" Ta Sy "Meaning" 748.It Li "{last}" Ta "!" Ta "The last (previously active) pane" 749.It Li "{next}" Ta "+" Ta "The next pane by number" 750.It Li "{previous}" Ta "-" Ta "The previous pane by number" 751.It Li "{top}" Ta "" Ta "The top pane" 752.It Li "{bottom}" Ta "" Ta "The bottom pane" 753.It Li "{left}" Ta "" Ta "The leftmost pane" 754.It Li "{right}" Ta "" Ta "The rightmost pane" 755.It Li "{top-left}" Ta "" Ta "The top-left pane" 756.It Li "{top-right}" Ta "" Ta "The top-right pane" 757.It Li "{bottom-left}" Ta "" Ta "The bottom-left pane" 758.It Li "{bottom-right}" Ta "" Ta "The bottom-right pane" 759.It Li "{up-of}" Ta "" Ta "The pane above the active pane" 760.It Li "{down-of}" Ta "" Ta "The pane below the active pane" 761.It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane" 762.It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane" 763.El 764.Pp 765The tokens 766.Ql + 767and 768.Ql - 769may be followed by an offset, for example: 770.Bd -literal -offset indent 771select-window -t:+2 772.Ed 773.Pp 774In addition, 775.Em target-session , 776.Em target-window 777or 778.Em target-pane 779may consist entirely of the token 780.Ql {mouse} 781(alternative form 782.Ql = ) 783to specify the session, window or pane where the most recent mouse event occurred 784(see the 785.Sx MOUSE SUPPORT 786section) 787or 788.Ql {marked} 789(alternative form 790.Ql ~ ) 791to specify the marked pane (see 792.Ic select-pane 793.Fl m ) . 794.Pp 795Sessions, window and panes are each numbered with a unique ID; session IDs are 796prefixed with a 797.Ql $ , 798windows with a 799.Ql @ , 800and panes with a 801.Ql % . 802These are unique and are unchanged for the life of the session, window or pane 803in the 804.Nm 805server. 806The pane ID is passed to the child process of the pane in the 807.Ev TMUX_PANE 808environment variable. 809IDs may be displayed using the 810.Ql session_id , 811.Ql window_id , 812or 813.Ql pane_id 814formats (see the 815.Sx FORMATS 816section) and the 817.Ic display-message , 818.Ic list-sessions , 819.Ic list-windows 820or 821.Ic list-panes 822commands. 823.Pp 824.Ar shell-command 825arguments are 826.Xr sh 1 827commands. 828This may be a single argument passed to the shell, for example: 829.Bd -literal -offset indent 830new-window 'vi /etc/passwd' 831.Ed 832.Pp 833Will run: 834.Bd -literal -offset indent 835/bin/sh -c 'vi /etc/passwd' 836.Ed 837.Pp 838Additionally, the 839.Ic new-window , 840.Ic new-session , 841.Ic split-window , 842.Ic respawn-window 843and 844.Ic respawn-pane 845commands allow 846.Ar shell-command 847to be given as multiple arguments and executed directly (without 848.Ql sh -c ) . 849This can avoid issues with shell quoting. 850For example: 851.Bd -literal -offset indent 852$ tmux new-window vi /etc/passwd 853.Ed 854.Pp 855Will run 856.Xr vi 1 857directly without invoking the shell. 858.Pp 859.Ar command 860.Op Ar arguments 861refers to a 862.Nm 863command, either passed with the command and arguments separately, for example: 864.Bd -literal -offset indent 865bind-key F1 set-option status off 866.Ed 867.Pp 868Or passed as a single string argument in 869.Pa .tmux.conf , 870for example: 871.Bd -literal -offset indent 872bind-key F1 { set-option status off } 873.Ed 874.Pp 875Example 876.Nm 877commands include: 878.Bd -literal -offset indent 879refresh-client -t/dev/ttyp2 880 881rename-session -tfirst newname 882 883set-option -wt:0 monitor-activity on 884 885new-window ; split-window -d 886 887bind-key R source-file ~/.tmux.conf \e; \e 888 display-message "source-file done" 889.Ed 890.Pp 891Or from 892.Xr sh 1 : 893.Bd -literal -offset indent 894$ tmux kill-window -t :1 895 896$ tmux new-window \e; split-window -d 897 898$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach 899.Ed 900.Sh CLIENTS AND SESSIONS 901The 902.Nm 903server manages clients, sessions, windows and panes. 904Clients are attached to sessions to interact with them, either 905when they are created with the 906.Ic new-session 907command, or later with the 908.Ic attach-session 909command. 910Each session has one or more windows 911.Em linked 912into it. 913Windows may be linked to multiple sessions and are made up of one or 914more panes, 915each of which contains a pseudo terminal. 916Commands for creating, linking and otherwise manipulating windows 917are covered 918in the 919.Sx WINDOWS AND PANES 920section. 921.Pp 922The following commands are available to manage clients and sessions: 923.Bl -tag -width Ds 924.It Xo Ic attach-session 925.Op Fl dErx 926.Op Fl c Ar working-directory 927.Op Fl t Ar target-session 928.Xc 929.D1 (alias: Ic attach ) 930If run from outside 931.Nm , 932create a new client in the current terminal and attach it to 933.Ar target-session . 934If used from inside, switch the current client. 935If 936.Fl d 937is specified, any other clients attached to the session are detached. 938If 939.Fl x 940is given, send 941.Dv SIGHUP 942to the parent process of the client as well as 943detaching the client, typically causing it to exit. 944.Fl r 945signifies the client is read-only (only keys bound to the 946.Ic detach-client 947or 948.Ic switch-client 949commands have any effect) 950.Pp 951If no server is started, 952.Ic attach-session 953will attempt to start it; this will fail unless sessions are created in the 954configuration file. 955.Pp 956The 957.Ar target-session 958rules for 959.Ic attach-session 960are slightly adjusted: if 961.Nm 962needs to select the most recently used session, it will prefer the most 963recently used 964.Em unattached 965session. 966.Pp 967.Fl c 968will set the session working directory (used for new windows) to 969.Ar working-directory . 970.Pp 971If 972.Fl E 973is used, the 974.Ic update-environment 975option will not be applied. 976.It Xo Ic detach-client 977.Op Fl aP 978.Op Fl E Ar shell-command 979.Op Fl s Ar target-session 980.Op Fl t Ar target-client 981.Xc 982.D1 (alias: Ic detach ) 983Detach the current client if bound to a key, the client specified with 984.Fl t , 985or all clients currently attached to the session specified by 986.Fl s . 987The 988.Fl a 989option kills all but the client given with 990.Fl t . 991If 992.Fl P 993is given, send 994.Dv SIGHUP 995to the parent process of the client, typically causing it 996to exit. 997With 998.Fl E , 999run 1000.Ar shell-command 1001to replace the client. 1002.It Ic has-session Op Fl t Ar target-session 1003.D1 (alias: Ic has ) 1004Report an error and exit with 1 if the specified session does not exist. 1005If it does exist, exit with 0. 1006.It Ic kill-server 1007Kill the 1008.Nm 1009server and clients and destroy all sessions. 1010.It Xo Ic kill-session 1011.Op Fl aC 1012.Op Fl t Ar target-session 1013.Xc 1014Destroy the given session, closing any windows linked to it and no other 1015sessions, and detaching all clients attached to it. 1016If 1017.Fl a 1018is given, all sessions but the specified one is killed. 1019The 1020.Fl C 1021flag clears alerts (bell, activity, or silence) in all windows linked to the 1022session. 1023.It Xo Ic list-clients 1024.Op Fl F Ar format 1025.Op Fl t Ar target-session 1026.Xc 1027.D1 (alias: Ic lsc ) 1028List all clients attached to the server. 1029For the meaning of the 1030.Fl F 1031flag, see the 1032.Sx FORMATS 1033section. 1034If 1035.Ar target-session 1036is specified, list only clients connected to that session. 1037.It Xo Ic list-commands 1038.Op Fl F Ar format 1039.Op Ar command 1040.Xc 1041.D1 (alias: Ic lscm ) 1042List the syntax of 1043.Ar command 1044or - if omitted - of all commands supported by 1045.Nm . 1046.It Ic list-sessions Op Fl F Ar format 1047.D1 (alias: Ic ls ) 1048List all sessions managed by the server. 1049For the meaning of the 1050.Fl F 1051flag, see the 1052.Sx FORMATS 1053section. 1054.It Ic lock-client Op Fl t Ar target-client 1055.D1 (alias: Ic lockc ) 1056Lock 1057.Ar target-client , 1058see the 1059.Ic lock-server 1060command. 1061.It Ic lock-session Op Fl t Ar target-session 1062.D1 (alias: Ic locks ) 1063Lock all clients attached to 1064.Ar target-session . 1065.It Xo Ic new-session 1066.Op Fl AdDEPX 1067.Op Fl c Ar start-directory 1068.Op Fl F Ar format 1069.Op Fl n Ar window-name 1070.Op Fl s Ar session-name 1071.Op Fl t Ar group-name 1072.Op Fl x Ar width 1073.Op Fl y Ar height 1074.Op Ar shell-command 1075.Xc 1076.D1 (alias: Ic new ) 1077Create a new session with name 1078.Ar session-name . 1079.Pp 1080The new session is attached to the current terminal unless 1081.Fl d 1082is given. 1083.Ar window-name 1084and 1085.Ar shell-command 1086are the name of and shell command to execute in the initial window. 1087With 1088.Fl d , 1089the initial size comes from the global 1090.Ic default-size 1091option; 1092.Fl x 1093and 1094.Fl y 1095can be used to specify a different size. 1096.Ql - 1097uses the size of the current client if any. 1098If 1099.Fl x 1100or 1101.Fl y 1102is given, the 1103.Ic default-size 1104option is set for the session. 1105.Pp 1106If run from a terminal, any 1107.Xr termios 4 1108special characters are saved and used for new windows in the new session. 1109.Pp 1110The 1111.Fl A 1112flag makes 1113.Ic new-session 1114behave like 1115.Ic attach-session 1116if 1117.Ar session-name 1118already exists; in this case, 1119.Fl D 1120behaves like 1121.Fl d 1122to 1123.Ic attach-session , 1124and 1125.Fl X 1126behaves like 1127.Fl x 1128to 1129.Ic attach-session . 1130.Pp 1131If 1132.Fl t 1133is given, it specifies a 1134.Ic session group . 1135Sessions in the same group share the same set of windows - new windows are 1136linked to all sessions in the group and any windows closed removed from all 1137sessions. 1138The current and previous window and any session options remain independent and 1139any session in a group may be killed without affecting the others. 1140The 1141.Ar group-name 1142argument may be: 1143.Bl -enum -width Ds 1144.It 1145the name of an existing group, in which case the new session is added to that 1146group; 1147.It 1148the name of an existing session - the new session is added to the same group 1149as that session, creating a new group if necessary; 1150.It 1151the name for a new group containing only the new session. 1152.El 1153.Pp 1154.Fl n 1155and 1156.Ar shell-command 1157are invalid if 1158.Fl t 1159is used. 1160.Pp 1161The 1162.Fl P 1163option prints information about the new session after it has been created. 1164By default, it uses the format 1165.Ql #{session_name}:\& 1166but a different format may be specified with 1167.Fl F . 1168.Pp 1169If 1170.Fl E 1171is used, the 1172.Ic update-environment 1173option will not be applied. 1174.It Xo Ic refresh-client 1175.Op Fl cDlLRSU 1176.Op Fl C Ar XxY 1177.Op Fl F Ar flags 1178.Op Fl t Ar target-client 1179.Op Ar adjustment 1180.Xc 1181.D1 (alias: Ic refresh ) 1182Refresh the current client if bound to a key, or a single client if one is given 1183with 1184.Fl t . 1185If 1186.Fl S 1187is specified, only update the client's status line. 1188.Pp 1189The 1190.Fl U , 1191.Fl D , 1192.Fl L 1193.Fl R , 1194and 1195.Fl c 1196flags allow the visible portion of a window which is larger than the client 1197to be changed. 1198.Fl U 1199moves the visible part up by 1200.Ar adjustment 1201rows and 1202.Fl D 1203down, 1204.Fl L 1205left by 1206.Ar adjustment 1207columns and 1208.Fl R 1209right. 1210.Fl c 1211returns to tracking the cursor automatically. 1212If 1213.Ar adjustment 1214is omitted, 1 is used. 1215Note that the visible position is a property of the client not of the 1216window, changing the current window in the attached session will reset 1217it. 1218.Pp 1219.Fl C 1220sets the width and height of a control client and 1221.Fl F 1222sets a comma-separated list of flags. 1223Currently the only flag available is 1224.Ql no-output 1225to disable receiving pane output. 1226.Pp 1227.Fl l 1228requests the clipboard from the client using the 1229.Xr xterm 1 1230escape sequence and stores it in a new paste buffer. 1231.Pp 1232.Fl L , 1233.Fl R , 1234.Fl U 1235and 1236.Fl D 1237move the visible portion of the window left, right, up or down 1238by 1239.Ar adjustment , 1240if the window is larger than the client. 1241.Fl c 1242resets so that the position follows the cursor. 1243See the 1244.Ic window-size 1245option. 1246.It Xo Ic rename-session 1247.Op Fl t Ar target-session 1248.Ar new-name 1249.Xc 1250.D1 (alias: Ic rename ) 1251Rename the session to 1252.Ar new-name . 1253.It Xo Ic show-messages 1254.Op Fl JT 1255.Op Fl t Ar target-client 1256.Xc 1257.D1 (alias: Ic showmsgs ) 1258Show client messages or server information. 1259Any messages displayed on the status line are saved in a per-client message 1260log, up to a maximum of the limit set by the 1261.Ar message-limit 1262server option. 1263With 1264.Fl t , 1265display the log for 1266.Ar target-client . 1267.Fl J 1268and 1269.Fl T 1270show debugging information about jobs and terminals. 1271.It Xo Ic source-file 1272.Op Fl nqv 1273.Ar path 1274.Ar ... 1275.Xc 1276.D1 (alias: Ic source ) 1277Execute commands from one or more files specified by 1278.Ar path 1279(which may be 1280.Xr glob 7 1281patterns). 1282If 1283.Fl q 1284is given, no error will be returned if 1285.Ar path 1286does not exist. 1287With 1288.Fl n , 1289the file is parsed but no commands are executed. 1290.Fl v 1291shows the parsed commands and line numbers if possible. 1292.It Ic start-server 1293.D1 (alias: Ic start ) 1294Start the 1295.Nm 1296server, if not already running, without creating any sessions. 1297.Pp 1298Note that as by default the 1299.Nm 1300server will exit with no sessions, this is only useful if a session is created in 1301.Pa ~/.tmux.conf , 1302.Ic exit-empty 1303is turned off, or another command is run as part of the same command sequence. 1304For example: 1305.Bd -literal -offset indent 1306$ tmux start \\; show -g 1307.Ed 1308.It Xo Ic suspend-client 1309.Op Fl t Ar target-client 1310.Xc 1311.D1 (alias: Ic suspendc ) 1312Suspend a client by sending 1313.Dv SIGTSTP 1314(tty stop). 1315.It Xo Ic switch-client 1316.Op Fl ElnprZ 1317.Op Fl c Ar target-client 1318.Op Fl t Ar target-session 1319.Op Fl T Ar key-table 1320.Xc 1321.D1 (alias: Ic switchc ) 1322Switch the current session for client 1323.Ar target-client 1324to 1325.Ar target-session . 1326As a special case, 1327.Fl t 1328may refer to a pane (a target that contains 1329.Ql \&: , 1330.Ql \&. 1331or 1332.Ql % ) , 1333to change session, window and pane. 1334In that case, 1335.Fl Z 1336keeps the window zoomed if it was zoomed. 1337If 1338.Fl l , 1339.Fl n 1340or 1341.Fl p 1342is used, the client is moved to the last, next or previous session 1343respectively. 1344.Fl r 1345toggles whether a client is read-only (see the 1346.Ic attach-session 1347command). 1348.Pp 1349If 1350.Fl E 1351is used, 1352.Ic update-environment 1353option will not be applied. 1354.Pp 1355.Fl T 1356sets the client's key table; the next key from the client will be interpreted 1357from 1358.Ar key-table . 1359This may be used to configure multiple prefix keys, or to bind commands to 1360sequences of keys. 1361For example, to make typing 1362.Ql abc 1363run the 1364.Ic list-keys 1365command: 1366.Bd -literal -offset indent 1367bind-key -Ttable2 c list-keys 1368bind-key -Ttable1 b switch-client -Ttable2 1369bind-key -Troot a switch-client -Ttable1 1370.Ed 1371.El 1372.Sh WINDOWS AND PANES 1373Each window displayed by 1374.Nm 1375may be split into one or more 1376.Em panes ; 1377each pane takes up a certain area of the display and is a separate terminal. 1378A window may be split into panes using the 1379.Ic split-window 1380command. 1381Windows may be split horizontally (with the 1382.Fl h 1383flag) or vertically. 1384Panes may be resized with the 1385.Ic resize-pane 1386command (bound to 1387.Ql C-Up , 1388.Ql C-Down 1389.Ql C-Left 1390and 1391.Ql C-Right 1392by default), the current pane may be changed with the 1393.Ic select-pane 1394command and the 1395.Ic rotate-window 1396and 1397.Ic swap-pane 1398commands may be used to swap panes without changing their position. 1399Panes are numbered beginning from zero in the order they are created. 1400.Pp 1401By default, a 1402.Nm 1403pane permits direct access to the terminal contained in the pane. 1404A pane may also be put into one of several modes: 1405.Bl -dash -offset indent 1406.It 1407Copy mode, which permits a section of a window or its 1408history to be copied to a 1409.Em paste buffer 1410for later insertion into another window. 1411This mode is entered with the 1412.Ic copy-mode 1413command, bound to 1414.Ql \&[ 1415by default. 1416.It 1417View mode, which is like copy mode but is entered when a command that produces 1418output, such as 1419.Ic list-keys , 1420is executed from a key binding. 1421.It 1422Choose mode, which allows an item to be chosen from a list. 1423This may be a client, a session or window or pane, or a buffer. 1424This mode is entered with the 1425.Ic choose-buffer , 1426.Ic choose-client 1427and 1428.Ic choose-tree 1429commands. 1430.El 1431.Pp 1432In copy mode an indicator is displayed in the top-right corner of the pane with 1433the current position and the number of lines in the history. 1434.Pp 1435Commands are sent to copy mode using the 1436.Fl X 1437flag to the 1438.Ic send-keys 1439command. 1440When a key is pressed, copy mode automatically uses one of two key tables, 1441depending on the 1442.Ic mode-keys 1443option: 1444.Ic copy-mode 1445for emacs, or 1446.Ic copy-mode-vi 1447for vi. 1448Key tables may be viewed with the 1449.Ic list-keys 1450command. 1451.Pp 1452The following commands are supported in copy mode: 1453.Bl -column "CommandXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent 1454.It Sy "Command" Ta Sy "vi" Ta Sy "emacs" 1455.It Li "append-selection" Ta "" Ta "" 1456.It Li "append-selection-and-cancel" Ta "A" Ta "" 1457.It Li "back-to-indentation" Ta "^" Ta "M-m" 1458.It Li "begin-selection" Ta "Space" Ta "C-Space" 1459.It Li "bottom-line" Ta "L" Ta "" 1460.It Li "cancel" Ta "q" Ta "Escape" 1461.It Li "clear-selection" Ta "Escape" Ta "C-g" 1462.It Li "copy-end-of-line [<prefix>]" Ta "D" Ta "C-k" 1463.It Li "copy-line [<prefix>]" Ta "" Ta "" 1464.It Li "copy-pipe <command> [<prefix>]" Ta "" Ta "" 1465.It Li "copy-pipe-no-clear <command> [<prefix>]" Ta "" Ta "" 1466.It Li "copy-pipe-and-cancel <command> [<prefix>]" Ta "" Ta "" 1467.It Li "copy-selection [<prefix>]" Ta "" Ta "" 1468.It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta "" 1469.It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w" 1470.It Li "cursor-down" Ta "j" Ta "Down" 1471.It Li "cursor-down-and-cancel" Ta "" Ta "" 1472.It Li "cursor-left" Ta "h" Ta "Left" 1473.It Li "cursor-right" Ta "l" Ta "Right" 1474.It Li "cursor-up" Ta "k" Ta "Up" 1475.It Li "end-of-line" Ta "$" Ta "C-e" 1476.It Li "goto-line <line>" Ta ":" Ta "g" 1477.It Li "halfpage-down" Ta "C-d" Ta "M-Down" 1478.It Li "halfpage-down-and-cancel" Ta "" Ta "" 1479.It Li "halfpage-up" Ta "C-u" Ta "M-Up" 1480.It Li "history-bottom" Ta "G" Ta "M->" 1481.It Li "history-top" Ta "g" Ta "M-<" 1482.It Li "jump-again" Ta ";" Ta ";" 1483.It Li "jump-backward <to>" Ta "F" Ta "F" 1484.It Li "jump-forward <to>" Ta "f" Ta "f" 1485.It Li "jump-reverse" Ta "," Ta "," 1486.It Li "jump-to-backward <to>" Ta "T" Ta "" 1487.It Li "jump-to-forward <to>" Ta "t" Ta "" 1488.It Li "middle-line" Ta "M" Ta "M-r" 1489.It Li "next-matching-bracket" Ta "%" Ta "M-C-f" 1490.It Li "next-paragraph" Ta "}" Ta "M-}" 1491.It Li "next-space" Ta "W" Ta "" 1492.It Li "next-space-end" Ta "E" Ta "" 1493.It Li "next-word" Ta "w" Ta "" 1494.It Li "next-word-end" Ta "e" Ta "M-f" 1495.It Li "other-end" Ta "o" Ta "" 1496.It Li "page-down" Ta "C-f" Ta "PageDown" 1497.It Li "page-down-and-cancel" Ta "" Ta "" 1498.It Li "page-up" Ta "C-b" Ta "PageUp" 1499.It Li "previous-matching-bracket" Ta "" Ta "M-C-b" 1500.It Li "previous-paragraph" Ta "{" Ta "M-{" 1501.It Li "previous-space" Ta "B" Ta "" 1502.It Li "previous-word" Ta "b" Ta "M-b" 1503.It Li "rectangle-toggle" Ta "v" Ta "R" 1504.It Li "scroll-down" Ta "C-e" Ta "C-Down" 1505.It Li "scroll-down-and-cancel" Ta "" Ta "" 1506.It Li "scroll-up" Ta "C-y" Ta "C-Up" 1507.It Li "search-again" Ta "n" Ta "n" 1508.It Li "search-backward <for>" Ta "?" Ta "" 1509.It Li "search-backward-incremental <for>" Ta "" Ta "C-r" 1510.It Li "search-backward-text <for>" Ta "" Ta "" 1511.It Li "search-forward <for>" Ta "/" Ta "" 1512.It Li "search-forward-incremental <for>" Ta "" Ta "C-s" 1513.It Li "search-forward-text <for>" Ta "" Ta "" 1514.It Li "search-reverse" Ta "N" Ta "N" 1515.It Li "select-line" Ta "V" Ta "" 1516.It Li "select-word" Ta "" Ta "" 1517.It Li "start-of-line" Ta "0" Ta "C-a" 1518.It Li "stop-selection" Ta "" Ta "" 1519.It Li "top-line" Ta "H" Ta "M-R" 1520.El 1521.Pp 1522The search commands come in several varieties: 1523.Ql search-forward 1524and 1525.Ql search-backward 1526search for a regular expression; 1527the 1528.Ql -text 1529variants search for a plain text string rather than a regular expression; 1530.Ql -incremental 1531perform an incremental search and expect to be used with the 1532.Fl i 1533flag to the 1534.Ic command-prompt 1535command. 1536.Ql search-again 1537repeats the last search and 1538.Ql search-reverse 1539does the same but reverses the direction (forward becomes backward and backward 1540becomes forward). 1541.Pp 1542Copy commands may take an optional buffer prefix argument which is used 1543to generate the buffer name (the default is 1544.Ql buffer 1545so buffers are named 1546.Ql buffer0 , 1547.Ql buffer1 1548and so on). 1549Pipe commands take a command argument which is the command to which the 1550copied text is piped. 1551The 1552.Ql -and-cancel 1553variants of some commands exit copy mode after they have completed (for copy 1554commands) or when the cursor reaches the bottom (for scrolling commands). 1555.Ql -no-clear 1556variants do not clear the selection. 1557.Pp 1558The next and previous word keys use space and the 1559.Ql - , 1560.Ql _ 1561and 1562.Ql @ 1563characters as word delimiters by default, but this can be adjusted by 1564setting the 1565.Em word-separators 1566session option. 1567Next word moves to the start of the next word, next word end to the end of the 1568next word and previous word to the start of the previous word. 1569The three next and previous space keys work similarly but use a space alone as 1570the word separator. 1571.Pp 1572The jump commands enable quick movement within a line. 1573For instance, typing 1574.Ql f 1575followed by 1576.Ql / 1577will move the cursor to the next 1578.Ql / 1579character on the current line. 1580A 1581.Ql \&; 1582will then jump to the next occurrence. 1583.Pp 1584Commands in copy mode may be prefaced by an optional repeat count. 1585With vi key bindings, a prefix is entered using the number keys; with 1586emacs, the Alt (meta) key and a number begins prefix entry. 1587.Pp 1588The synopsis for the 1589.Ic copy-mode 1590command is: 1591.Bl -tag -width Ds 1592.It Xo Ic copy-mode 1593.Op Fl eHMqu 1594.Op Fl t Ar target-pane 1595.Xc 1596Enter copy mode. 1597The 1598.Fl u 1599option scrolls one page up. 1600.Fl M 1601begins a mouse drag (only valid if bound to a mouse key binding, see 1602.Sx MOUSE SUPPORT ) . 1603.Fl H 1604hides the position indicator in the top right. 1605.Fl q 1606cancels copy mode and any other modes. 1607.Pp 1608.Fl e 1609specifies that scrolling to the bottom of the history (to the visible screen) 1610should exit copy mode. 1611While in copy mode, pressing a key other than those used for scrolling will 1612disable this behaviour. 1613This is intended to allow fast scrolling through a pane's history, for 1614example with: 1615.Bd -literal -offset indent 1616bind PageUp copy-mode -eu 1617.Ed 1618.El 1619.Pp 1620A number of preset arrangements of panes are available, these are called layouts. 1621These may be selected with the 1622.Ic select-layout 1623command or cycled with 1624.Ic next-layout 1625(bound to 1626.Ql Space 1627by default); once a layout is chosen, panes within it may be moved and resized 1628as normal. 1629.Pp 1630The following layouts are supported: 1631.Bl -tag -width Ds 1632.It Ic even-horizontal 1633Panes are spread out evenly from left to right across the window. 1634.It Ic even-vertical 1635Panes are spread evenly from top to bottom. 1636.It Ic main-horizontal 1637A large (main) pane is shown at the top of the window and the remaining panes 1638are spread from left to right in the leftover space at the bottom. 1639Use the 1640.Em main-pane-height 1641window option to specify the height of the top pane. 1642.It Ic main-vertical 1643Similar to 1644.Ic main-horizontal 1645but the large pane is placed on the left and the others spread from top to 1646bottom along the right. 1647See the 1648.Em main-pane-width 1649window option. 1650.It Ic tiled 1651Panes are spread out as evenly as possible over the window in both rows and 1652columns. 1653.El 1654.Pp 1655In addition, 1656.Ic select-layout 1657may be used to apply a previously used layout - the 1658.Ic list-windows 1659command displays the layout of each window in a form suitable for use with 1660.Ic select-layout . 1661For example: 1662.Bd -literal -offset indent 1663$ tmux list-windows 16640: ksh [159x48] 1665 layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1666$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1667.Ed 1668.Pp 1669.Nm 1670automatically adjusts the size of the layout for the current window size. 1671Note that a layout cannot be applied to a window with more panes than that 1672from which the layout was originally defined. 1673.Pp 1674Commands related to windows and panes are as follows: 1675.Bl -tag -width Ds 1676.It Xo Ic break-pane 1677.Op Fl dP 1678.Op Fl F Ar format 1679.Op Fl n Ar window-name 1680.Op Fl s Ar src-pane 1681.Op Fl t Ar dst-window 1682.Xc 1683.D1 (alias: Ic breakp ) 1684Break 1685.Ar src-pane 1686off from its containing window to make it the only pane in 1687.Ar dst-window . 1688If 1689.Fl d 1690is given, the new window does not become the current window. 1691The 1692.Fl P 1693option prints information about the new window after it has been created. 1694By default, it uses the format 1695.Ql #{session_name}:#{window_index} 1696but a different format may be specified with 1697.Fl F . 1698.It Xo Ic capture-pane 1699.Op Fl aepPqCJN 1700.Op Fl b Ar buffer-name 1701.Op Fl E Ar end-line 1702.Op Fl S Ar start-line 1703.Op Fl t Ar target-pane 1704.Xc 1705.D1 (alias: Ic capturep ) 1706Capture the contents of a pane. 1707If 1708.Fl p 1709is given, the output goes to stdout, otherwise to the buffer specified with 1710.Fl b 1711or a new buffer if omitted. 1712If 1713.Fl a 1714is given, the alternate screen is used, and the history is not accessible. 1715If no alternate screen exists, an error will be returned unless 1716.Fl q 1717is given. 1718If 1719.Fl e 1720is given, the output includes escape sequences for text and background 1721attributes. 1722.Fl C 1723also escapes non-printable characters as octal \exxx. 1724.Fl N 1725preserves trailing spaces at each line's end and 1726.Fl J 1727preserves trailing spaces and joins any wrapped lines. 1728.Fl P 1729captures only any output that the pane has received that is the beginning of an 1730as-yet incomplete escape sequence. 1731.Pp 1732.Fl S 1733and 1734.Fl E 1735specify the starting and ending line numbers, zero is the first line of the 1736visible pane and negative numbers are lines in the history. 1737.Ql - 1738to 1739.Fl S 1740is the start of the history and to 1741.Fl E 1742the end of the visible pane. 1743The default is to capture only the visible contents of the pane. 1744.It Xo 1745.Ic choose-client 1746.Op Fl NrZ 1747.Op Fl F Ar format 1748.Op Fl f Ar filter 1749.Op Fl O Ar sort-order 1750.Op Fl t Ar target-pane 1751.Op Ar template 1752.Xc 1753Put a pane into client mode, allowing a client to be selected interactively from 1754a list. 1755.Fl Z 1756zooms the pane. 1757The following keys may be used in client mode: 1758.Bl -column "Key" "Function" -offset indent 1759.It Sy "Key" Ta Sy "Function" 1760.It Li "Enter" Ta "Choose selected client" 1761.It Li "Up" Ta "Select previous client" 1762.It Li "Down" Ta "Select next client" 1763.It Li "C-s" Ta "Search by name" 1764.It Li "n" Ta "Repeat last search" 1765.It Li "t" Ta "Toggle if client is tagged" 1766.It Li "T" Ta "Tag no clients" 1767.It Li "C-t" Ta "Tag all clients" 1768.It Li "d" Ta "Detach selected client" 1769.It Li "D" Ta "Detach tagged clients" 1770.It Li "x" Ta "Detach and HUP selected client" 1771.It Li "X" Ta "Detach and HUP tagged clients" 1772.It Li "z" Ta "Suspend selected client" 1773.It Li "Z" Ta "Suspend tagged clients" 1774.It Li "f" Ta "Enter a format to filter items" 1775.It Li "O" Ta "Change sort field" 1776.It Li "r" Ta "Reverse sort order" 1777.It Li "v" Ta "Toggle preview" 1778.It Li "q" Ta "Exit mode" 1779.El 1780.Pp 1781After a client is chosen, 1782.Ql %% 1783is replaced by the client name in 1784.Ar template 1785and the result executed as a command. 1786If 1787.Ar template 1788is not given, "detach-client -t '%%'" is used. 1789.Pp 1790.Fl O 1791specifies the initial sort field: one of 1792.Ql name , 1793.Ql size , 1794.Ql creation , 1795or 1796.Ql activity . 1797.Fl r 1798reverses the sort order. 1799.Fl f 1800specifies an initial filter: the filter is a format - if it evaluates to zero, 1801the item in the list is not shown, otherwise it is shown. 1802If a filter would lead to an empty list, it is ignored. 1803.Fl F 1804specifies the format for each item in the list. 1805.Fl N 1806starts without the preview. 1807This command works only if at least one client is attached. 1808.It Xo 1809.Ic choose-tree 1810.Op Fl GNrswZ 1811.Op Fl F Ar format 1812.Op Fl f Ar filter 1813.Op Fl O Ar sort-order 1814.Op Fl t Ar target-pane 1815.Op Ar template 1816.Xc 1817Put a pane into tree mode, where a session, window or pane may be chosen 1818interactively from a list. 1819.Fl s 1820starts with sessions collapsed and 1821.Fl w 1822with windows collapsed. 1823.Fl Z 1824zooms the pane. 1825The following keys may be used in tree mode: 1826.Bl -column "Key" "Function" -offset indent 1827.It Sy "Key" Ta Sy "Function" 1828.It Li "Enter" Ta "Choose selected item" 1829.It Li "Up" Ta "Select previous item" 1830.It Li "Down" Ta "Select next item" 1831.It Li "x" Ta "Kill selected item" 1832.It Li "X" Ta "Kill tagged items" 1833.It Li "<" Ta "Scroll list of previews left" 1834.It Li ">" Ta "Scroll list of previews right" 1835.It Li "C-s" Ta "Search by name" 1836.It Li "n" Ta "Repeat last search" 1837.It Li "t" Ta "Toggle if item is tagged" 1838.It Li "T" Ta "Tag no items" 1839.It Li "C-t" Ta "Tag all items" 1840.It Li "\&:" Ta "Run a command for each tagged item" 1841.It Li "f" Ta "Enter a format to filter items" 1842.It Li "O" Ta "Change sort field" 1843.It Li "r" Ta "Reverse sort order" 1844.It Li "v" Ta "Toggle preview" 1845.It Li "q" Ta "Exit mode" 1846.El 1847.Pp 1848After a session, window or pane is chosen, 1849.Ql %% 1850is replaced by the target in 1851.Ar template 1852and the result executed as a command. 1853If 1854.Ar template 1855is not given, "switch-client -t '%%'" is used. 1856.Pp 1857.Fl O 1858specifies the initial sort field: one of 1859.Ql index , 1860.Ql name , 1861or 1862.Ql time . 1863.Fl r 1864reverses the sort order. 1865.Fl f 1866specifies an initial filter: the filter is a format - if it evaluates to zero, 1867the item in the list is not shown, otherwise it is shown. 1868If a filter would lead to an empty list, it is ignored. 1869.Fl F 1870specifies the format for each item in the tree. 1871.Fl N 1872starts without the preview. 1873.Fl G 1874includes all sessions in any session groups in the tree rather than only the 1875first. 1876This command works only if at least one client is attached. 1877.It Xo 1878.Ic display-panes 1879.Op Fl b 1880.Op Fl d Ar duration 1881.Op Fl t Ar target-client 1882.Op Ar template 1883.Xc 1884.D1 (alias: Ic displayp ) 1885Display a visible indicator of each pane shown by 1886.Ar target-client . 1887See the 1888.Ic display-panes-colour 1889and 1890.Ic display-panes-active-colour 1891session options. 1892The indicator is closed when a key is pressed or 1893.Ar duration 1894milliseconds have passed. 1895If 1896.Fl d 1897is not given, 1898.Ic display-panes-time 1899is used. 1900A duration of zero means the indicator stays until a key is pressed. 1901While the indicator is on screen, a pane may be chosen with the 1902.Ql 0 1903to 1904.Ql 9 1905keys, which will cause 1906.Ar template 1907to be executed as a command with 1908.Ql %% 1909substituted by the pane ID. 1910The default 1911.Ar template 1912is "select-pane -t '%%'". 1913With 1914.Fl b , 1915other commands are not blocked from running until the indicator is closed. 1916.It Xo Ic find-window 1917.Op Fl rCNTZ 1918.Op Fl t Ar target-pane 1919.Ar match-string 1920.Xc 1921.D1 (alias: Ic findw ) 1922Search for a 1923.Xr fnmatch 3 1924pattern or, with 1925.Fl r , 1926regular expression 1927.Ar match-string 1928in window names, titles, and visible content (but not history). 1929The flags control matching behavior: 1930.Fl C 1931matches only visible window contents, 1932.Fl N 1933matches only the window name and 1934.Fl T 1935matches only the window title. 1936The default is 1937.Fl CNT . 1938.Fl Z 1939zooms the pane. 1940.Pp 1941This command works only if at least one client is attached. 1942.It Xo Ic join-pane 1943.Op Fl bdfhv 1944.Op Fl l Ar size 1945.Op Fl s Ar src-pane 1946.Op Fl t Ar dst-pane 1947.Xc 1948.D1 (alias: Ic joinp ) 1949Like 1950.Ic split-window , 1951but instead of splitting 1952.Ar dst-pane 1953and creating a new pane, split it and move 1954.Ar src-pane 1955into the space. 1956This can be used to reverse 1957.Ic break-pane . 1958The 1959.Fl b 1960option causes 1961.Ar src-pane 1962to be joined to left of or above 1963.Ar dst-pane . 1964.Pp 1965If 1966.Fl s 1967is omitted and a marked pane is present (see 1968.Ic select-pane 1969.Fl m ) , 1970the marked pane is used rather than the current pane. 1971.It Xo Ic kill-pane 1972.Op Fl a 1973.Op Fl t Ar target-pane 1974.Xc 1975.D1 (alias: Ic killp ) 1976Destroy the given pane. 1977If no panes remain in the containing window, it is also destroyed. 1978The 1979.Fl a 1980option kills all but the pane given with 1981.Fl t . 1982.It Xo Ic kill-window 1983.Op Fl a 1984.Op Fl t Ar target-window 1985.Xc 1986.D1 (alias: Ic killw ) 1987Kill the current window or the window at 1988.Ar target-window , 1989removing it from any sessions to which it is linked. 1990The 1991.Fl a 1992option kills all but the window given with 1993.Fl t . 1994.It Xo Ic last-pane 1995.Op Fl deZ 1996.Op Fl t Ar target-window 1997.Xc 1998.D1 (alias: Ic lastp ) 1999Select the last (previously selected) pane. 2000.Fl Z 2001keeps the window zoomed if it was zoomed. 2002.Fl e 2003enables or 2004.Fl d 2005disables input to the pane. 2006.It Ic last-window Op Fl t Ar target-session 2007.D1 (alias: Ic last ) 2008Select the last (previously selected) window. 2009If no 2010.Ar target-session 2011is specified, select the last window of the current session. 2012.It Xo Ic link-window 2013.Op Fl adk 2014.Op Fl s Ar src-window 2015.Op Fl t Ar dst-window 2016.Xc 2017.D1 (alias: Ic linkw ) 2018Link the window at 2019.Ar src-window 2020to the specified 2021.Ar dst-window . 2022If 2023.Ar dst-window 2024is specified and no such window exists, the 2025.Ar src-window 2026is linked there. 2027With 2028.Fl a , 2029the window is moved to the next index up (following windows 2030are moved if necessary). 2031If 2032.Fl k 2033is given and 2034.Ar dst-window 2035exists, it is killed, otherwise an error is generated. 2036If 2037.Fl d 2038is given, the newly linked window is not selected. 2039.It Xo Ic list-panes 2040.Op Fl as 2041.Op Fl F Ar format 2042.Op Fl t Ar target 2043.Xc 2044.D1 (alias: Ic lsp ) 2045If 2046.Fl a 2047is given, 2048.Ar target 2049is ignored and all panes on the server are listed. 2050If 2051.Fl s 2052is given, 2053.Ar target 2054is a session (or the current session). 2055If neither is given, 2056.Ar target 2057is a window (or the current window). 2058For the meaning of the 2059.Fl F 2060flag, see the 2061.Sx FORMATS 2062section. 2063.It Xo Ic list-windows 2064.Op Fl a 2065.Op Fl F Ar format 2066.Op Fl t Ar target-session 2067.Xc 2068.D1 (alias: Ic lsw ) 2069If 2070.Fl a 2071is given, list all windows on the server. 2072Otherwise, list windows in the current session or in 2073.Ar target-session . 2074For the meaning of the 2075.Fl F 2076flag, see the 2077.Sx FORMATS 2078section. 2079.It Xo Ic move-pane 2080.Op Fl bdhv 2081.Op Fl l Ar size 2082.Op Fl s Ar src-pane 2083.Op Fl t Ar dst-pane 2084.Xc 2085.D1 (alias: Ic movep ) 2086Like 2087.Ic join-pane , 2088but 2089.Ar src-pane 2090and 2091.Ar dst-pane 2092may belong to the same window. 2093.It Xo Ic move-window 2094.Op Fl ardk 2095.Op Fl s Ar src-window 2096.Op Fl t Ar dst-window 2097.Xc 2098.D1 (alias: Ic movew ) 2099This is similar to 2100.Ic link-window , 2101except the window at 2102.Ar src-window 2103is moved to 2104.Ar dst-window . 2105With 2106.Fl r , 2107all windows in the session are renumbered in sequential order, respecting 2108the 2109.Ic base-index 2110option. 2111.It Xo Ic new-window 2112.Op Fl adkP 2113.Op Fl c Ar start-directory 2114.Op Fl e Ar environment 2115.Op Fl F Ar format 2116.Op Fl n Ar window-name 2117.Op Fl t Ar target-window 2118.Op Ar shell-command 2119.Xc 2120.D1 (alias: Ic neww ) 2121Create a new window. 2122With 2123.Fl a , 2124the new window is inserted at the next index up from the specified 2125.Ar target-window , 2126moving windows up if necessary, 2127otherwise 2128.Ar target-window 2129is the new window location. 2130.Pp 2131If 2132.Fl d 2133is given, the session does not make the new window the current window. 2134.Ar target-window 2135represents the window to be created; if the target already exists an error is 2136shown, unless the 2137.Fl k 2138flag is used, in which case it is destroyed. 2139.Ar shell-command 2140is the command to execute. 2141If 2142.Ar shell-command 2143is not specified, the value of the 2144.Ic default-command 2145option is used. 2146.Fl c 2147specifies the working directory in which the new window is created. 2148.Pp 2149When the shell command completes, the window closes. 2150See the 2151.Ic remain-on-exit 2152option to change this behaviour. 2153.Pp 2154.Fl e 2155takes the form 2156.Ql VARIABLE=value 2157and sets an environment variable for the newly created window; it may be 2158specified multiple times. 2159.Pp 2160The 2161.Ev TERM 2162environment variable must be set to 2163.Ql screen 2164or 2165.Ql tmux 2166for all programs running 2167.Em inside 2168.Nm . 2169New windows will automatically have 2170.Ql TERM=screen 2171added to their environment, but care must be taken not to reset this in shell 2172start-up files or by the 2173.Fl e 2174option. 2175.Pp 2176The 2177.Fl P 2178option prints information about the new window after it has been created. 2179By default, it uses the format 2180.Ql #{session_name}:#{window_index} 2181but a different format may be specified with 2182.Fl F . 2183.It Ic next-layout Op Fl t Ar target-window 2184.D1 (alias: Ic nextl ) 2185Move a window to the next layout and rearrange the panes to fit. 2186.It Xo Ic next-window 2187.Op Fl a 2188.Op Fl t Ar target-session 2189.Xc 2190.D1 (alias: Ic next ) 2191Move to the next window in the session. 2192If 2193.Fl a 2194is used, move to the next window with an alert. 2195.It Xo Ic pipe-pane 2196.Op Fl IOo 2197.Op Fl t Ar target-pane 2198.Op Ar shell-command 2199.Xc 2200.D1 (alias: Ic pipep ) 2201Pipe output sent by the program in 2202.Ar target-pane 2203to a shell command or vice versa. 2204A pane may only be connected to one command at a time, any existing pipe is 2205closed before 2206.Ar shell-command 2207is executed. 2208The 2209.Ar shell-command 2210string may contain the special character sequences supported by the 2211.Ic status-left 2212option. 2213If no 2214.Ar shell-command 2215is given, the current pipe (if any) is closed. 2216.Pp 2217.Fl I 2218and 2219.Fl O 2220specify which of the 2221.Ar shell-command 2222output streams are connected to the pane: 2223with 2224.Fl I 2225stdout is connected (so anything 2226.Ar shell-command 2227prints is written to the pane as if it were typed); 2228with 2229.Fl O 2230stdin is connected (so any output in the pane is piped to 2231.Ar shell-command ) . 2232Both may be used together and if neither are specified, 2233.Fl O 2234is used. 2235.Pp 2236The 2237.Fl o 2238option only opens a new pipe if no previous pipe exists, allowing a pipe to 2239be toggled with a single key, for example: 2240.Bd -literal -offset indent 2241bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P' 2242.Ed 2243.It Xo Ic previous-layout 2244.Op Fl t Ar target-window 2245.Xc 2246.D1 (alias: Ic prevl ) 2247Move to the previous layout in the session. 2248.It Xo Ic previous-window 2249.Op Fl a 2250.Op Fl t Ar target-session 2251.Xc 2252.D1 (alias: Ic prev ) 2253Move to the previous window in the session. 2254With 2255.Fl a , 2256move to the previous window with an alert. 2257.It Xo Ic rename-window 2258.Op Fl t Ar target-window 2259.Ar new-name 2260.Xc 2261.D1 (alias: Ic renamew ) 2262Rename the current window, or the window at 2263.Ar target-window 2264if specified, to 2265.Ar new-name . 2266.It Xo Ic resize-pane 2267.Op Fl DLMRUZ 2268.Op Fl t Ar target-pane 2269.Op Fl x Ar width 2270.Op Fl y Ar height 2271.Op Ar adjustment 2272.Xc 2273.D1 (alias: Ic resizep ) 2274Resize a pane, up, down, left or right by 2275.Ar adjustment 2276with 2277.Fl U , 2278.Fl D , 2279.Fl L 2280or 2281.Fl R , 2282or 2283to an absolute size 2284with 2285.Fl x 2286or 2287.Fl y . 2288The 2289.Ar adjustment 2290is given in lines or columns (the default is 1); 2291.Fl x 2292and 2293.Fl y 2294may be a given as a number of lines or columns or followed by 2295.Ql % 2296for a percentage of the window size (for example 2297.Ql -x 10% ) . 2298With 2299.Fl Z , 2300the active pane is toggled between zoomed (occupying the whole of the window) 2301and unzoomed (its normal position in the layout). 2302.Pp 2303.Fl M 2304begins mouse resizing (only valid if bound to a mouse key binding, see 2305.Sx MOUSE SUPPORT ) . 2306.It Xo Ic resize-window 2307.Op Fl aADLRU 2308.Op Fl t Ar target-window 2309.Op Fl x Ar width 2310.Op Fl y Ar height 2311.Op Ar adjustment 2312.Xc 2313.D1 (alias: Ic resizew ) 2314Resize a window, up, down, left or right by 2315.Ar adjustment 2316with 2317.Fl U , 2318.Fl D , 2319.Fl L 2320or 2321.Fl R , 2322or 2323to an absolute size 2324with 2325.Fl x 2326or 2327.Fl y . 2328The 2329.Ar adjustment 2330is given in lines or cells (the default is 1). 2331.Fl A 2332sets the size of the largest session containing the window; 2333.Fl a 2334the size of the smallest. 2335This command will automatically set 2336.Ic window-size 2337to manual in the window options. 2338.It Xo Ic respawn-pane 2339.Op Fl k 2340.Op Fl c Ar start-directory 2341.Op Fl e Ar environment 2342.Op Fl t Ar target-pane 2343.Op Ar shell-command 2344.Xc 2345.D1 (alias: Ic respawnp ) 2346Reactivate a pane in which the command has exited (see the 2347.Ic remain-on-exit 2348window option). 2349If 2350.Ar shell-command 2351is not given, the command used when the pane was created is executed. 2352The pane must be already inactive, unless 2353.Fl k 2354is given, in which case any existing command is killed. 2355.Fl c 2356specifies a new working directory for the pane. 2357The 2358.Fl e 2359option has the same meaning as for the 2360.Ic new-window 2361command. 2362.It Xo Ic respawn-window 2363.Op Fl k 2364.Op Fl c Ar start-directory 2365.Op Fl e Ar environment 2366.Op Fl t Ar target-window 2367.Op Ar shell-command 2368.Xc 2369.D1 (alias: Ic respawnw ) 2370Reactivate a window in which the command has exited (see the 2371.Ic remain-on-exit 2372window option). 2373If 2374.Ar shell-command 2375is not given, the command used when the window was created is executed. 2376The window must be already inactive, unless 2377.Fl k 2378is given, in which case any existing command is killed. 2379.Fl c 2380specifies a new working directory for the window. 2381The 2382.Fl e 2383option has the same meaning as for the 2384.Ic new-window 2385command. 2386.It Xo Ic rotate-window 2387.Op Fl DUZ 2388.Op Fl t Ar target-window 2389.Xc 2390.D1 (alias: Ic rotatew ) 2391Rotate the positions of the panes within a window, either upward (numerically 2392lower) with 2393.Fl U 2394or downward (numerically higher). 2395.Fl Z 2396keeps the window zoomed if it was zoomed. 2397.It Xo Ic select-layout 2398.Op Fl Enop 2399.Op Fl t Ar target-pane 2400.Op Ar layout-name 2401.Xc 2402.D1 (alias: Ic selectl ) 2403Choose a specific layout for a window. 2404If 2405.Ar layout-name 2406is not given, the last preset layout used (if any) is reapplied. 2407.Fl n 2408and 2409.Fl p 2410are equivalent to the 2411.Ic next-layout 2412and 2413.Ic previous-layout 2414commands. 2415.Fl o 2416applies the last set layout if possible (undoes the most recent layout change). 2417.Fl E 2418spreads the current pane and any panes next to it out evenly. 2419.It Xo Ic select-pane 2420.Op Fl DdeLlMmRUZ 2421.Op Fl T Ar title 2422.Op Fl t Ar target-pane 2423.Xc 2424.D1 (alias: Ic selectp ) 2425Make pane 2426.Ar target-pane 2427the active pane in window 2428.Ar target-window . 2429If one of 2430.Fl D , 2431.Fl L , 2432.Fl R , 2433or 2434.Fl U 2435is used, respectively the pane below, to the left, to the right, or above the 2436target pane is used. 2437.Fl Z 2438keeps the window zoomed if it was zoomed. 2439.Fl l 2440is the same as using the 2441.Ic last-pane 2442command. 2443.Fl e 2444enables or 2445.Fl d 2446disables input to the pane. 2447.Fl T 2448sets the pane title. 2449.Pp 2450.Fl m 2451and 2452.Fl M 2453are used to set and clear the 2454.Em marked pane . 2455There is one marked pane at a time, setting a new marked pane clears the last. 2456The marked pane is the default target for 2457.Fl s 2458to 2459.Ic join-pane , 2460.Ic swap-pane 2461and 2462.Ic swap-window . 2463.It Xo Ic select-window 2464.Op Fl lnpT 2465.Op Fl t Ar target-window 2466.Xc 2467.D1 (alias: Ic selectw ) 2468Select the window at 2469.Ar target-window . 2470.Fl l , 2471.Fl n 2472and 2473.Fl p 2474are equivalent to the 2475.Ic last-window , 2476.Ic next-window 2477and 2478.Ic previous-window 2479commands. 2480If 2481.Fl T 2482is given and the selected window is already the current window, 2483the command behaves like 2484.Ic last-window . 2485.It Xo Ic split-window 2486.Op Fl bdfhIvP 2487.Op Fl c Ar start-directory 2488.Op Fl e Ar environment 2489.Op Fl l Ar size 2490.Op Fl t Ar target-pane 2491.Op Ar shell-command 2492.Op Fl F Ar format 2493.Xc 2494.D1 (alias: Ic splitw ) 2495Create a new pane by splitting 2496.Ar target-pane : 2497.Fl h 2498does a horizontal split and 2499.Fl v 2500a vertical split; if neither is specified, 2501.Fl v 2502is assumed. 2503The 2504.Fl l 2505option specifies the size of the new pane in lines (for vertical split) or in 2506columns (for horizontal split); 2507.Ar size 2508may be followed by 2509.Ql % 2510to specify a percentage of the available space. 2511The 2512.Fl b 2513option causes the new pane to be created to the left of or above 2514.Ar target-pane . 2515The 2516.Fl f 2517option creates a new pane spanning the full window height (with 2518.Fl h ) 2519or full window width (with 2520.Fl v ) , 2521instead of splitting the active pane. 2522.Pp 2523An empty 2524.Ar shell-command 2525('') will create a pane with no command running in it. 2526Output can be sent to such a pane with the 2527.Ic display-message 2528command. 2529The 2530.Fl I 2531flag (if 2532.Ar shell-command 2533is not specified or empty) 2534will create an empty pane and forward any output from stdin to it. 2535For example: 2536.Bd -literal -offset indent 2537$ make 2>&1|tmux splitw -dI & 2538.Ed 2539.Pp 2540All other options have the same meaning as for the 2541.Ic new-window 2542command. 2543.It Xo Ic swap-pane 2544.Op Fl dDUZ 2545.Op Fl s Ar src-pane 2546.Op Fl t Ar dst-pane 2547.Xc 2548.D1 (alias: Ic swapp ) 2549Swap two panes. 2550If 2551.Fl U 2552is used and no source pane is specified with 2553.Fl s , 2554.Ar dst-pane 2555is swapped with the previous pane (before it numerically); 2556.Fl D 2557swaps with the next pane (after it numerically). 2558.Fl d 2559instructs 2560.Nm 2561not to change the active pane and 2562.Fl Z 2563keeps the window zoomed if it was zoomed. 2564.Pp 2565If 2566.Fl s 2567is omitted and a marked pane is present (see 2568.Ic select-pane 2569.Fl m ) , 2570the marked pane is used rather than the current pane. 2571.It Xo Ic swap-window 2572.Op Fl d 2573.Op Fl s Ar src-window 2574.Op Fl t Ar dst-window 2575.Xc 2576.D1 (alias: Ic swapw ) 2577This is similar to 2578.Ic link-window , 2579except the source and destination windows are swapped. 2580It is an error if no window exists at 2581.Ar src-window . 2582If 2583.Fl d 2584is given, the new window does not become the current window. 2585.Pp 2586If 2587.Fl s 2588is omitted and a marked pane is present (see 2589.Ic select-pane 2590.Fl m ) , 2591the window containing the marked pane is used rather than the current window. 2592.It Xo Ic unlink-window 2593.Op Fl k 2594.Op Fl t Ar target-window 2595.Xc 2596.D1 (alias: Ic unlinkw ) 2597Unlink 2598.Ar target-window . 2599Unless 2600.Fl k 2601is given, a window may be unlinked only if it is linked to multiple sessions - 2602windows may not be linked to no sessions; 2603if 2604.Fl k 2605is specified and the window is linked to only one session, it is unlinked and 2606destroyed. 2607.El 2608.Sh KEY BINDINGS 2609.Nm 2610allows a command to be bound to most keys, with or without a prefix key. 2611When specifying keys, most represent themselves (for example 2612.Ql A 2613to 2614.Ql Z ) . 2615Ctrl keys may be prefixed with 2616.Ql C- 2617or 2618.Ql ^ , 2619and Alt (meta) with 2620.Ql M- . 2621In addition, the following special key names are accepted: 2622.Em Up , 2623.Em Down , 2624.Em Left , 2625.Em Right , 2626.Em BSpace , 2627.Em BTab , 2628.Em DC 2629(Delete), 2630.Em End , 2631.Em Enter , 2632.Em Escape , 2633.Em F1 2634to 2635.Em F12 , 2636.Em Home , 2637.Em IC 2638(Insert), 2639.Em NPage/PageDown/PgDn , 2640.Em PPage/PageUp/PgUp , 2641.Em Space , 2642and 2643.Em Tab . 2644Note that to bind the 2645.Ql \&" 2646or 2647.Ql ' 2648keys, quotation marks are necessary, for example: 2649.Bd -literal -offset indent 2650bind-key '"' split-window 2651bind-key "'" new-window 2652.Ed 2653.Pp 2654A command bound to the 2655.Em Any 2656key will execute for all keys which do not have a more specific binding. 2657.Pp 2658Commands related to key bindings are as follows: 2659.Bl -tag -width Ds 2660.It Xo Ic bind-key 2661.Op Fl nr 2662.Op Fl N Ar note 2663.Op Fl T Ar key-table 2664.Ar key Ar command Op Ar arguments 2665.Xc 2666.D1 (alias: Ic bind ) 2667Bind key 2668.Ar key 2669to 2670.Ar command . 2671Keys are bound in a key table. 2672By default (without -T), the key is bound in 2673the 2674.Em prefix 2675key table. 2676This table is used for keys pressed after the prefix key (for example, 2677by default 2678.Ql c 2679is bound to 2680.Ic new-window 2681in the 2682.Em prefix 2683table, so 2684.Ql C-b c 2685creates a new window). 2686The 2687.Em root 2688table is used for keys pressed without the prefix key: binding 2689.Ql c 2690to 2691.Ic new-window 2692in the 2693.Em root 2694table (not recommended) means a plain 2695.Ql c 2696will create a new window. 2697.Fl n 2698is an alias 2699for 2700.Fl T Ar root . 2701Keys may also be bound in custom key tables and the 2702.Ic switch-client 2703.Fl T 2704command used to switch to them from a key binding. 2705The 2706.Fl r 2707flag indicates this key may repeat, see the 2708.Ic repeat-time 2709option. 2710.Fl N 2711attaches a note to the key (shown with 2712.Ic list-keys 2713.Fl N ) . 2714.Pp 2715To view the default bindings and possible commands, see the 2716.Ic list-keys 2717command. 2718.It Xo Ic list-keys 2719.Op Fl 1aN 2720.Op Fl P Ar prefix-string Fl T Ar key-table 2721.Op Ar key 2722.Xc 2723.D1 (alias: Ic lsk ) 2724List key bindings. 2725There are two forms: the default lists keys as 2726.Ic bind-key 2727commands; 2728.Fl N 2729lists only keys with attached notes and shows only the key and note for each 2730key. 2731.Pp 2732With the default form, all key tables are listed by default. 2733.Fl T 2734lists only keys in 2735.Ar key-table . 2736.Pp 2737With the 2738.Fl N 2739form, only keys in the 2740.Em root 2741and 2742.Em prefix 2743key tables are listed by default; 2744.Fl T 2745also lists only keys in 2746.Ar key-table . 2747.Fl P 2748specifies a prefix to print before each key and 2749.Fl 1 2750lists only the first matching key. 2751.Fl a 2752lists the command for keys that do have a note rather than skipping them. 2753.It Xo Ic send-keys 2754.Op Fl FHlMRX 2755.Op Fl N Ar repeat-count 2756.Op Fl t Ar target-pane 2757.Ar key Ar ... 2758.Xc 2759.D1 (alias: Ic send ) 2760Send a key or keys to a window. 2761Each argument 2762.Ar key 2763is the name of the key (such as 2764.Ql C-a 2765or 2766.Ql NPage ) 2767to send; if the string is not recognised as a key, it is sent as a series of 2768characters. 2769All arguments are sent sequentially from first to last. 2770.Pp 2771The 2772.Fl l 2773flag disables key name lookup and processes the keys as literal UTF-8 2774characters. 2775The 2776.Fl H 2777flag expects each key to be a hexadecimal number for an ASCII character. 2778.Pp 2779The 2780.Fl R 2781flag causes the terminal state to be reset. 2782.Pp 2783.Fl M 2784passes through a mouse event (only valid if bound to a mouse key binding, see 2785.Sx MOUSE SUPPORT ) . 2786.Pp 2787.Fl X 2788is used to send a command into copy mode - see 2789the 2790.Sx WINDOWS AND PANES 2791section. 2792.Fl N 2793specifies a repeat count and 2794.Fl F 2795expands formats in arguments where appropriate. 2796.It Xo Ic send-prefix 2797.Op Fl 2 2798.Op Fl t Ar target-pane 2799.Xc 2800Send the prefix key, or with 2801.Fl 2 2802the secondary prefix key, to a window as if it was pressed. 2803.It Xo Ic unbind-key 2804.Op Fl an 2805.Op Fl T Ar key-table 2806.Ar key 2807.Xc 2808.D1 (alias: Ic unbind ) 2809Unbind the command bound to 2810.Ar key . 2811.Fl n 2812and 2813.Fl T 2814are the same as for 2815.Ic bind-key . 2816If 2817.Fl a 2818is present, all key bindings are removed. 2819.El 2820.Sh OPTIONS 2821The appearance and behaviour of 2822.Nm 2823may be modified by changing the value of various options. 2824There are four types of option: 2825.Em server options , 2826.Em session options 2827.Em window options 2828and 2829.Em pane options . 2830.Pp 2831The 2832.Nm 2833server has a set of global server options which do not apply to any particular 2834window or session or pane. 2835These are altered with the 2836.Ic set-option 2837.Fl s 2838command, or displayed with the 2839.Ic show-options 2840.Fl s 2841command. 2842.Pp 2843In addition, each individual session may have a set of session options, and 2844there is a separate set of global session options. 2845Sessions which do not have a particular option configured inherit the value 2846from the global session options. 2847Session options are set or unset with the 2848.Ic set-option 2849command and may be listed with the 2850.Ic show-options 2851command. 2852The available server and session options are listed under the 2853.Ic set-option 2854command. 2855.Pp 2856Similarly, a set of window options is attached to each window and a set of pane 2857options to each pane. 2858Pane options inherit from window options. 2859This means any pane option may be set as a window option to apply the option to 2860all panes in the window without the option set, for example these commands will 2861set the background colour to red for all panes except pane 0: 2862.Bd -literal -offset indent 2863set -w window-style bg=red 2864set -pt:.0 window-style bg=blue 2865.Ed 2866.Pp 2867There is also a set of global window options from which any unset window or 2868pane options are inherited. 2869Window and pane options are altered with 2870.Ic set-option 2871.Fl w 2872and 2873.Fl p 2874commands and displayed with 2875.Ic show-option 2876.Fl w 2877and 2878.Fl p . 2879.Pp 2880.Nm 2881also supports user options which are prefixed with a 2882.Ql \&@ . 2883User options may have any name, so long as they are prefixed with 2884.Ql \&@ , 2885and be set to any string. 2886For example: 2887.Bd -literal -offset indent 2888$ tmux setw -q @foo "abc123" 2889$ tmux showw -v @foo 2890abc123 2891.Ed 2892.Pp 2893Commands which set options are as follows: 2894.Bl -tag -width Ds 2895.It Xo Ic set-option 2896.Op Fl aFgopqsuw 2897.Op Fl t Ar target-pane 2898.Ar option Ar value 2899.Xc 2900.D1 (alias: Ic set ) 2901Set a pane option with 2902.Fl p , 2903a window option with 2904.Fl w , 2905a server option with 2906.Fl s , 2907otherwise a session option. 2908If the option is not a user option, 2909.Fl w 2910or 2911.Fl s 2912may be unnecessary - 2913.Nm 2914will infer the type from the option name, assuming 2915.Fl w 2916for pane options. 2917If 2918.Fl g 2919is given, the global session or window option is set. 2920.Pp 2921.Fl F 2922expands formats in the option value. 2923The 2924.Fl u 2925flag unsets an option, so a session inherits the option from the global 2926options (or with 2927.Fl g , 2928restores a global option to the default). 2929.Pp 2930The 2931.Fl o 2932flag prevents setting an option that is already set and the 2933.Fl q 2934flag suppresses errors about unknown or ambiguous options. 2935.Pp 2936With 2937.Fl a , 2938and if the option expects a string or a style, 2939.Ar value 2940is appended to the existing setting. 2941For example: 2942.Bd -literal -offset indent 2943set -g status-left "foo" 2944set -ag status-left "bar" 2945.Ed 2946.Pp 2947Will result in 2948.Ql foobar . 2949And: 2950.Bd -literal -offset indent 2951set -g status-style "bg=red" 2952set -ag status-style "fg=blue" 2953.Ed 2954.Pp 2955Will result in a red background 2956.Em and 2957blue foreground. 2958Without 2959.Fl a , 2960the result would be the default background and a blue foreground. 2961.It Xo Ic show-options 2962.Op Fl AgHpqsvw 2963.Op Fl t Ar target-pane 2964.Op Ar option 2965.Xc 2966.D1 (alias: Ic show ) 2967Show the pane options (or a single option if 2968.Ar option 2969is provided) with 2970.Fl p , 2971the window options with 2972.Fl w , 2973the server options with 2974.Fl s , 2975otherwise the session options. 2976If the option is not a user option, 2977.Fl w 2978or 2979.Fl s 2980may be unnecessary - 2981.Nm 2982will infer the type from the option name, assuming 2983.Fl w 2984for pane options. 2985Global session or window options are listed if 2986.Fl g 2987is used. 2988.Fl v 2989shows only the option value, not the name. 2990If 2991.Fl q 2992is set, no error will be returned if 2993.Ar option 2994is unset. 2995.Fl H 2996includes hooks (omitted by default). 2997.Fl A 2998includes options inherited from a parent set of options, such options are 2999marked with an asterisk. 3000.Ar value 3001depends on the option and may be a number, a string, or a flag (on, off, or 3002omitted to toggle). 3003.El 3004.Pp 3005Available server options are: 3006.Bl -tag -width Ds 3007.It Ic backspace Ar key 3008Set the key sent by 3009.Nm 3010for backspace. 3011.It Ic buffer-limit Ar number 3012Set the number of buffers; as new buffers are added to the top of the stack, 3013old ones are removed from the bottom if necessary to maintain this maximum 3014length. 3015.It Xo Ic command-alias[] 3016.Ar name=value 3017.Xc 3018This is an array of custom aliases for commands. 3019If an unknown command matches 3020.Ar name , 3021it is replaced with 3022.Ar value . 3023For example, after: 3024.Pp 3025.Dl set -s command-alias[100] zoom='resize-pane -Z' 3026.Pp 3027Using: 3028.Pp 3029.Dl zoom -t:.1 3030.Pp 3031Is equivalent to: 3032.Pp 3033.Dl resize-pane -Z -t:.1 3034.Pp 3035Note that aliases are expanded when a command is parsed rather than when it is 3036executed, so binding an alias with 3037.Ic bind-key 3038will bind the expanded form. 3039.It Ic default-terminal Ar terminal 3040Set the default terminal for new windows created in this session - the 3041default value of the 3042.Ev TERM 3043environment variable. 3044For 3045.Nm 3046to work correctly, this 3047.Em must 3048be set to 3049.Ql screen , 3050.Ql tmux 3051or a derivative of them. 3052.It Ic escape-time Ar time 3053Set the time in milliseconds for which 3054.Nm 3055waits after an escape is input to determine if it is part of a function or meta 3056key sequences. 3057The default is 500 milliseconds. 3058.It Xo Ic exit-empty 3059.Op Ic on | off 3060.Xc 3061If enabled (the default), the server will exit when there are no active 3062sessions. 3063.It Xo Ic exit-unattached 3064.Op Ic on | off 3065.Xc 3066If enabled, the server will exit when there are no attached clients. 3067.It Xo Ic focus-events 3068.Op Ic on | off 3069.Xc 3070When enabled, focus events are requested from the terminal if supported and 3071passed through to applications running in 3072.Nm . 3073Attached clients should be detached and attached again after changing this 3074option. 3075.It Ic history-file Ar path 3076If not empty, a file to which 3077.Nm 3078will write command prompt history on exit and load it from on start. 3079.It Ic message-limit Ar number 3080Set the number of error or information messages to save in the message log for 3081each client. 3082The default is 100. 3083.It Xo Ic set-clipboard 3084.Op Ic on | external | off 3085.Xc 3086Attempt to set the terminal clipboard content using the 3087.Xr xterm 1 3088escape sequence, if there is an 3089.Em \&Ms 3090entry in the 3091.Xr terminfo 5 3092description (see the 3093.Sx TERMINFO EXTENSIONS 3094section). 3095.Pp 3096If set to 3097.Ic on , 3098.Nm 3099will both accept the escape sequence to create a buffer and attempt to set 3100the terminal clipboard. 3101If set to 3102.Ic external , 3103.Nm 3104will attempt to set the terminal clipboard but ignore attempts 3105by applications to set 3106.Nm 3107buffers. 3108If 3109.Ic off , 3110.Nm 3111will neither accept the clipboard escape sequence nor attempt to set the 3112clipboard. 3113.Pp 3114Note that this feature needs to be enabled in 3115.Xr xterm 1 3116by setting the resource: 3117.Bd -literal -offset indent 3118disallowedWindowOps: 20,21,SetXprop 3119.Ed 3120.Pp 3121Or changing this property from the 3122.Xr xterm 1 3123interactive menu when required. 3124.It Ic terminal-overrides[] Ar string 3125Allow terminal descriptions read using 3126.Xr terminfo 5 3127to be overridden. 3128Each entry is a colon-separated string made up of a terminal type pattern 3129(matched using 3130.Xr fnmatch 3 ) 3131and a set of 3132.Em name=value 3133entries. 3134.Pp 3135For example, to set the 3136.Ql clear 3137.Xr terminfo 5 3138entry to 3139.Ql \ee[H\ee[2J 3140for all terminal types matching 3141.Ql rxvt* : 3142.Pp 3143.Dl "rxvt*:clear=\ee[H\ee[2J" 3144.Pp 3145The terminal entry value is passed through 3146.Xr strunvis 3 3147before interpretation. 3148.It Ic user-keys[] Ar key 3149Set list of user-defined key escape sequences. 3150Each item is associated with a key named 3151.Ql User0 , 3152.Ql User1 , 3153and so on. 3154.Pp 3155For example: 3156.Bd -literal -offset indent 3157set -s user-keys[0] "\ee[5;30012~" 3158bind User0 resize-pane -L 3 3159.Ed 3160.El 3161.Pp 3162Available session options are: 3163.Bl -tag -width Ds 3164.It Xo Ic activity-action 3165.Op Ic any | none | current | other 3166.Xc 3167Set action on window activity when 3168.Ic monitor-activity 3169is on. 3170.Ic any 3171means activity in any window linked to a session causes a bell or message 3172(depending on 3173.Ic visual-activity ) 3174in the current window of that session, 3175.Ic none 3176means all activity is ignored (equivalent to 3177.Ic monitor-activity 3178being off), 3179.Ic current 3180means only activity in windows other than the current window are ignored and 3181.Ic other 3182means activity in the current window is ignored but not those in other windows. 3183.It Ic assume-paste-time Ar milliseconds 3184If keys are entered faster than one in 3185.Ar milliseconds , 3186they are assumed to have been pasted rather than typed and 3187.Nm 3188key bindings are not processed. 3189The default is one millisecond and zero disables. 3190.It Ic base-index Ar index 3191Set the base index from which an unused index should be searched when a new 3192window is created. 3193The default is zero. 3194.It Xo Ic bell-action 3195.Op Ic any | none | current | other 3196.Xc 3197Set action on a bell in a window when 3198.Ic monitor-bell 3199is on. 3200The values are the same as those for 3201.Ic activity-action . 3202.It Ic default-command Ar shell-command 3203Set the command used for new windows (if not specified when the window is 3204created) to 3205.Ar shell-command , 3206which may be any 3207.Xr sh 1 3208command. 3209The default is an empty string, which instructs 3210.Nm 3211to create a login shell using the value of the 3212.Ic default-shell 3213option. 3214.It Ic default-shell Ar path 3215Specify the default shell. 3216This is used as the login shell for new windows when the 3217.Ic default-command 3218option is set to empty, and must be the full path of the executable. 3219When started 3220.Nm 3221tries to set a default value from the first suitable of the 3222.Ev SHELL 3223environment variable, the shell returned by 3224.Xr getpwuid 3 , 3225or 3226.Pa /bin/sh . 3227This option should be configured when 3228.Nm 3229is used as a login shell. 3230.It Ic default-size Ar XxY 3231Set the default size of new windows when the 3232.Ic window-size 3233option is set to manual or when a session is created with 3234.Ic new-session 3235.Fl d . 3236The value is the width and height separated by an 3237.Ql x 3238character. 3239The default is 80x24. 3240.It Xo Ic destroy-unattached 3241.Op Ic on | off 3242.Xc 3243If enabled and the session is no longer attached to any clients, it is 3244destroyed. 3245.It Xo Ic detach-on-destroy 3246.Op Ic on | off 3247.Xc 3248If on (the default), the client is detached when the session it is attached to 3249is destroyed. 3250If off, the client is switched to the most recently active of the remaining 3251sessions. 3252.It Ic display-panes-active-colour Ar colour 3253Set the colour used by the 3254.Ic display-panes 3255command to show the indicator for the active pane. 3256.It Ic display-panes-colour Ar colour 3257Set the colour used by the 3258.Ic display-panes 3259command to show the indicators for inactive panes. 3260.It Ic display-panes-time Ar time 3261Set the time in milliseconds for which the indicators shown by the 3262.Ic display-panes 3263command appear. 3264.It Ic display-time Ar time 3265Set the amount of time for which status line messages and other on-screen 3266indicators are displayed. 3267If set to 0, messages and indicators are displayed until a key is pressed. 3268.Ar time 3269is in milliseconds. 3270.It Ic history-limit Ar lines 3271Set the maximum number of lines held in window history. 3272This setting applies only to new windows - existing window histories are not 3273resized and retain the limit at the point they were created. 3274.It Ic key-table Ar key-table 3275Set the default key table to 3276.Ar key-table 3277instead of 3278.Em root . 3279.It Ic lock-after-time Ar number 3280Lock the session (like the 3281.Ic lock-session 3282command) after 3283.Ar number 3284seconds of inactivity. 3285The default is not to lock (set to 0). 3286.It Ic lock-command Ar shell-command 3287Command to run when locking each client. 3288The default is to run 3289.Xr lock 1 3290with 3291.Fl np . 3292.It Ic message-command-style Ar style 3293Set status line message command style. 3294For how to specify 3295.Ar style , 3296see the 3297.Sx STYLES 3298section. 3299.It Ic message-style Ar style 3300Set status line message style. 3301For how to specify 3302.Ar style , 3303see the 3304.Sx STYLES 3305section. 3306.It Xo Ic mouse 3307.Op Ic on | off 3308.Xc 3309If on, 3310.Nm 3311captures the mouse and allows mouse events to be bound as key bindings. 3312See the 3313.Sx MOUSE SUPPORT 3314section for details. 3315.It Ic prefix Ar key 3316Set the key accepted as a prefix key. 3317In addition to the standard keys described under 3318.Sx KEY BINDINGS , 3319.Ic prefix 3320can be set to the special key 3321.Ql None 3322to set no prefix. 3323.It Ic prefix2 Ar key 3324Set a secondary key accepted as a prefix key. 3325Like 3326.Ic prefix , 3327.Ic prefix2 3328can be set to 3329.Ql None . 3330.It Xo Ic renumber-windows 3331.Op Ic on | off 3332.Xc 3333If on, when a window is closed in a session, automatically renumber the other 3334windows in numerical order. 3335This respects the 3336.Ic base-index 3337option if it has been set. 3338If off, do not renumber the windows. 3339.It Ic repeat-time Ar time 3340Allow multiple commands to be entered without pressing the prefix-key again 3341in the specified 3342.Ar time 3343milliseconds (the default is 500). 3344Whether a key repeats may be set when it is bound using the 3345.Fl r 3346flag to 3347.Ic bind-key . 3348Repeat is enabled for the default keys bound to the 3349.Ic resize-pane 3350command. 3351.It Xo Ic set-titles 3352.Op Ic on | off 3353.Xc 3354Attempt to set the client terminal title using the 3355.Em tsl 3356and 3357.Em fsl 3358.Xr terminfo 5 3359entries if they exist. 3360.Nm 3361automatically sets these to the \ee]0;...\e007 sequence if 3362the terminal appears to be 3363.Xr xterm 1 . 3364This option is off by default. 3365.It Ic set-titles-string Ar string 3366String used to set the client terminal title if 3367.Ic set-titles 3368is on. 3369Formats are expanded, see the 3370.Sx FORMATS 3371section. 3372.It Xo Ic silence-action 3373.Op Ic any | none | current | other 3374.Xc 3375Set action on window silence when 3376.Ic monitor-silence 3377is on. 3378The values are the same as those for 3379.Ic activity-action . 3380.It Xo Ic status 3381.Op Ic off | on | 2 | 3 | 4 | 5 3382.Xc 3383Show or hide the status line or specify its size. 3384Using 3385.Ic on 3386gives a status line one row in height; 3387.Ic 2 , 3388.Ic 3 , 3389.Ic 4 3390or 3391.Ic 5 3392more rows. 3393.It Ic status-format[] Ar format 3394Specify the format to be used for each line of the status line. 3395The default builds the top status line from the various individual status 3396options below. 3397.It Ic status-interval Ar interval 3398Update the status line every 3399.Ar interval 3400seconds. 3401By default, updates will occur every 15 seconds. 3402A setting of zero disables redrawing at interval. 3403.It Xo Ic status-justify 3404.Op Ic left | centre | right 3405.Xc 3406Set the position of the window list component of the status line: left, centre 3407or right justified. 3408.It Xo Ic status-keys 3409.Op Ic vi | emacs 3410.Xc 3411Use vi or emacs-style 3412key bindings in the status line, for example at the command prompt. 3413The default is emacs, unless the 3414.Ev VISUAL 3415or 3416.Ev EDITOR 3417environment variables are set and contain the string 3418.Ql vi . 3419.It Ic status-left Ar string 3420Display 3421.Ar string 3422(by default the session name) to the left of the status line. 3423.Ar string 3424will be passed through 3425.Xr strftime 3 . 3426Also see the 3427.Sx FORMATS 3428and 3429.Sx STYLES 3430sections. 3431.Pp 3432For details on how the names and titles can be set see the 3433.Sx "NAMES AND TITLES" 3434section. 3435.Pp 3436Examples are: 3437.Bd -literal -offset indent 3438#(sysctl vm.loadavg) 3439#[fg=yellow,bold]#(apm -l)%%#[default] [#S] 3440.Ed 3441.Pp 3442The default is 3443.Ql "[#S] " . 3444.It Ic status-left-length Ar length 3445Set the maximum 3446.Ar length 3447of the left component of the status line. 3448The default is 10. 3449.It Ic status-left-style Ar style 3450Set the style of the left part of the status line. 3451For how to specify 3452.Ar style , 3453see the 3454.Sx STYLES 3455section. 3456.It Xo Ic status-position 3457.Op Ic top | bottom 3458.Xc 3459Set the position of the status line. 3460.It Ic status-right Ar string 3461Display 3462.Ar string 3463to the right of the status line. 3464By default, the current pane title in double quotes, the date and the time 3465are shown. 3466As with 3467.Ic status-left , 3468.Ar string 3469will be passed to 3470.Xr strftime 3 3471and character pairs are replaced. 3472.It Ic status-right-length Ar length 3473Set the maximum 3474.Ar length 3475of the right component of the status line. 3476The default is 40. 3477.It Ic status-right-style Ar style 3478Set the style of the right part of the status line. 3479For how to specify 3480.Ar style , 3481see the 3482.Sx STYLES 3483section. 3484.It Ic status-style Ar style 3485Set status line style. 3486For how to specify 3487.Ar style , 3488see the 3489.Sx STYLES 3490section. 3491.It Ic update-environment[] Ar variable 3492Set list of environment variables to be copied into the session environment 3493when a new session is created or an existing session is attached. 3494Any variables that do not exist in the source environment are set to be 3495removed from the session environment (as if 3496.Fl r 3497was given to the 3498.Ic set-environment 3499command). 3500.It Xo Ic visual-activity 3501.Op Ic on | off | both 3502.Xc 3503If on, display a message instead of sending a bell when activity occurs in a 3504window for which the 3505.Ic monitor-activity 3506window option is enabled. 3507If set to both, a bell and a message are produced. 3508.It Xo Ic visual-bell 3509.Op Ic on | off | both 3510.Xc 3511If on, a message is shown on a bell in a window for which the 3512.Ic monitor-bell 3513window option is enabled instead of it being passed through to the 3514terminal (which normally makes a sound). 3515If set to both, a bell and a message are produced. 3516Also see the 3517.Ic bell-action 3518option. 3519.It Xo Ic visual-silence 3520.Op Ic on | off | both 3521.Xc 3522If 3523.Ic monitor-silence 3524is enabled, prints a message after the interval has expired on a given window 3525instead of sending a bell. 3526If set to both, a bell and a message are produced. 3527.It Ic word-separators Ar string 3528Sets the session's conception of what characters are considered word 3529separators, for the purposes of the next and previous word commands in 3530copy mode. 3531The default is 3532.Ql \ -_@ . 3533.El 3534.Pp 3535Available window options are: 3536.Pp 3537.Bl -tag -width Ds -compact 3538.It Xo Ic aggressive-resize 3539.Op Ic on | off 3540.Xc 3541Aggressively resize the chosen window. 3542This means that 3543.Nm 3544will resize the window to the size of the smallest or largest session 3545(see the 3546.Ic window-size 3547option) for which it is the current window, rather than the session to 3548which it is attached. 3549The window may resize when the current window is changed on another 3550session; this option is good for full-screen programs which support 3551.Dv SIGWINCH 3552and poor for interactive programs such as shells. 3553.Pp 3554.It Xo Ic automatic-rename 3555.Op Ic on | off 3556.Xc 3557Control automatic window renaming. 3558When this setting is enabled, 3559.Nm 3560will rename the window automatically using the format specified by 3561.Ic automatic-rename-format . 3562This flag is automatically disabled for an individual window when a name 3563is specified at creation with 3564.Ic new-window 3565or 3566.Ic new-session , 3567or later with 3568.Ic rename-window , 3569or with a terminal escape sequence. 3570It may be switched off globally with: 3571.Bd -literal -offset indent 3572set-option -wg automatic-rename off 3573.Ed 3574.Pp 3575.It Ic automatic-rename-format Ar format 3576The format (see 3577.Sx FORMATS ) 3578used when the 3579.Ic automatic-rename 3580option is enabled. 3581.Pp 3582.It Ic clock-mode-colour Ar colour 3583Set clock colour. 3584.Pp 3585.It Xo Ic clock-mode-style 3586.Op Ic 12 | 24 3587.Xc 3588Set clock hour format. 3589.Pp 3590.It Ic main-pane-height Ar height 3591.It Ic main-pane-width Ar width 3592Set the width or height of the main (left or top) pane in the 3593.Ic main-horizontal 3594or 3595.Ic main-vertical 3596layouts. 3597.Pp 3598.It Xo Ic mode-keys 3599.Op Ic vi | emacs 3600.Xc 3601Use vi or emacs-style key bindings in copy mode. 3602The default is emacs, unless 3603.Ev VISUAL 3604or 3605.Ev EDITOR 3606contains 3607.Ql vi . 3608.Pp 3609.It Ic mode-style Ar style 3610Set window modes style. 3611For how to specify 3612.Ar style , 3613see the 3614.Sx STYLES 3615section. 3616.Pp 3617.It Xo Ic monitor-activity 3618.Op Ic on | off 3619.Xc 3620Monitor for activity in the window. 3621Windows with activity are highlighted in the status line. 3622.Pp 3623.It Xo Ic monitor-bell 3624.Op Ic on | off 3625.Xc 3626Monitor for a bell in the window. 3627Windows with a bell are highlighted in the status line. 3628.Pp 3629.It Xo Ic monitor-silence 3630.Op Ic interval 3631.Xc 3632Monitor for silence (no activity) in the window within 3633.Ic interval 3634seconds. 3635Windows that have been silent for the interval are highlighted in the 3636status line. 3637An interval of zero disables the monitoring. 3638.Pp 3639.It Ic other-pane-height Ar height 3640Set the height of the other panes (not the main pane) in the 3641.Ic main-horizontal 3642layout. 3643If this option is set to 0 (the default), it will have no effect. 3644If both the 3645.Ic main-pane-height 3646and 3647.Ic other-pane-height 3648options are set, the main pane will grow taller to make the other panes the 3649specified height, but will never shrink to do so. 3650.Pp 3651.It Ic other-pane-width Ar width 3652Like 3653.Ic other-pane-height , 3654but set the width of other panes in the 3655.Ic main-vertical 3656layout. 3657.Pp 3658.It Ic pane-active-border-style Ar style 3659Set the pane border style for the currently active pane. 3660For how to specify 3661.Ar style , 3662see the 3663.Sx STYLES 3664section. 3665Attributes are ignored. 3666.Pp 3667.It Ic pane-base-index Ar index 3668Like 3669.Ic base-index , 3670but set the starting index for pane numbers. 3671.Pp 3672.It Ic pane-border-format Ar format 3673Set the text shown in pane border status lines. 3674.Pp 3675.It Xo Ic pane-border-status 3676.Op Ic off | top | bottom 3677.Xc 3678Turn pane border status lines off or set their position. 3679.Pp 3680.It Ic pane-border-style Ar style 3681Set the pane border style for panes aside from the active pane. 3682For how to specify 3683.Ar style , 3684see the 3685.Sx STYLES 3686section. 3687Attributes are ignored. 3688.Pp 3689.It Xo Ic synchronize-panes 3690.Op Ic on | off 3691.Xc 3692Duplicate input to any pane to all other panes in the same window (only 3693for panes that are not in any special mode). 3694.Pp 3695.It Ic window-status-activity-style Ar style 3696Set status line style for windows with an activity alert. 3697For how to specify 3698.Ar style , 3699see the 3700.Sx STYLES 3701section. 3702.Pp 3703.It Ic window-status-bell-style Ar style 3704Set status line style for windows with a bell alert. 3705For how to specify 3706.Ar style , 3707see the 3708.Sx STYLES 3709section. 3710.Pp 3711.It Ic window-status-current-format Ar string 3712Like 3713.Ar window-status-format , 3714but is the format used when the window is the current window. 3715.Pp 3716.It Ic window-status-current-style Ar style 3717Set status line style for the currently active window. 3718For how to specify 3719.Ar style , 3720see the 3721.Sx STYLES 3722section. 3723.Pp 3724.It Ic window-status-format Ar string 3725Set the format in which the window is displayed in the status line window list. 3726See the 3727.Sx FORMATS 3728and 3729.Sx STYLES 3730sections. 3731.Pp 3732.It Ic window-status-last-style Ar style 3733Set status line style for the last active window. 3734For how to specify 3735.Ar style , 3736see the 3737.Sx STYLES 3738section. 3739.Pp 3740.It Ic window-status-separator Ar string 3741Sets the separator drawn between windows in the status line. 3742The default is a single space character. 3743.Pp 3744.It Ic window-status-style Ar style 3745Set status line style for a single window. 3746For how to specify 3747.Ar style , 3748see the 3749.Sx STYLES 3750section. 3751.Pp 3752.It Xo Ic window-size 3753.Ar largest | Ar smallest | Ar manual | Ar latest 3754.Xc 3755Configure how 3756.Nm 3757determines the window size. 3758If set to 3759.Ar largest , 3760the size of the largest attached session is used; if 3761.Ar smallest , 3762the size of the smallest. 3763If 3764.Ar manual , 3765the size of a new window is set from the 3766.Ic default-size 3767option and windows are resized automatically. 3768With 3769.Ar latest , 3770.Nm 3771uses the size of the client that had the most recent activity. 3772See also the 3773.Ic resize-window 3774command and the 3775.Ic aggressive-resize 3776option. 3777.Pp 3778.It Xo Ic wrap-search 3779.Op Ic on | off 3780.Xc 3781If this option is set, searches will wrap around the end of the pane contents. 3782The default is on. 3783.Pp 3784.It Xo Ic xterm-keys 3785.Op Ic on | off 3786.Xc 3787If this option is set, 3788.Nm 3789will generate 3790.Xr xterm 1 -style 3791function key sequences; these have a number included to indicate modifiers such 3792as Shift, Alt or Ctrl. 3793.El 3794.Pp 3795Available pane options are: 3796.Pp 3797.Bl -tag -width Ds -compact 3798.It Xo Ic allow-rename 3799.Op Ic on | off 3800.Xc 3801Allow programs in the pane to change the window name using a terminal escape 3802sequence (\eek...\ee\e\e). 3803.Pp 3804.It Xo Ic alternate-screen 3805.Op Ic on | off 3806.Xc 3807This option configures whether programs running inside the pane may use the 3808terminal alternate screen feature, which allows the 3809.Em smcup 3810and 3811.Em rmcup 3812.Xr terminfo 5 3813capabilities. 3814The alternate screen feature preserves the contents of the window when an 3815interactive application starts and restores it on exit, so that any output 3816visible before the application starts reappears unchanged after it exits. 3817.Pp 3818.It Xo Ic remain-on-exit 3819.Op Ic on | off 3820.Xc 3821A pane with this flag set is not destroyed when the program running in it 3822exits. 3823The pane may be reactivated with the 3824.Ic respawn-pane 3825command. 3826.Pp 3827.It Ic window-active-style Ar style 3828Set the pane style when it is the active pane. 3829For how to specify 3830.Ar style , 3831see the 3832.Sx STYLES 3833section. 3834.Pp 3835.It Ic window-style Ar style 3836Set the pane style. 3837For how to specify 3838.Ar style , 3839see the 3840.Sx STYLES 3841section. 3842.El 3843.Sh HOOKS 3844.Nm 3845allows commands to run on various triggers, called 3846.Em hooks . 3847Most 3848.Nm 3849commands have an 3850.Em after 3851hook and there are a number of hooks not associated with commands. 3852.Pp 3853Hooks are stored as array options, members of the array are executed in 3854order when the hook is triggered. 3855Hooks may be configured with the 3856.Ic set-hook 3857or 3858.Ic set-option 3859commands and displayed with 3860.Ic show-hooks 3861or 3862.Ic show-options 3863.Fl H . 3864The following two commands are equivalent: 3865.Bd -literal -offset indent. 3866set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red' 3867set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red' 3868.Ed 3869.Pp 3870Setting a hook without specifying an array index clears the hook and sets the 3871first member of the array. 3872.Pp 3873A command's after 3874hook is run after it completes, except when the command is run as part of a hook 3875itself. 3876They are named with an 3877.Ql after- 3878prefix. 3879For example, the following command adds a hook to select the even-vertical 3880layout after every 3881.Ic split-window : 3882.Bd -literal -offset indent 3883set-hook -g after-split-window "selectl even-vertical" 3884.Ed 3885.Pp 3886All the notifications listed in the 3887.Sx CONTROL MODE 3888section are hooks (without any arguments), except 3889.Ic %exit . 3890The following additional hooks are available: 3891.Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX" 3892.It alert-activity 3893Run when a window has activity. 3894See 3895.Ic monitor-activity . 3896.It alert-bell 3897Run when a window has received a bell. 3898See 3899.Ic monitor-bell . 3900.It alert-silence 3901Run when a window has been silent. 3902See 3903.Ic monitor-silence . 3904.It client-attached 3905Run when a client is attached. 3906.It client-detached 3907Run when a client is detached 3908.It client-resized 3909Run when a client is resized. 3910.It client-session-changed 3911Run when a client's attached session is changed. 3912.It pane-died 3913Run when the program running in a pane exits, but 3914.Ic remain-on-exit 3915is on so the pane has not closed. 3916.It pane-exited 3917Run when the program running in a pane exits. 3918.It pane-focus-in 3919Run when the focus enters a pane, if the 3920.Ic focus-events 3921option is on. 3922.It pane-focus-out 3923Run when the focus exits a pane, if the 3924.Ic focus-events 3925option is on. 3926.It pane-set-clipboard 3927Run when the terminal clipboard is set using the 3928.Xr xterm 1 3929escape sequence. 3930.It session-created 3931Run when a new session created. 3932.It session-closed 3933Run when a session closed. 3934.It session-renamed 3935Run when a session is renamed. 3936.It window-linked 3937Run when a window is linked into a session. 3938.It window-renamed 3939Run when a window is renamed. 3940.It window-unlinked 3941Run when a window is unlinked from a session. 3942.El 3943.Pp 3944Hooks are managed with these commands: 3945.Bl -tag -width Ds 3946.It Xo Ic set-hook 3947.Op Fl agRu 3948.Op Fl t Ar target-session 3949.Ar hook-name 3950.Ar command 3951.Xc 3952Without 3953.Fl R , 3954sets (or with 3955.Fl u 3956unsets) hook 3957.Ar hook-name 3958to 3959.Ar command . 3960If 3961.Fl g 3962is given, 3963.Em hook-name 3964is added to the global list of hooks, otherwise it is added to the session 3965hooks (for 3966.Ar target-session 3967with 3968.Fl t ) . 3969.Fl a 3970appends to a hook. 3971Like options, session hooks inherit from the global ones. 3972.Pp 3973With 3974.Fl R , 3975run 3976.Ar hook-name 3977immediately. 3978.It Xo Ic show-hooks 3979.Op Fl g 3980.Op Fl t Ar target-session 3981.Xc 3982Shows the global list of hooks with 3983.Fl g , 3984otherwise the session hooks. 3985.El 3986.Sh MOUSE SUPPORT 3987If the 3988.Ic mouse 3989option is on (the default is off), 3990.Nm 3991allows mouse events to be bound as keys. 3992The name of each key is made up of a mouse event (such as 3993.Ql MouseUp1 ) 3994and a location suffix, one of the following: 3995.Bl -column "XXXXXXXXXXXXX" -offset indent 3996.It Li "Pane" Ta "the contents of a pane" 3997.It Li "Border" Ta "a pane border" 3998.It Li "Status" Ta "the status line window list" 3999.It Li "StatusLeft" Ta "the left part of the status line" 4000.It Li "StatusRight" Ta "the right part of the status line" 4001.It Li "StatusDefault" Ta "any other part of the status line" 4002.El 4003.Pp 4004The following mouse events are available: 4005.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent 4006.It Li "WheelUp" Ta "WheelDown" Ta "" 4007.It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1" 4008.It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2" 4009.It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3" 4010.It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3" 4011.It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3" 4012.El 4013.Pp 4014Each should be suffixed with a location, for example 4015.Ql MouseDown1Status . 4016.Pp 4017The special token 4018.Ql {mouse} 4019or 4020.Ql = 4021may be used as 4022.Ar target-window 4023or 4024.Ar target-pane 4025in commands bound to mouse key bindings. 4026It resolves to the window or pane over which the mouse event took place 4027(for example, the window in the status line over which button 1 was released for a 4028.Ql MouseUp1Status 4029binding, or the pane over which the wheel was scrolled for a 4030.Ql WheelDownPane 4031binding). 4032.Pp 4033The 4034.Ic send-keys 4035.Fl M 4036flag may be used to forward a mouse event to a pane. 4037.Pp 4038The default key bindings allow the mouse to be used to select and resize panes, 4039to copy text and to change window using the status line. 4040These take effect if the 4041.Ic mouse 4042option is turned on. 4043.Sh FORMATS 4044Certain commands accept the 4045.Fl F 4046flag with a 4047.Ar format 4048argument. 4049This is a string which controls the output format of the command. 4050Format variables are enclosed in 4051.Ql #{ 4052and 4053.Ql } , 4054for example 4055.Ql #{session_name} . 4056The possible variables are listed in the table below, or the name of a 4057.Nm 4058option may be used for an option's value. 4059Some variables have a shorter alias such as 4060.Ql #S ; 4061.Ql ## 4062is replaced by a single 4063.Ql # , 4064.Ql #, 4065by a 4066.Ql \&, 4067and 4068.Ql #} 4069by a 4070.Ql } . 4071.Pp 4072Conditionals are available by prefixing with 4073.Ql \&? 4074and separating two alternatives with a comma; 4075if the specified variable exists and is not zero, the first alternative 4076is chosen, otherwise the second is used. 4077For example 4078.Ql #{?session_attached,attached,not attached} 4079will include the string 4080.Ql attached 4081if the session is attached and the string 4082.Ql not attached 4083if it is unattached, or 4084.Ql #{?automatic-rename,yes,no} 4085will include 4086.Ql yes 4087if 4088.Ic automatic-rename 4089is enabled, or 4090.Ql no 4091if not. 4092Conditionals can be nested arbitrarily. 4093Inside a conditional, 4094.Ql \&, 4095and 4096.Ql } 4097must be escaped as 4098.Ql #, 4099and 4100.Ql #} , 4101unless they are part of a 4102.Ql #{...} 4103replacement. 4104For example: 4105.Bd -literal -offset indent 4106#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W . 4107.Ed 4108.Pp 4109String comparisons may be expressed by prefixing two comma-separated 4110alternatives by 4111.Ql == , 4112.Ql != , 4113.Ql < , 4114.Ql > , 4115.Ql <= 4116or 4117.Ql >= 4118and a colon. 4119For example 4120.Ql #{==:#{host},myhost} 4121will be replaced by 4122.Ql 1 4123if running on 4124.Ql myhost , 4125otherwise by 4126.Ql 0 . 4127.Ql || 4128and 4129.Ql && 4130evaluate to true if either or both of two comma-separated alternatives are 4131true, for example 4132.Ql #{||:#{pane_in_mode},#{alternate_on}} . 4133.Pp 4134An 4135.Ql m 4136specifies an 4137.Xr fnmatch 3 4138or regular expression comparison. 4139The first argument is the pattern and the second the string to compare. 4140An optional third argument specifies flags: 4141.Ql r 4142means the pattern is a regular expression instead of the default 4143.Xr fnmatch 3 4144pattern, and 4145.Ql i 4146means to ignore case. 4147For example: 4148.Ql #{m:*foo*,#{host}} 4149or 4150.Ql #{m/ri:^A,MYVAR} . 4151A 4152.Ql C 4153performs a search for an 4154.Xr fnmatch 3 4155pattern or regular expression in the pane content and evaluates to zero if not 4156found, or a line number if found. 4157Like 4158.Ql m , 4159an 4160.Ql r 4161flag means search for a regular expression and 4162.Ql i 4163ignores case. 4164For example: 4165.Ql #{C/r:^Start} 4166.Pp 4167A limit may be placed on the length of the resultant string by prefixing it 4168by an 4169.Ql = , 4170a number and a colon. 4171Positive numbers count from the start of the string and negative from the end, 4172so 4173.Ql #{=5:pane_title} 4174will include at most the first five characters of the pane title, or 4175.Ql #{=-5:pane_title} 4176the last five characters. 4177A suffix or prefix may be given as a second argument - if provided then it is 4178appended or prepended to the string if the length has been trimmed, for example 4179.Ql #{=/5/...:pane_title} 4180will append 4181.Ql ... 4182if the pane title is more than five characters. 4183Similarly, 4184.Ql p 4185pads the string to a given width, for example 4186.Ql #{p10:pane_title} 4187will result in a width of at least 10 characters. 4188A positive width pads on the left, a negative on the right. 4189.Pp 4190Prefixing a time variable with 4191.Ql t:\& 4192will convert it to a string, so if 4193.Ql #{window_activity} 4194gives 4195.Ql 1445765102 , 4196.Ql #{t:window_activity} 4197gives 4198.Ql Sun Oct 25 09:25:02 2015 . 4199The 4200.Ql b:\& 4201and 4202.Ql d:\& 4203prefixes are 4204.Xr basename 3 4205and 4206.Xr dirname 3 4207of the variable respectively. 4208.Ql q:\& 4209will escape 4210.Xr sh 1 4211special characters. 4212.Ql E:\& 4213will expand the format twice, for example 4214.Ql #{E:status-left} 4215is the result of expanding the content of the 4216.Ic status-left 4217option rather than the option itself. 4218.Ql T:\& 4219is like 4220.Ql E:\& 4221but also expands 4222.Xr strftime 3 4223specifiers. 4224.Ql S:\& , 4225.Ql W:\& 4226or 4227.Ql P:\& 4228will loop over each session, window or pane and insert the format once 4229for each. 4230For windows and panes, two comma-separated formats may be given: 4231the second is used for the current window or active pane. 4232For example, to get a list of windows formatted like the status line: 4233.Bd -literal -offset indent 4234#{W:#{E:window-status-format} ,#{E:window-status-current-format} } 4235.Ed 4236.Pp 4237A prefix of the form 4238.Ql s/foo/bar/:\& 4239will substitute 4240.Ql foo 4241with 4242.Ql bar 4243throughout. 4244The first argument may be an extended regular expression and a final argument may be 4245.Ql i 4246to ignore case, for example 4247.Ql s/a(.)/\e1x/i:\& 4248would change 4249.Ql abABab 4250into 4251.Ql bxBxbx . 4252.Pp 4253In addition, the last line of a shell command's output may be inserted using 4254.Ql #() . 4255For example, 4256.Ql #(uptime) 4257will insert the system's uptime. 4258When constructing formats, 4259.Nm 4260does not wait for 4261.Ql #() 4262commands to finish; instead, the previous result from running the same command is used, 4263or a placeholder if the command has not been run before. 4264If the command hasn't exited, the most recent line of output will be used, but the status 4265line will not be updated more than once a second. 4266Commands are executed with the 4267.Nm 4268global environment set (see the 4269.Sx GLOBAL AND SESSION ENVIRONMENT 4270section). 4271.Pp 4272An 4273.Ql l 4274specifies that a string should be interpreted literally and not expanded. 4275For example 4276.Ql #{l:#{?pane_in_mode,yes,no}} 4277will be replaced by 4278.Ql #{?pane_in_mode,yes,no} . 4279.Pp 4280The following variables are available, where appropriate: 4281.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX" 4282.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with" 4283.It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen" 4284.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen" 4285.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen" 4286.It Li "buffer_created" Ta "" Ta "Time buffer created" 4287.It Li "buffer_name" Ta "" Ta "Name of buffer" 4288.It Li "buffer_sample" Ta "" Ta "Sample of start of buffer" 4289.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes" 4290.It Li "client_activity" Ta "" Ta "Time client last had activity" 4291.It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels" 4292.It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels" 4293.It Li "client_control_mode" Ta "" Ta "1 if client is in control mode" 4294.It Li "client_created" Ta "" Ta "Time client created" 4295.It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind" 4296.It Li "client_height" Ta "" Ta "Height of client" 4297.It Li "client_key_table" Ta "" Ta "Current key table" 4298.It Li "client_last_session" Ta "" Ta "Name of the client's last session" 4299.It Li "client_name" Ta "" Ta "Name of client" 4300.It Li "client_pid" Ta "" Ta "PID of client process" 4301.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed" 4302.It Li "client_readonly" Ta "" Ta "1 if client is readonly" 4303.It Li "client_session" Ta "" Ta "Name of the client's session" 4304.It Li "client_termname" Ta "" Ta "Terminal name of client" 4305.It Li "client_tty" Ta "" Ta "Pseudo terminal of client" 4306.It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8" 4307.It Li "client_width" Ta "" Ta "Width of client" 4308.It Li "client_written" Ta "" Ta "Bytes written to client" 4309.It Li "command" Ta "" Ta "Name of command in use, if any" 4310.It Li "command_list_alias" Ta "" Ta "Command alias if listing commands" 4311.It Li "command_list_name" Ta "" Ta "Command name if listing commands" 4312.It Li "command_list_usage" Ta "" Ta "Command usage if listing commands" 4313.It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode" 4314.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode" 4315.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode" 4316.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode" 4317.It Li "cursor_character" Ta "" Ta "Character at cursor in pane" 4318.It Li "cursor_flag" Ta "" Ta "Pane cursor flag" 4319.It Li "cursor_x" Ta "" Ta "Cursor X position in pane" 4320.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane" 4321.It Li "history_bytes" Ta "" Ta "Number of bytes in window history" 4322.It Li "history_limit" Ta "" Ta "Maximum window history lines" 4323.It Li "history_size" Ta "" Ta "Size of history in lines" 4324.It Li "hook" Ta "" Ta "Name of running hook, if any" 4325.It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any" 4326.It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any" 4327.It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any" 4328.It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any" 4329.It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any" 4330.It Li "host" Ta "#H" Ta "Hostname of local host" 4331.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)" 4332.It Li "insert_flag" Ta "" Ta "Pane insert flag" 4333.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag" 4334.It Li "keypad_flag" Ta "" Ta "Pane keypad flag" 4335.It Li "line" Ta "" Ta "Line number in the list" 4336.It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag" 4337.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag" 4338.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag" 4339.It Li "mouse_line" Ta "" Ta "Line under mouse, if any" 4340.It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag" 4341.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag" 4342.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" 4343.It Li "mouse_word" Ta "" Ta "Word under mouse, if any" 4344.It Li "mouse_x" Ta "" Ta "Mouse X position, if any" 4345.It Li "mouse_y" Ta "" Ta "Mouse Y position, if any" 4346.It Li "origin_flag" Ta "" Ta "Pane origin flag" 4347.It Li "pane_active" Ta "" Ta "1 if active pane" 4348.It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window" 4349.It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window" 4350.It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window" 4351.It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window" 4352.It Li "pane_bottom" Ta "" Ta "Bottom of pane" 4353.It Li "pane_current_command" Ta "" Ta "Current command if available" 4354.It Li "pane_current_path" Ta "" Ta "Current path if available" 4355.It Li "pane_dead" Ta "" Ta "1 if pane is dead" 4356.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane" 4357.It Li "pane_format" Ta "" Ta "1 if format is for a pane" 4358.It Li "pane_height" Ta "" Ta "Height of pane" 4359.It Li "pane_id" Ta "#D" Ta "Unique pane ID" 4360.It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode" 4361.It Li "pane_index" Ta "#P" Ta "Index of pane" 4362.It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled" 4363.It Li "pane_left" Ta "" Ta "Left of pane" 4364.It Li "pane_marked" Ta "" Ta "1 if this is the marked pane" 4365.It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set" 4366.It Li "pane_mode" Ta "" Ta "Name of pane mode, if any" 4367.It Li "pane_path" Ta "#T" Ta "Path of pane (can be set by application)" 4368.It Li "pane_pid" Ta "" Ta "PID of first process in pane" 4369.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped" 4370.It Li "pane_right" Ta "" Ta "Right of pane" 4371.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode" 4372.It Li "pane_start_command" Ta "" Ta "Command pane started with" 4373.It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized" 4374.It Li "pane_tabs" Ta "" Ta "Pane tab positions" 4375.It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)" 4376.It Li "pane_top" Ta "" Ta "Top of pane" 4377.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" 4378.It Li "pane_width" Ta "" Ta "Width of pane" 4379.It Li "pid" Ta "" Ta "Server PID" 4380.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated" 4381.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode" 4382.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane" 4383.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane" 4384.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode" 4385.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection" 4386.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection" 4387.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode" 4388.It Li "selection_start_x" Ta "" Ta "X position of the start of the selection" 4389.It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection" 4390.It Li "session_activity" Ta "" Ta "Time of session last activity" 4391.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts" 4392.It Li "session_attached" Ta "" Ta "Number of clients session is attached to" 4393.It Li "session_attached_list" Ta "" Ta "List of clients session is attached to" 4394.It Li "session_created" Ta "" Ta "Time session created" 4395.It Li "session_format" Ta "" Ta "1 if format is for a session" 4396.It Li "session_group" Ta "" Ta "Name of session group" 4397.It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to" 4398.It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to" 4399.It Li "session_group_list" Ta "" Ta "List of sessions in group" 4400.It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group" 4401.It Li "session_group_size" Ta "" Ta "Size of session group" 4402.It Li "session_grouped" Ta "" Ta "1 if session in a group" 4403.It Li "session_id" Ta "" Ta "Unique session ID" 4404.It Li "session_last_attached" Ta "" Ta "Time session last attached" 4405.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached" 4406.It Li "session_name" Ta "#S" Ta "Name of session" 4407.It Li "session_stack" Ta "" Ta "Window indexes in most recent order" 4408.It Li "session_windows" Ta "" Ta "Number of windows in session" 4409.It Li "socket_path" Ta "" Ta "Server socket path" 4410.It Li "start_time" Ta "" Ta "Server start time" 4411.It Li "version" Ta "" Ta "Server version" 4412.It Li "window_active" Ta "" Ta "1 if window active" 4413.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window" 4414.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window" 4415.It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active" 4416.It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active" 4417.It Li "window_activity" Ta "" Ta "Time of window last activity" 4418.It Li "window_activity_flag" Ta "" Ta "1 if window has activity" 4419.It Li "window_bell_flag" Ta "" Ta "1 if window has bell" 4420.It Li "window_bigger" Ta "" Ta "1 if window is larger than client" 4421.It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels" 4422.It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels" 4423.It Li "window_end_flag" Ta "" Ta "1 if window has the highest index" 4424.It Li "window_flags" Ta "#F" Ta "Window flags" 4425.It Li "window_format" Ta "" Ta "1 if format is for a window" 4426.It Li "window_height" Ta "" Ta "Height of window" 4427.It Li "window_id" Ta "" Ta "Unique window ID" 4428.It Li "window_index" Ta "#I" Ta "Index of window" 4429.It Li "window_last_flag" Ta "" Ta "1 if window is the last used" 4430.It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes" 4431.It Li "window_linked" Ta "" Ta "1 if window is linked across sessions" 4432.It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to" 4433.It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to" 4434.It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane" 4435.It Li "window_name" Ta "#W" Ta "Name of window" 4436.It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client" 4437.It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client" 4438.It Li "window_panes" Ta "" Ta "Number of panes in window" 4439.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert" 4440.It Li "window_stack_index" Ta "" Ta "Index in session most recent stack" 4441.It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index" 4442.It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes" 4443.It Li "window_width" Ta "" Ta "Width of window" 4444.It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed" 4445.It Li "wrap_flag" Ta "" Ta "Pane wrap flag" 4446.El 4447.Sh STYLES 4448.Nm 4449offers various options to specify the colour and attributes of aspects of the 4450interface, for example 4451.Ic status-style 4452for the status line. 4453In addition, embedded styles may be specified in format options, such as 4454.Ic status-left , 4455by enclosing them in 4456.Ql #[ 4457and 4458.Ql \&] . 4459.Pp 4460A style may be the single term 4461.Ql default 4462to specify the default style (which may come from an option, for example 4463.Ic status-style 4464in the status line) or a space 4465or comma separated list of the following: 4466.Bl -tag -width Ds 4467.It Ic fg=colour 4468Set the foreground colour. 4469The colour is one of: 4470.Ic black , 4471.Ic red , 4472.Ic green , 4473.Ic yellow , 4474.Ic blue , 4475.Ic magenta , 4476.Ic cyan , 4477.Ic white ; 4478if supported the bright variants 4479.Ic brightred , 4480.Ic brightgreen , 4481.Ic brightyellow ; 4482.Ic colour0 4483to 4484.Ic colour255 4485from the 256-colour set; 4486.Ic default 4487for the default colour; 4488.Ic terminal 4489for the terminal default colour; or a hexadecimal RGB string such as 4490.Ql #ffffff . 4491.It Ic bg=colour 4492Set the background colour. 4493.It Ic none 4494Set no attributes (turn off any active attributes). 4495.It Xo Ic bright 4496(or 4497.Ic bold ) , 4498.Ic dim , 4499.Ic underscore , 4500.Ic blink , 4501.Ic reverse , 4502.Ic hidden , 4503.Ic italics , 4504.Ic overline , 4505.Ic strikethrough , 4506.Ic double-underscore , 4507.Ic curly-underscore , 4508.Ic dotted-underscore , 4509.Ic dashed-underscore 4510.Xc 4511Set an attribute. 4512Any of the attributes may be prefixed with 4513.Ql no 4514to unset. 4515.It Xo Ic align=left 4516(or 4517.Ic noalign ) , 4518.Ic align=centre , 4519.Ic align=right 4520.Xc 4521Align text to the left, centre or right of the available space if appropriate. 4522.It Ic fill=colour 4523Fill the available space with a background colour if appropriate. 4524.It Xo Ic list=on , 4525.Ic list=focus , 4526.Ic list=left-marker , 4527.Ic list=right-marker , 4528.Ic nolist 4529.Xc 4530Mark the position of the various window list components in the 4531.Ic status-format 4532option: 4533.Ic list=on 4534marks the start of the list; 4535.Ic list=focus 4536is the part of the list that should be kept in focus if the entire list won't fit 4537in the available space (typically the current window); 4538.Ic list=left-marker 4539and 4540.Ic list=right-marker 4541mark the text to be used to mark that text has been trimmed from the left or 4542right of the list if there is not enough space. 4543.It Xo Ic push-default , 4544.Ic pop-default 4545.Xc 4546Store the current colours and attributes as the default or reset to the previous 4547default. 4548A 4549.Ic push-default 4550affects any subsequent use of the 4551.Ic default 4552term until a 4553.Ic pop-default . 4554Only one default may be pushed (each 4555.Ic push-default 4556replaces the previous saved default). 4557.It Xo Ic range=left , 4558.Ic range=right , 4559.Ic range=window|X , 4560.Ic norange 4561.Xc 4562Mark a range in the 4563.Ic status-format 4564option. 4565.Ic range=left 4566and 4567.Ic range=right 4568are the text used for the 4569.Ql StatusLeft 4570and 4571.Ql StatusRight 4572mouse keys. 4573.Ic range=window|X 4574is the range for a window passed to the 4575.Ql Status 4576mouse key, where 4577.Ql X 4578is a window index. 4579.El 4580.Pp 4581Examples are: 4582.Bd -literal -offset indent 4583fg=yellow bold underscore blink 4584bg=black,fg=default,noreverse 4585.Ed 4586.Sh NAMES AND TITLES 4587.Nm 4588distinguishes between names and titles. 4589Windows and sessions have names, which may be used to specify them in targets 4590and are displayed in the status line and various lists: the name is the 4591.Nm 4592identifier for a window or session. 4593Only panes have titles. 4594A pane's title is typically set by the program running inside the pane using 4595an escape sequence (like it would set the 4596.Xr xterm 1 4597window title in 4598.Xr X 7 ) . 4599Windows themselves do not have titles - a window's title is the title of its 4600active pane. 4601.Nm 4602itself may set the title of the terminal in which the client is running, see 4603the 4604.Ic set-titles 4605option. 4606.Pp 4607A session's name is set with the 4608.Ic new-session 4609and 4610.Ic rename-session 4611commands. 4612A window's name is set with one of: 4613.Bl -enum -width Ds 4614.It 4615A command argument (such as 4616.Fl n 4617for 4618.Ic new-window 4619or 4620.Ic new-session ) . 4621.It 4622An escape sequence (if the 4623.Ic allow-rename 4624option is turned on): 4625.Bd -literal -offset indent 4626$ printf '\e033kWINDOW_NAME\e033\e\e' 4627.Ed 4628.It 4629Automatic renaming, which sets the name to the active command in the window's 4630active pane. 4631See the 4632.Ic automatic-rename 4633option. 4634.El 4635.Pp 4636When a pane is first created, its title is the hostname. 4637A pane's title can be set via the title setting escape sequence, for example: 4638.Bd -literal -offset indent 4639$ printf '\e033]2;My Title\e033\e\e' 4640.Ed 4641.Pp 4642It can also be modified with the 4643.Ic select-pane 4644.Fl T 4645command. 4646.Sh GLOBAL AND SESSION ENVIRONMENT 4647When the server is started, 4648.Nm 4649copies the environment into the 4650.Em global environment ; 4651in addition, each session has a 4652.Em session environment . 4653When a window is created, the session and global environments are merged. 4654If a variable exists in both, the value from the session environment is used. 4655The result is the initial environment passed to the new process. 4656.Pp 4657The 4658.Ic update-environment 4659session option may be used to update the session environment from the client 4660when a new session is created or an old reattached. 4661.Nm 4662also initialises the 4663.Ev TMUX 4664variable with some internal information to allow commands to be executed 4665from inside, and the 4666.Ev TERM 4667variable with the correct terminal setting of 4668.Ql screen . 4669.Pp 4670Commands to alter and view the environment are: 4671.Bl -tag -width Ds 4672.It Xo Ic set-environment 4673.Op Fl gru 4674.Op Fl t Ar target-session 4675.Ar name Op Ar value 4676.Xc 4677.D1 (alias: Ic setenv ) 4678Set or unset an environment variable. 4679If 4680.Fl g 4681is used, the change is made in the global environment; otherwise, it is applied 4682to the session environment for 4683.Ar target-session . 4684The 4685.Fl u 4686flag unsets a variable. 4687.Fl r 4688indicates the variable is to be removed from the environment before starting a 4689new process. 4690.It Xo Ic show-environment 4691.Op Fl gs 4692.Op Fl t Ar target-session 4693.Op Ar variable 4694.Xc 4695.D1 (alias: Ic showenv ) 4696Display the environment for 4697.Ar target-session 4698or the global environment with 4699.Fl g . 4700If 4701.Ar variable 4702is omitted, all variables are shown. 4703Variables removed from the environment are prefixed with 4704.Ql - . 4705If 4706.Fl s 4707is used, the output is formatted as a set of Bourne shell commands. 4708.El 4709.Sh STATUS LINE 4710.Nm 4711includes an optional status line which is displayed in the bottom line of each 4712terminal. 4713.Pp 4714By default, the status line is enabled and one line in height (it may be 4715disabled or made multiple lines with the 4716.Ic status 4717session option) and contains, from left-to-right: the name of the current 4718session in square brackets; the window list; the title of the active pane 4719in double quotes; and the time and date. 4720.Pp 4721Each line of the status line is configured with the 4722.Ic status-format 4723option. 4724The default is made of three parts: configurable left and right sections (which 4725may contain dynamic content such as the time or output from a shell command, 4726see the 4727.Ic status-left , 4728.Ic status-left-length , 4729.Ic status-right , 4730and 4731.Ic status-right-length 4732options below), and a central window list. 4733By default, the window list shows the index, name and (if any) flag of the 4734windows present in the current session in ascending numerical order. 4735It may be customised with the 4736.Ar window-status-format 4737and 4738.Ar window-status-current-format 4739options. 4740The flag is one of the following symbols appended to the window name: 4741.Bl -column "Symbol" "Meaning" -offset indent 4742.It Sy "Symbol" Ta Sy "Meaning" 4743.It Li "*" Ta "Denotes the current window." 4744.It Li "-" Ta "Marks the last window (previously selected)." 4745.It Li "#" Ta "Window activity is monitored and activity has been detected." 4746.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window." 4747.It Li "~" Ta "The window has been silent for the monitor-silence interval." 4748.It Li "M" Ta "The window contains the marked pane." 4749.It Li "Z" Ta "The window's active pane is zoomed." 4750.El 4751.Pp 4752The # symbol relates to the 4753.Ic monitor-activity 4754window option. 4755The window name is printed in inverted colours if an alert (bell, activity or 4756silence) is present. 4757.Pp 4758The colour and attributes of the status line may be configured, the entire 4759status line using the 4760.Ic status-style 4761session option and individual windows using the 4762.Ic window-status-style 4763window option. 4764.Pp 4765The status line is automatically refreshed at interval if it has changed, the 4766interval may be controlled with the 4767.Ic status-interval 4768session option. 4769.Pp 4770Commands related to the status line are as follows: 4771.Bl -tag -width Ds 4772.It Xo Ic command-prompt 4773.Op Fl 1ikN 4774.Op Fl I Ar inputs 4775.Op Fl p Ar prompts 4776.Op Fl t Ar target-client 4777.Op Ar template 4778.Xc 4779Open the command prompt in a client. 4780This may be used from inside 4781.Nm 4782to execute commands interactively. 4783.Pp 4784If 4785.Ar template 4786is specified, it is used as the command. 4787If present, 4788.Fl I 4789is a comma-separated list of the initial text for each prompt. 4790If 4791.Fl p 4792is given, 4793.Ar prompts 4794is a comma-separated list of prompts which are displayed in order; otherwise 4795a single prompt is displayed, constructed from 4796.Ar template 4797if it is present, or 4798.Ql \&: 4799if not. 4800.Pp 4801Before the command is executed, the first occurrence of the string 4802.Ql %% 4803and all occurrences of 4804.Ql %1 4805are replaced by the response to the first prompt, all 4806.Ql %2 4807are replaced with the response to the second prompt, and so on for further 4808prompts. 4809Up to nine prompt responses may be replaced 4810.Po 4811.Ql %1 4812to 4813.Ql %9 4814.Pc . 4815.Ql %%% 4816is like 4817.Ql %% 4818but any quotation marks are escaped. 4819.Pp 4820.Fl 1 4821makes the prompt only accept one key press, in this case the resulting input 4822is a single character. 4823.Fl k 4824is like 4825.Fl 1 4826but the key press is translated to a key name. 4827.Fl N 4828makes the prompt only accept numeric key presses. 4829.Fl i 4830executes the command every time the prompt input changes instead of when the 4831user exits the command prompt. 4832.Pp 4833The following keys have a special meaning in the command prompt, depending 4834on the value of the 4835.Ic status-keys 4836option: 4837.Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent 4838.It Sy "Function" Ta Sy "vi" Ta Sy "emacs" 4839.It Li "Cancel command prompt" Ta "Escape" Ta "Escape" 4840.It Li "Delete from cursor to start of word" Ta "" Ta "C-w" 4841.It Li "Delete entire command" Ta "d" Ta "C-u" 4842.It Li "Delete from cursor to end" Ta "D" Ta "C-k" 4843.It Li "Execute command" Ta "Enter" Ta "Enter" 4844.It Li "Get next command from history" Ta "" Ta "Down" 4845.It Li "Get previous command from history" Ta "" Ta "Up" 4846.It Li "Insert top paste buffer" Ta "p" Ta "C-y" 4847.It Li "Look for completions" Ta "Tab" Ta "Tab" 4848.It Li "Move cursor left" Ta "h" Ta "Left" 4849.It Li "Move cursor right" Ta "l" Ta "Right" 4850.It Li "Move cursor to end" Ta "$" Ta "C-e" 4851.It Li "Move cursor to next word" Ta "w" Ta "M-f" 4852.It Li "Move cursor to previous word" Ta "b" Ta "M-b" 4853.It Li "Move cursor to start" Ta "0" Ta "C-a" 4854.It Li "Transpose characters" Ta "" Ta "C-t" 4855.El 4856.It Xo Ic confirm-before 4857.Op Fl p Ar prompt 4858.Op Fl t Ar target-client 4859.Ar command 4860.Xc 4861.D1 (alias: Ic confirm ) 4862Ask for confirmation before executing 4863.Ar command . 4864If 4865.Fl p 4866is given, 4867.Ar prompt 4868is the prompt to display; otherwise a prompt is constructed from 4869.Ar command . 4870It may contain the special character sequences supported by the 4871.Ic status-left 4872option. 4873.Pp 4874This command works only from inside 4875.Nm . 4876.It Xo Ic display-menu 4877.Op Fl c Ar target-client 4878.Op Fl t Ar target-pane 4879.Op Fl T Ar title 4880.Op Fl x Ar position 4881.Op Fl y Ar position 4882.Ar name 4883.Ar key 4884.Ar command 4885.Ar ... 4886.Xc 4887.D1 (alias: Ic menu ) 4888Display a menu on 4889.Ar target-client . 4890.Ar target-pane 4891gives the target for any commands run from the menu. 4892.Pp 4893A menu is passed as a series of arguments: first the menu item name, 4894second the key shortcut (or empty for none) and third the command 4895to run when the menu item is chosen. 4896The name and command are formats, see the 4897.Sx FORMATS 4898and 4899.Sx STYLES 4900sections. 4901If the name begins with a hyphen (-), then the item is disabled (shown dim) and 4902may not be chosen. 4903The name may be empty for a separator line, in which case both the key and 4904command should be omitted. 4905.Pp 4906.Fl T 4907is a format for the menu title (see 4908.Sx FORMATS ) . 4909.Pp 4910.Fl x 4911and 4912.Fl y 4913give the position of the menu. 4914Both may be a row or column number, or one of the following special values: 4915.Bl -column "XXXXX" "XXXX" -offset indent 4916.It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning" 4917.It Li "R" Ta Fl x Ta "The right side of the terminal" 4918.It Li "P" Ta "Both" Ta "The bottom left of the pane" 4919.It Li "M" Ta "Both" Ta "The mouse position" 4920.It Li "W" Ta Fl x Ta "The window position on the status line" 4921.It Li "S" Ta Fl y Ta "The line above or below the status line" 4922.El 4923.Pp 4924Each menu consists of items followed by a key shortcut shown in brackets. 4925If the menu is too large to fit on the terminal, it is not displayed. 4926Pressing the key shortcut chooses the corresponding item. 4927If the mouse is enabled and the menu is opened from a mouse key binding, releasing 4928the mouse button with an item selected will choose that item. 4929The following keys are also available: 4930.Bl -column "Key" "Function" -offset indent 4931.It Sy "Key" Ta Sy "Function" 4932.It Li "Enter" Ta "Choose selected item" 4933.It Li "Up" Ta "Select previous item" 4934.It Li "Down" Ta "Select next item" 4935.It Li "q" Ta "Exit menu" 4936.El 4937.It Xo Ic display-message 4938.Op Fl aIpv 4939.Op Fl c Ar target-client 4940.Op Fl t Ar target-pane 4941.Op Ar message 4942.Xc 4943.D1 (alias: Ic display ) 4944Display a message. 4945If 4946.Fl p 4947is given, the output is printed to stdout, otherwise it is displayed in the 4948.Ar target-client 4949status line. 4950The format of 4951.Ar message 4952is described in the 4953.Sx FORMATS 4954section; information is taken from 4955.Ar target-pane 4956if 4957.Fl t 4958is given, otherwise the active pane. 4959.Pp 4960.Fl v 4961prints verbose logging as the format is parsed and 4962.Fl a 4963lists the format variables and their values. 4964.Pp 4965.Fl I 4966forwards any input read from stdin to the empty pane given by 4967.Ar target-pane . 4968.El 4969.Sh BUFFERS 4970.Nm 4971maintains a set of named 4972.Em paste buffers . 4973Each buffer may be either explicitly or automatically named. 4974Explicitly named buffers are named when created with the 4975.Ic set-buffer 4976or 4977.Ic load-buffer 4978commands, or by renaming an automatically named buffer with 4979.Ic set-buffer 4980.Fl n . 4981Automatically named buffers are given a name such as 4982.Ql buffer0001 , 4983.Ql buffer0002 4984and so on. 4985When the 4986.Ic buffer-limit 4987option is reached, the oldest automatically named buffer is deleted. 4988Explicitly named buffers are not subject to 4989.Ic buffer-limit 4990and may be deleted with the 4991.Ic delete-buffer 4992command. 4993.Pp 4994Buffers may be added using 4995.Ic copy-mode 4996or the 4997.Ic set-buffer 4998and 4999.Ic load-buffer 5000commands, and pasted into a window using the 5001.Ic paste-buffer 5002command. 5003If a buffer command is used and no buffer is specified, the most 5004recently added automatically named buffer is assumed. 5005.Pp 5006A configurable history buffer is also maintained for each window. 5007By default, up to 2000 lines are kept; this can be altered with the 5008.Ic history-limit 5009option (see the 5010.Ic set-option 5011command above). 5012.Pp 5013The buffer commands are as follows: 5014.Bl -tag -width Ds 5015.It Xo 5016.Ic choose-buffer 5017.Op Fl NZr 5018.Op Fl F Ar format 5019.Op Fl f Ar filter 5020.Op Fl O Ar sort-order 5021.Op Fl t Ar target-pane 5022.Op Ar template 5023.Xc 5024Put a pane into buffer mode, where a buffer may be chosen interactively from 5025a list. 5026.Fl Z 5027zooms the pane. 5028The following keys may be used in buffer mode: 5029.Bl -column "Key" "Function" -offset indent 5030.It Sy "Key" Ta Sy "Function" 5031.It Li "Enter" Ta "Paste selected buffer" 5032.It Li "Up" Ta "Select previous buffer" 5033.It Li "Down" Ta "Select next buffer" 5034.It Li "C-s" Ta "Search by name or content" 5035.It Li "n" Ta "Repeat last search" 5036.It Li "t" Ta "Toggle if buffer is tagged" 5037.It Li "T" Ta "Tag no buffers" 5038.It Li "C-t" Ta "Tag all buffers" 5039.It Li "p" Ta "Paste selected buffer" 5040.It Li "P" Ta "Paste tagged buffers" 5041.It Li "d" Ta "Delete selected buffer" 5042.It Li "D" Ta "Delete tagged buffers" 5043.It Li "f" Ta "Enter a format to filter items" 5044.It Li "O" Ta "Change sort field" 5045.It Li "r" Ta "Reverse sort order" 5046.It Li "v" Ta "Toggle preview" 5047.It Li "q" Ta "Exit mode" 5048.El 5049.Pp 5050After a buffer is chosen, 5051.Ql %% 5052is replaced by the buffer name in 5053.Ar template 5054and the result executed as a command. 5055If 5056.Ar template 5057is not given, "paste-buffer -b '%%'" is used. 5058.Pp 5059.Fl O 5060specifies the initial sort field: one of 5061.Ql time , 5062.Ql name 5063or 5064.Ql size . 5065.Fl r 5066reverses the sort order. 5067.Fl f 5068specifies an initial filter: the filter is a format - if it evaluates to zero, 5069the item in the list is not shown, otherwise it is shown. 5070If a filter would lead to an empty list, it is ignored. 5071.Fl F 5072specifies the format for each item in the list. 5073.Fl N 5074starts without the preview. 5075This command works only if at least one client is attached. 5076.It Ic clear-history Op Fl t Ar target-pane 5077.D1 (alias: Ic clearhist ) 5078Remove and free the history for the specified pane. 5079.It Ic delete-buffer Op Fl b Ar buffer-name 5080.D1 (alias: Ic deleteb ) 5081Delete the buffer named 5082.Ar buffer-name , 5083or the most recently added automatically named buffer if not specified. 5084.It Xo Ic list-buffers 5085.Op Fl F Ar format 5086.Xc 5087.D1 (alias: Ic lsb ) 5088List the global buffers. 5089For the meaning of the 5090.Fl F 5091flag, see the 5092.Sx FORMATS 5093section. 5094.It Xo Ic load-buffer 5095.Op Fl b Ar buffer-name 5096.Ar path 5097.Xc 5098.D1 (alias: Ic loadb ) 5099Load the contents of the specified paste buffer from 5100.Ar path . 5101.It Xo Ic paste-buffer 5102.Op Fl dpr 5103.Op Fl b Ar buffer-name 5104.Op Fl s Ar separator 5105.Op Fl t Ar target-pane 5106.Xc 5107.D1 (alias: Ic pasteb ) 5108Insert the contents of a paste buffer into the specified pane. 5109If not specified, paste into the current one. 5110With 5111.Fl d , 5112also delete the paste buffer. 5113When output, any linefeed (LF) characters in the paste buffer are replaced with 5114a separator, by default carriage return (CR). 5115A custom separator may be specified using the 5116.Fl s 5117flag. 5118The 5119.Fl r 5120flag means to do no replacement (equivalent to a separator of LF). 5121If 5122.Fl p 5123is specified, paste bracket control codes are inserted around the 5124buffer if the application has requested bracketed paste mode. 5125.It Xo Ic save-buffer 5126.Op Fl a 5127.Op Fl b Ar buffer-name 5128.Ar path 5129.Xc 5130.D1 (alias: Ic saveb ) 5131Save the contents of the specified paste buffer to 5132.Ar path . 5133The 5134.Fl a 5135option appends to rather than overwriting the file. 5136.It Xo Ic set-buffer 5137.Op Fl a 5138.Op Fl b Ar buffer-name 5139.Op Fl n Ar new-buffer-name 5140.Ar data 5141.Xc 5142.D1 (alias: Ic setb ) 5143Set the contents of the specified buffer to 5144.Ar data . 5145The 5146.Fl a 5147option appends to rather than overwriting the buffer. 5148The 5149.Fl n 5150option renames the buffer to 5151.Ar new-buffer-name . 5152.It Xo Ic show-buffer 5153.Op Fl b Ar buffer-name 5154.Xc 5155.D1 (alias: Ic showb ) 5156Display the contents of the specified buffer. 5157.El 5158.Sh MISCELLANEOUS 5159Miscellaneous commands are as follows: 5160.Bl -tag -width Ds 5161.It Ic clock-mode Op Fl t Ar target-pane 5162Display a large clock. 5163.It Xo Ic if-shell 5164.Op Fl bF 5165.Op Fl t Ar target-pane 5166.Ar shell-command command 5167.Op Ar command 5168.Xc 5169.D1 (alias: Ic if ) 5170Execute the first 5171.Ar command 5172if 5173.Ar shell-command 5174returns success or the second 5175.Ar command 5176otherwise. 5177Before being executed, 5178.Ar shell-command 5179is expanded using the rules specified in the 5180.Sx FORMATS 5181section, including those relevant to 5182.Ar target-pane . 5183With 5184.Fl b , 5185.Ar shell-command 5186is run in the background. 5187.Pp 5188If 5189.Fl F 5190is given, 5191.Ar shell-command 5192is not executed but considered success if neither empty nor zero (after formats 5193are expanded). 5194.It Ic lock-server 5195.D1 (alias: Ic lock ) 5196Lock each client individually by running the command specified by the 5197.Ic lock-command 5198option. 5199.It Xo Ic run-shell 5200.Op Fl b 5201.Op Fl t Ar target-pane 5202.Ar shell-command 5203.Xc 5204.D1 (alias: Ic run ) 5205Execute 5206.Ar shell-command 5207in the background without creating a window. 5208Before being executed, shell-command is expanded using the rules specified in 5209the 5210.Sx FORMATS 5211section. 5212With 5213.Fl b , 5214the command is run in the background. 5215After it finishes, any output to stdout is displayed in copy mode (in the pane 5216specified by 5217.Fl t 5218or the current pane if omitted). 5219If the command doesn't return success, the exit status is also displayed. 5220.It Xo Ic wait-for 5221.Op Fl L | S | U 5222.Ar channel 5223.Xc 5224.D1 (alias: Ic wait ) 5225When used without options, prevents the client from exiting until woken using 5226.Ic wait-for 5227.Fl S 5228with the same channel. 5229When 5230.Fl L 5231is used, the channel is locked and any clients that try to lock the same 5232channel are made to wait until the channel is unlocked with 5233.Ic wait-for 5234.Fl U . 5235.El 5236.Sh EXIT MESSAGES 5237When a 5238.Nm 5239client detaches, it prints a message. 5240This may be one of: 5241.Bl -tag -width Ds 5242.It [detached (from session ...)] 5243The client was detached normally. 5244.It [detached and SIGHUP] 5245The client was detached and its parent sent the 5246.Dv SIGHUP 5247signal (for example with 5248.Ic detach-client 5249.Fl P ) . 5250.It [lost tty] 5251The client's 5252.Xr tty 4 5253or 5254.Xr pty 4 5255was unexpectedly destroyed. 5256.It [terminated] 5257The client was killed with 5258.Dv SIGTERM . 5259.It [exited] 5260The server exited when it had no sessions. 5261.It [server exited] 5262The server exited when it received 5263.Dv SIGTERM . 5264.It [server exited unexpectedly] 5265The server crashed or otherwise exited without telling the client the reason. 5266.El 5267.Sh TERMINFO EXTENSIONS 5268.Nm 5269understands some unofficial extensions to 5270.Xr terminfo 5 : 5271.Bl -tag -width Ds 5272.It Em Cs , Cr 5273Set the cursor colour. 5274The first takes a single string argument and is used to set the colour; 5275the second takes no arguments and restores the default cursor colour. 5276If set, a sequence such as this may be used 5277to change the cursor colour from inside 5278.Nm : 5279.Bd -literal -offset indent 5280$ printf '\e033]12;red\e033\e\e' 5281.Ed 5282.It Em \&Smol 5283Enable the overline attribute. 5284The capability is usually SGR 53 and can be added to 5285.Ic terminal-overrides 5286as: 5287.Bd -literal -offset indent 5288Smol=\eE[53m 5289.Ed 5290.It Em \&Smulx 5291Set a styled underscore. 5292The single parameter is one of: 0 for no underscore, 1 for normal 5293underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted 5294underscore and 5 for dashed underscore. 5295The capability can typically be added to 5296.Ic terminal-overrides 5297as: 5298.Bd -literal -offset indent 5299Smulx=\eE[4::%p1%dm 5300.Ed 5301.It Em \&Setulc 5302Set the underscore colour. 5303The argument is (red * 65536) + (green * 256) + blue where each is between 0 5304and 255. 5305The capability can typically be added to 5306.Ic terminal-overrides 5307as: 5308.Bd -literal -offset indent 5309Setulc=\eE[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m 5310.Ed 5311.It Em \&Ss , Se 5312Set or reset the cursor style. 5313If set, a sequence such as this may be used 5314to change the cursor to an underline: 5315.Bd -literal -offset indent 5316$ printf '\e033[4 q' 5317.Ed 5318.Pp 5319If 5320.Em Se 5321is not set, \&Ss with argument 0 will be used to reset the cursor style instead. 5322.It Em \&Tc 5323Indicate that the terminal supports the 5324.Ql direct colour 5325RGB escape sequence (for example, \ee[38;2;255;255;255m). 5326.Pp 5327If supported, this is used for the initialize colour escape sequence (which 5328may be enabled by adding the 5329.Ql initc 5330and 5331.Ql ccc 5332capabilities to the 5333.Nm 5334.Xr terminfo 5 5335entry). 5336.It Em \&Ms 5337Store the current buffer in the host terminal's selection (clipboard). 5338See the 5339.Em set-clipboard 5340option above and the 5341.Xr xterm 1 5342man page. 5343.El 5344.Sh CONTROL MODE 5345.Nm 5346offers a textual interface called 5347.Em control mode . 5348This allows applications to communicate with 5349.Nm 5350using a simple text-only protocol. 5351.Pp 5352In control mode, a client sends 5353.Nm 5354commands or command sequences terminated by newlines on standard input. 5355Each command will produce one block of output on standard output. 5356An output block consists of a 5357.Em %begin 5358line followed by the output (which may be empty). 5359The output block ends with a 5360.Em %end 5361or 5362.Em %error . 5363.Em %begin 5364and matching 5365.Em %end 5366or 5367.Em %error 5368have two arguments: an integer time (as seconds from epoch) and command number. 5369For example: 5370.Bd -literal -offset indent 5371%begin 1363006971 2 53720: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active) 5373%end 1363006971 2 5374.Ed 5375.Pp 5376The 5377.Ic refresh-client 5378.Fl C 5379command may be used to set the size of a client in control mode. 5380.Pp 5381In control mode, 5382.Nm 5383outputs notifications. 5384A notification will never occur inside an output block. 5385.Pp 5386The following notifications are defined: 5387.Bl -tag -width Ds 5388.It Ic %client-session-changed Ar client Ar session-id Ar name 5389The client is now attached to the session with ID 5390.Ar session-id , 5391which is named 5392.Ar name . 5393.It Ic %exit Op Ar reason 5394The 5395.Nm 5396client is exiting immediately, either because it is not attached to any session 5397or an error occurred. 5398If present, 5399.Ar reason 5400describes why the client exited. 5401.It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags 5402The layout of a window with ID 5403.Ar window-id 5404changed. 5405The new layout is 5406.Ar window-layout . 5407The window's visible layout is 5408.Ar window-visible-layout 5409and the window flags are 5410.Ar window-flags . 5411.It Ic %output Ar pane-id Ar value 5412A window pane produced output. 5413.Ar value 5414escapes non-printable characters and backslash as octal \\xxx. 5415.It Ic %pane-mode-changed Ar pane-id 5416The pane with ID 5417.Ar pane-id 5418has changed mode. 5419.It Ic %session-changed Ar session-id Ar name 5420The client is now attached to the session with ID 5421.Ar session-id , 5422which is named 5423.Ar name . 5424.It Ic %session-renamed Ar name 5425The current session was renamed to 5426.Ar name . 5427.It Ic %session-window-changed Ar session-id Ar window-id 5428The session with ID 5429.Ar session-id 5430changed its active window to the window with ID 5431.Ar window-id . 5432.It Ic %sessions-changed 5433A session was created or destroyed. 5434.It Ic %unlinked-window-add Ar window-id 5435The window with ID 5436.Ar window-id 5437was created but is not linked to the current session. 5438.It Ic %window-add Ar window-id 5439The window with ID 5440.Ar window-id 5441was linked to the current session. 5442.It Ic %window-close Ar window-id 5443The window with ID 5444.Ar window-id 5445closed. 5446.It Ic %window-pane-changed Ar window-id Ar pane-id 5447The active pane in the window with ID 5448.Ar window-id 5449changed to the pane with ID 5450.Ar pane-id . 5451.It Ic %window-renamed Ar window-id Ar name 5452The window with ID 5453.Ar window-id 5454was renamed to 5455.Ar name . 5456.El 5457.Sh ENVIRONMENT 5458When 5459.Nm 5460is started, it inspects the following environment variables: 5461.Bl -tag -width LC_CTYPE 5462.It Ev EDITOR 5463If the command specified in this variable contains the string 5464.Ql vi 5465and 5466.Ev VISUAL 5467is unset, use vi-style key bindings. 5468Overridden by the 5469.Ic mode-keys 5470and 5471.Ic status-keys 5472options. 5473.It Ev HOME 5474The user's login directory. 5475If unset, the 5476.Xr passwd 5 5477database is consulted. 5478.It Ev LC_CTYPE 5479The character encoding 5480.Xr locale 1 . 5481It is used for two separate purposes. 5482For output to the terminal, UTF-8 is used if the 5483.Fl u 5484option is given or if 5485.Ev LC_CTYPE 5486contains 5487.Qq UTF-8 5488or 5489.Qq UTF8 . 5490Otherwise, only ASCII characters are written and non-ASCII characters 5491are replaced with underscores 5492.Pq Ql _ . 5493For input, 5494.Nm 5495always runs with a UTF-8 locale. 5496If en_US.UTF-8 is provided by the operating system it is used and 5497.Ev LC_CTYPE 5498is ignored for input. 5499Otherwise, 5500.Ev LC_CTYPE 5501tells 5502.Nm 5503what the UTF-8 locale is called on the current system. 5504If the locale specified by 5505.Ev LC_CTYPE 5506is not available or is not a UTF-8 locale, 5507.Nm 5508exits with an error message. 5509.It Ev LC_TIME 5510The date and time format 5511.Xr locale 1 . 5512It is used for locale-dependent 5513.Xr strftime 3 5514format specifiers. 5515.It Ev PWD 5516The current working directory to be set in the global environment. 5517This may be useful if it contains symbolic links. 5518If the value of the variable does not match the current working 5519directory, the variable is ignored and the result of 5520.Xr getcwd 3 5521is used instead. 5522.It Ev SHELL 5523The absolute path to the default shell for new windows. 5524See the 5525.Ic default-shell 5526option for details. 5527.It Ev TMUX_TMPDIR 5528The parent directory of the directory containing the server sockets. 5529See the 5530.Fl L 5531option for details. 5532.It Ev VISUAL 5533If the command specified in this variable contains the string 5534.Ql vi , 5535use vi-style key bindings. 5536Overridden by the 5537.Ic mode-keys 5538and 5539.Ic status-keys 5540options. 5541.El 5542.Sh FILES 5543.Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact 5544.It Pa ~/.tmux.conf 5545Default 5546.Nm 5547configuration file. 5548.It Pa @SYSCONFDIR@/tmux.conf 5549System-wide configuration file. 5550.El 5551.Sh EXAMPLES 5552To create a new 5553.Nm 5554session running 5555.Xr vi 1 : 5556.Pp 5557.Dl $ tmux new-session vi 5558.Pp 5559Most commands have a shorter form, known as an alias. 5560For new-session, this is 5561.Ic new : 5562.Pp 5563.Dl $ tmux new vi 5564.Pp 5565Alternatively, the shortest unambiguous form of a command is accepted. 5566If there are several options, they are listed: 5567.Bd -literal -offset indent 5568$ tmux n 5569ambiguous command: n, could be: new-session, new-window, next-window 5570.Ed 5571.Pp 5572Within an active session, a new window may be created by typing 5573.Ql C-b c 5574(Ctrl 5575followed by the 5576.Ql b 5577key 5578followed by the 5579.Ql c 5580key). 5581.Pp 5582Windows may be navigated with: 5583.Ql C-b 0 5584(to select window 0), 5585.Ql C-b 1 5586(to select window 1), and so on; 5587.Ql C-b n 5588to select the next window; and 5589.Ql C-b p 5590to select the previous window. 5591.Pp 5592A session may be detached using 5593.Ql C-b d 5594(or by an external event such as 5595.Xr ssh 1 5596disconnection) and reattached with: 5597.Pp 5598.Dl $ tmux attach-session 5599.Pp 5600Typing 5601.Ql C-b \&? 5602lists the current key bindings in the current window; up and down may be used 5603to navigate the list or 5604.Ql q 5605to exit from it. 5606.Pp 5607Commands to be run when the 5608.Nm 5609server is started may be placed in the 5610.Pa ~/.tmux.conf 5611configuration file. 5612Common examples include: 5613.Pp 5614Changing the default prefix key: 5615.Bd -literal -offset indent 5616set-option -g prefix C-a 5617unbind-key C-b 5618bind-key C-a send-prefix 5619.Ed 5620.Pp 5621Turning the status line off, or changing its colour: 5622.Bd -literal -offset indent 5623set-option -g status off 5624set-option -g status-style bg=blue 5625.Ed 5626.Pp 5627Setting other options, such as the default command, 5628or locking after 30 minutes of inactivity: 5629.Bd -literal -offset indent 5630set-option -g default-command "exec /bin/ksh" 5631set-option -g lock-after-time 1800 5632.Ed 5633.Pp 5634Creating new key bindings: 5635.Bd -literal -offset indent 5636bind-key b set-option status 5637bind-key / command-prompt "split-window 'exec man %%'" 5638bind-key S command-prompt "new-window -n %1 'ssh %1'" 5639.Ed 5640.Sh SEE ALSO 5641.Xr pty 4 5642.Sh AUTHORS 5643.An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com 5644