1.\" $OpenBSD: tmux.1,v 1.361 2013/06/02 14:40:17 jmc Exp $ 2.\" 3.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> 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 $Mdocdate: June 2 2013 $ 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 28lCquv 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. 103Given twice 104.Xo ( Fl CC ) Xc 105disables echo. 106.It Fl c Ar shell-command 107Execute 108.Ar shell-command 109using the default shell. 110If necessary, the 111.Nm 112server will be started to retrieve the 113.Ic default-shell 114option. 115This option is for compatibility with 116.Xr sh 1 117when 118.Nm 119is used as a login shell. 120.It Fl f Ar file 121Specify an alternative configuration file. 122By default, 123.Nm 124loads the system configuration file from 125.Pa /etc/tmux.conf , 126if present, then looks for a user configuration file at 127.Pa ~/.tmux.conf . 128.Pp 129The configuration file is a set of 130.Nm 131commands which are executed in sequence when the server is first started. 132.Nm 133loads configuration files once when the server process has started. 134The 135.Ic source-file 136command may be used to load a file later. 137.Pp 138.Nm 139shows any error messages from commands in configuration files in the first 140session created, and continues to process the rest of the configuration file. 141.It Fl L Ar socket-name 142.Nm 143stores the server socket in a directory under 144.Ev TMUX_TMPDIR , 145.Ev TMPDIR 146if it is unset, or 147.Pa /tmp 148if both are unset. 149The default socket is named 150.Em default . 151This option allows a different socket name to be specified, allowing several 152independent 153.Nm 154servers to be run. 155Unlike 156.Fl S 157a full path is not necessary: the sockets are all created in the same 158directory. 159.Pp 160If the socket is accidentally removed, the 161.Dv SIGUSR1 162signal may be sent to the 163.Nm 164server process to recreate it. 165.It Fl l 166Behave as a login shell. 167This flag currently has no effect and is for compatibility with other shells 168when using tmux as a login shell. 169.It Fl q 170Set the 171.Ic quiet 172server option to prevent the server sending various informational messages. 173.It Fl S Ar socket-path 174Specify a full alternative path to the server socket. 175If 176.Fl S 177is specified, the default socket directory is not used and any 178.Fl L 179flag is ignored. 180.It Fl u 181.Nm 182attempts to guess if the terminal is likely to support UTF-8 by checking the 183first of the 184.Ev LC_ALL , 185.Ev LC_CTYPE 186and 187.Ev LANG 188environment variables to be set for the string "UTF-8". 189This is not always correct: the 190.Fl u 191flag explicitly informs 192.Nm 193that UTF-8 is supported. 194.Pp 195If the server is started from a client passed 196.Fl u 197or where UTF-8 is detected, the 198.Ic utf8 199and 200.Ic status-utf8 201options are enabled in the global window and session options respectively. 202.It Fl v 203Request verbose logging. 204This option may be specified multiple times for increasing verbosity. 205Log messages will be saved into 206.Pa tmux-client-PID.log 207and 208.Pa tmux-server-PID.log 209files in the current directory, where 210.Em PID 211is the PID of the server or client process. 212.It Ar command Op Ar flags 213This specifies one of a set of commands used to control 214.Nm , 215as described in the following sections. 216If no commands are specified, the 217.Ic new-session 218command is assumed. 219.El 220.Sh KEY BINDINGS 221.Nm 222may be controlled from an attached client by using a key combination of a 223prefix key, 224.Ql C-b 225(Ctrl-b) by default, followed by a command key. 226.Pp 227The default command key bindings are: 228.Pp 229.Bl -tag -width "XXXXXXXXXX" -offset indent -compact 230.It C-b 231Send the prefix key (C-b) through to the application. 232.It C-o 233Rotate the panes in the current window forwards. 234.It C-z 235Suspend the 236.Nm 237client. 238.It ! 239Break the current pane out of the window. 240.It \&" 241Split the current pane into two, top and bottom. 242.It # 243List all paste buffers. 244.It $ 245Rename the current session. 246.It % 247Split the current pane into two, left and right. 248.It & 249Kill the current window. 250.It ' 251Prompt for a window index to select. 252.It , 253Rename the current window. 254.It - 255Delete the most recently copied buffer of text. 256.It . 257Prompt for an index to move the current window. 258.It 0 to 9 259Select windows 0 to 9. 260.It : 261Enter the 262.Nm 263command prompt. 264.It ; 265Move to the previously active pane. 266.It = 267Choose which buffer to paste interactively from a list. 268.It \&? 269List all key bindings. 270.It D 271Choose a client to detach. 272.It \&[ 273Enter copy mode to copy text or view the history. 274.It \&] 275Paste the most recently copied buffer of text. 276.It c 277Create a new window. 278.It d 279Detach the current client. 280.It f 281Prompt to search for text in open windows. 282.It i 283Display some information about the current window. 284.It l 285Move to the previously selected window. 286.It n 287Change to the next window. 288.It o 289Select the next pane in the current window. 290.It p 291Change to the previous window. 292.It q 293Briefly display pane indexes. 294.It r 295Force redraw of the attached client. 296.It s 297Select a new session for the attached client interactively. 298.It L 299Switch the attached client back to the last session. 300.It t 301Show the time. 302.It w 303Choose the current window interactively. 304.It x 305Kill the current pane. 306.It { 307Swap the current pane with the previous pane. 308.It } 309Swap the current pane with the next pane. 310.It ~ 311Show previous messages from 312.Nm , 313if any. 314.It Page Up 315Enter copy mode and scroll one page up. 316.It Up, Down 317.It Left, Right 318Change to the pane above, below, to the left, or to the right of the current 319pane. 320.It M-1 to M-5 321Arrange panes in one of the five preset layouts: even-horizontal, 322even-vertical, main-horizontal, main-vertical, or tiled. 323.It M-n 324Move to the next window with a bell or activity marker. 325.It M-o 326Rotate the panes in the current window backwards. 327.It M-p 328Move to the previous window with a bell or activity marker. 329.It C-Up, C-Down 330.It C-Left, C-Right 331Resize the current pane in steps of one cell. 332.It M-Up, M-Down 333.It M-Left, M-Right 334Resize the current pane in steps of five cells. 335.El 336.Pp 337Key bindings may be changed with the 338.Ic bind-key 339and 340.Ic unbind-key 341commands. 342.Sh COMMANDS 343This section contains a list of the commands supported by 344.Nm . 345Most commands accept the optional 346.Fl t 347argument with one of 348.Ar target-client , 349.Ar target-session 350.Ar target-window , 351or 352.Ar target-pane . 353These specify the client, session, window or pane which a command should affect. 354.Ar target-client 355is the name of the 356.Xr pty 4 357file to which the client is connected, for example either of 358.Pa /dev/ttyp1 359or 360.Pa ttyp1 361for the client attached to 362.Pa /dev/ttyp1 . 363If no client is specified, the current client is chosen, if possible, or an 364error is reported. 365Clients may be listed with the 366.Ic list-clients 367command. 368.Pp 369.Ar target-session 370is the session id prefixed with a $, the name of a session (as listed by the 371.Ic list-sessions 372command), or the name of a client with the same syntax as 373.Ar target-client , 374in which case the session attached to the client is used. 375When looking for the session name, 376.Nm 377initially searches for an exact match; if none is found, the session names 378are checked for any for which 379.Ar target-session 380is a prefix or for which it matches as an 381.Xr fnmatch 3 382pattern. 383If a single match is found, it is used as the target session; multiple matches 384produce an error. 385If a session is omitted, the current session is used if available; if no 386current session is available, the most recently used is chosen. 387.Pp 388.Ar target-window 389specifies a window in the form 390.Em session Ns \&: Ns Em window . 391.Em session 392follows the same rules as for 393.Ar target-session , 394and 395.Em window 396is looked for in order: as a window index, for example mysession:1; 397as a window ID, such as @1; 398as an exact window name, such as mysession:mywindow; then as an 399.Xr fnmatch 3 400pattern or the start of a window name, such as mysession:mywin* or 401mysession:mywin. 402An empty window name specifies the next unused index if appropriate (for 403example the 404.Ic new-window 405and 406.Ic link-window 407commands) 408otherwise the current window in 409.Em session 410is chosen. 411The special character 412.Ql \&! 413uses the last (previously current) window, 414.Ql ^ 415selects the highest numbered window, 416.Ql $ 417selects the lowest numbered window, and 418.Ql + 419and 420.Ql - 421select the next window or the previous window by number. 422When the argument does not contain a colon, 423.Nm 424first attempts to parse it as window; if that fails, an attempt is made to 425match a session. 426.Pp 427.Ar target-pane 428takes a similar form to 429.Ar target-window 430but with the optional addition of a period followed by a pane index, for 431example: mysession:mywindow.1. 432If the pane index is omitted, the currently active pane in the specified 433window is used. 434If neither a colon nor period appears, 435.Nm 436first attempts to use the argument as a pane index; if that fails, it is looked 437up as for 438.Ar target-window . 439A 440.Ql + 441or 442.Ql - 443indicate the next or previous pane index, respectively. 444One of the strings 445.Em top , 446.Em bottom , 447.Em left , 448.Em right , 449.Em top-left , 450.Em top-right , 451.Em bottom-left 452or 453.Em bottom-right 454may be used instead of a pane index. 455.Pp 456The special characters 457.Ql + 458and 459.Ql - 460may be followed by an offset, for example: 461.Bd -literal -offset indent 462select-window -t:+2 463.Ed 464.Pp 465When dealing with a session that doesn't contain sequential window indexes, 466they will be correctly skipped. 467.Pp 468.Nm 469also gives each pane created in a server an identifier consisting of a 470.Ql % 471and a number, starting from zero. 472A pane's identifier is unique for the life of the 473.Nm 474server and is passed to the child process of the pane in the 475.Ev TMUX_PANE 476environment variable. 477It may be used alone to target a pane or the window containing it. 478.Pp 479.Ar shell-command 480arguments are 481.Xr sh 1 482commands. 483These must be passed as a single item, which typically means quoting them, for 484example: 485.Bd -literal -offset indent 486new-window 'vi /etc/passwd' 487.Ed 488.Pp 489.Ar command 490.Op Ar arguments 491refers to a 492.Nm 493command, passed with the command and arguments separately, for example: 494.Bd -literal -offset indent 495bind-key F1 set-window-option force-width 81 496.Ed 497.Pp 498Or if using 499.Xr sh 1 : 500.Bd -literal -offset indent 501$ tmux bind-key F1 set-window-option force-width 81 502.Ed 503.Pp 504Multiple commands may be specified together as part of a 505.Em command sequence . 506Each command should be separated by spaces and a semicolon; 507commands are executed sequentially from left to right and 508lines ending with a backslash continue on to the next line, 509except when escaped by another backslash. 510A literal semicolon may be included by escaping it with a backslash (for 511example, when specifying a command sequence to 512.Ic bind-key ) . 513.Pp 514Example 515.Nm 516commands include: 517.Bd -literal -offset indent 518refresh-client -t/dev/ttyp2 519 520rename-session -tfirst newname 521 522set-window-option -t:0 monitor-activity on 523 524new-window ; split-window -d 525 526bind-key R source-file ~/.tmux.conf \e; \e 527 display-message "source-file done" 528.Ed 529.Pp 530Or from 531.Xr sh 1 : 532.Bd -literal -offset indent 533$ tmux kill-window -t :1 534 535$ tmux new-window \e; split-window -d 536 537$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach 538.Ed 539.Sh CLIENTS AND SESSIONS 540The 541.Nm 542server manages clients, sessions, windows and panes. 543Clients are attached to sessions to interact with them, either 544when they are created with the 545.Ic new-session 546command, or later with the 547.Ic attach-session 548command. 549Each session has one or more windows 550.Em linked 551into it. 552Windows may be linked to multiple sessions and are made up of one or 553more panes, 554each of which contains a pseudo terminal. 555Commands for creating, linking and otherwise manipulating windows 556are covered 557in the 558.Sx WINDOWS AND PANES 559section. 560.Pp 561The following commands are available to manage clients and sessions: 562.Bl -tag -width Ds 563.It Xo Ic attach-session 564.Op Fl dr 565.Op Fl t Ar target-session 566.Xc 567.D1 (alias: Ic attach ) 568If run from outside 569.Nm , 570create a new client in the current terminal and attach it to 571.Ar target-session . 572If used from inside, switch the current client. 573If 574.Fl d 575is specified, any other clients attached to the session are detached. 576.Fl r 577signifies the client is read-only (only keys bound to the 578.Ic detach-client 579or 580.Ic switch-client 581commands have any effect) 582.Pp 583If no server is started, 584.Ic attach-session 585will attempt to start it; this will fail unless sessions are created in the 586configuration file. 587.Pp 588The 589.Ar target-session 590rules for 591.Ic attach-session 592are slightly adjusted: if 593.Nm 594needs to select the most recently used session, it will prefer the most 595recently used 596.Em unattached 597session. 598.It Xo Ic detach-client 599.Op Fl P 600.Op Fl a 601.Op Fl s Ar target-session 602.Op Fl t Ar target-client 603.Xc 604.D1 (alias: Ic detach ) 605Detach the current client if bound to a key, the client specified with 606.Fl t , 607or all clients currently attached to the session specified by 608.Fl s . 609The 610.Fl a 611option kills all but the client given with 612.Fl t . 613If 614.Fl P 615is given, send SIGHUP to the parent process of the client, typically causing it 616to exit. 617.It Ic has-session Op Fl t Ar target-session 618.D1 (alias: Ic has ) 619Report an error and exit with 1 if the specified session does not exist. 620If it does exist, exit with 0. 621.It Ic kill-server 622Kill the 623.Nm 624server and clients and destroy all sessions. 625.It Ic kill-session 626.Op Fl a 627.Op Fl t Ar target-session 628Destroy the given session, closing any windows linked to it and no other 629sessions, and detaching all clients attached to it. 630If 631.Fl a 632is given, all sessions but the specified one is killed. 633.It Xo Ic list-clients 634.Op Fl F Ar format 635.Op Fl t Ar target-session 636.Xc 637.D1 (alias: Ic lsc ) 638List all clients attached to the server. 639For the meaning of the 640.Fl F 641flag, see the 642.Sx FORMATS 643section. 644If 645.Ar target-session 646is specified, list only clients connected to that session. 647.It Ic list-commands 648.D1 (alias: Ic lscm ) 649List the syntax of all commands supported by 650.Nm . 651.It Ic list-sessions Op Fl F Ar format 652.D1 (alias: Ic ls ) 653List all sessions managed by the server. 654For the meaning of the 655.Fl F 656flag, see the 657.Sx FORMATS 658section. 659.It Ic lock-client Op Fl t Ar target-client 660.D1 (alias: Ic lockc ) 661Lock 662.Ar target-client , 663see the 664.Ic lock-server 665command. 666.It Ic lock-session Op Fl t Ar target-session 667.D1 (alias: Ic locks ) 668Lock all clients attached to 669.Ar target-session . 670.It Xo Ic new-session 671.Op Fl AdDP 672.Op Fl F Ar format 673.Op Fl n Ar window-name 674.Op Fl s Ar session-name 675.Op Fl t Ar target-session 676.Op Fl x Ar width 677.Op Fl y Ar height 678.Op Ar shell-command 679.Xc 680.D1 (alias: Ic new ) 681Create a new session with name 682.Ar session-name . 683.Pp 684The new session is attached to the current terminal unless 685.Fl d 686is given. 687.Ar window-name 688and 689.Ar shell-command 690are the name of and shell command to execute in the initial window. 691If 692.Fl d 693is used, 694.Fl x 695and 696.Fl y 697specify the size of the initial window (80 by 24 if not given). 698.Pp 699If run from a terminal, any 700.Xr termios 4 701special characters are saved and used for new windows in the new session. 702.Pp 703The 704.Fl A 705flag makes 706.Ic new-session 707behave like 708.Ic attach-session 709if 710.Ar session-name 711already exists; in the case, 712.Fl D 713behaves like 714.Fl d 715to 716.Ic attach-session . 717.Pp 718If 719.Fl t 720is given, the new session is 721.Em grouped 722with 723.Ar target-session . 724This means they share the same set of windows - all windows from 725.Ar target-session 726are linked to the new session and any subsequent new windows or windows being 727closed are applied to both sessions. 728The current and previous window and any session options remain independent and 729either session may be killed without affecting the other. 730Giving 731.Fl n 732or 733.Ar shell-command 734are invalid if 735.Fl t 736is used. 737.Pp 738The 739.Fl P 740option prints information about the new session after it has been created. 741By default, it uses the format 742.Ql #{session_name}: 743but a different format may be specified with 744.Fl F . 745.It Xo Ic refresh-client 746.Op Fl S 747.Op Fl t Ar target-client 748.Xc 749.D1 (alias: Ic refresh ) 750Refresh the current client if bound to a key, or a single client if one is given 751with 752.Fl t . 753If 754.Fl S 755is specified, only update the client's status bar. 756.It Xo Ic rename-session 757.Op Fl t Ar target-session 758.Ar new-name 759.Xc 760.D1 (alias: Ic rename ) 761Rename the session to 762.Ar new-name . 763.It Xo Ic show-messages 764.Op Fl t Ar target-client 765.Xc 766.D1 (alias: Ic showmsgs ) 767Any messages displayed on the status line are saved in a per-client message 768log, up to a maximum of the limit set by the 769.Ar message-limit 770session option for the session attached to that client. 771This command displays the log for 772.Ar target-client . 773.It Ic source-file Ar path 774.D1 (alias: Ic source ) 775Execute commands from 776.Ar path . 777.It Ic start-server 778.D1 (alias: Ic start ) 779Start the 780.Nm 781server, if not already running, without creating any sessions. 782.It Xo Ic suspend-client 783.Op Fl t Ar target-client 784.Xc 785.D1 (alias: Ic suspendc ) 786Suspend a client by sending 787.Dv SIGTSTP 788(tty stop). 789.It Xo Ic switch-client 790.Op Fl lnpr 791.Op Fl c Ar target-client 792.Op Fl t Ar target-session 793.Xc 794.D1 (alias: Ic switchc ) 795Switch the current session for client 796.Ar target-client 797to 798.Ar target-session . 799If 800.Fl l , 801.Fl n 802or 803.Fl p 804is used, the client is moved to the last, next or previous session 805respectively. 806.Fl r 807toggles whether a client is read-only (see the 808.Ic attach-session 809command). 810.El 811.Sh WINDOWS AND PANES 812A 813.Nm 814window may be in one of several modes. 815The default permits direct access to the terminal attached to the window. 816The other is copy mode, which permits a section of a window or its 817history to be copied to a 818.Em paste buffer 819for later insertion into another window. 820This mode is entered with the 821.Ic copy-mode 822command, bound to 823.Ql \&[ 824by default. 825It is also entered when a command that produces output, such as 826.Ic list-keys , 827is executed from a key binding. 828.Pp 829The keys available depend on whether emacs or vi mode is selected 830(see the 831.Ic mode-keys 832option). 833The following keys are supported as appropriate for the mode: 834.Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent 835.It Sy "Function" Ta Sy "vi" Ta Sy "emacs" 836.It Li "Back to indentation" Ta "^" Ta "M-m" 837.It Li "Bottom of history" Ta "G" Ta "M-<" 838.It Li "Clear selection" Ta "Escape" Ta "C-g" 839.It Li "Copy selection" Ta "Enter" Ta "M-w" 840.It Li "Cursor down" Ta "j" Ta "Down" 841.It Li "Cursor left" Ta "h" Ta "Left" 842.It Li "Cursor right" Ta "l" Ta "Right" 843.It Li "Cursor to bottom line" Ta "L" Ta "" 844.It Li "Cursor to middle line" Ta "M" Ta "M-r" 845.It Li "Cursor to top line" Ta "H" Ta "M-R" 846.It Li "Cursor up" Ta "k" Ta "Up" 847.It Li "Delete entire line" Ta "d" Ta "C-u" 848.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k" 849.It Li "End of line" Ta "$" Ta "C-e" 850.It Li "Go to line" Ta ":" Ta "g" 851.It Li "Half page down" Ta "C-d" Ta "M-Down" 852.It Li "Half page up" Ta "C-u" Ta "M-Up" 853.It Li "Jump forward" Ta "f" Ta "f" 854.It Li "Jump to forward" Ta "t" Ta "" 855.It Li "Jump backward" Ta "F" Ta "F" 856.It Li "Jump to backward" Ta "T" Ta "" 857.It Li "Jump again" Ta ";" Ta ";" 858.It Li "Jump again in reverse" Ta "," Ta "," 859.It Li "Next page" Ta "C-f" Ta "Page down" 860.It Li "Next space" Ta "W" Ta "" 861.It Li "Next space, end of word" Ta "E" Ta "" 862.It Li "Next word" Ta "w" Ta "" 863.It Li "Next word end" Ta "e" Ta "M-f" 864.It Li "Paste buffer" Ta "p" Ta "C-y" 865.It Li "Previous page" Ta "C-b" Ta "Page up" 866.It Li "Previous word" Ta "b" Ta "M-b" 867.It Li "Previous space" Ta "B" Ta "" 868.It Li "Quit mode" Ta "q" Ta "Escape" 869.It Li "Rectangle toggle" Ta "v" Ta "R" 870.It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down" 871.It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up" 872.It Li "Search again" Ta "n" Ta "n" 873.It Li "Search again in reverse" Ta "N" Ta "N" 874.It Li "Search backward" Ta "?" Ta "C-r" 875.It Li "Search forward" Ta "/" Ta "C-s" 876.It Li "Start of line" Ta "0" Ta "C-a" 877.It Li "Start selection" Ta "Space" Ta "C-Space" 878.It Li "Top of history" Ta "g" Ta "M->" 879.It Li "Transpose characters" Ta "" Ta "C-t" 880.El 881.Pp 882The next and previous word keys use space and the 883.Ql - , 884.Ql _ 885and 886.Ql @ 887characters as word delimiters by default, but this can be adjusted by 888setting the 889.Em word-separators 890session option. 891Next word moves to the start of the next word, next word end to the end of the 892next word and previous word to the start of the previous word. 893The three next and previous space keys work similarly but use a space alone as 894the word separator. 895.Pp 896The jump commands enable quick movement within a line. 897For instance, typing 898.Ql f 899followed by 900.Ql / 901will move the cursor to the next 902.Ql / 903character on the current line. 904A 905.Ql \&; 906will then jump to the next occurrence. 907.Pp 908Commands in copy mode may be prefaced by an optional repeat count. 909With vi key bindings, a prefix is entered using the number keys; with 910emacs, the Alt (meta) key and a number begins prefix entry. 911For example, to move the cursor forward by ten words, use 912.Ql M-1 0 M-f 913in emacs mode, and 914.Ql 10w 915in vi. 916.Pp 917When copying the selection, the repeat count indicates the buffer index to 918replace, if used. 919.Pp 920Mode key bindings are defined in a set of named tables: 921.Em vi-edit 922and 923.Em emacs-edit 924for keys used when line editing at the command prompt; 925.Em vi-choice 926and 927.Em emacs-choice 928for keys used when choosing from lists (such as produced by the 929.Ic choose-window 930command); and 931.Em vi-copy 932and 933.Em emacs-copy 934used in copy mode. 935The tables may be viewed with the 936.Ic list-keys 937command and keys modified or removed with 938.Ic bind-key 939and 940.Ic unbind-key . 941One command accepts an argument, 942.Ic copy-pipe , 943which copies the selection and pipes it to a command. 944For example the following will bind 945.Ql C-q 946to copy the selection into 947.Pa /tmp 948as well as the paste buffer: 949.Bd -literal -offset indent 950bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out" 951.Ed 952.Pp 953The paste buffer key pastes the first line from the top paste buffer on the 954stack. 955.Pp 956The synopsis for the 957.Ic copy-mode 958command is: 959.Bl -tag -width Ds 960.It Xo Ic copy-mode 961.Op Fl u 962.Op Fl t Ar target-pane 963.Xc 964Enter copy mode. 965The 966.Fl u 967option scrolls one page up. 968.El 969.Pp 970Each window displayed by 971.Nm 972may be split into one or more 973.Em panes ; 974each pane takes up a certain area of the display and is a separate terminal. 975A window may be split into panes using the 976.Ic split-window 977command. 978Windows may be split horizontally (with the 979.Fl h 980flag) or vertically. 981Panes may be resized with the 982.Ic resize-pane 983command (bound to 984.Ql C-up , 985.Ql C-down 986.Ql C-left 987and 988.Ql C-right 989by default), the current pane may be changed with the 990.Ic select-pane 991command and the 992.Ic rotate-window 993and 994.Ic swap-pane 995commands may be used to swap panes without changing their position. 996Panes are numbered beginning from zero in the order they are created. 997.Pp 998A number of preset 999.Em layouts 1000are available. 1001These may be selected with the 1002.Ic select-layout 1003command or cycled with 1004.Ic next-layout 1005(bound to 1006.Ql Space 1007by default); once a layout is chosen, panes within it may be moved and resized 1008as normal. 1009.Pp 1010The following layouts are supported: 1011.Bl -tag -width Ds 1012.It Ic even-horizontal 1013Panes are spread out evenly from left to right across the window. 1014.It Ic even-vertical 1015Panes are spread evenly from top to bottom. 1016.It Ic main-horizontal 1017A large (main) pane is shown at the top of the window and the remaining panes 1018are spread from left to right in the leftover space at the bottom. 1019Use the 1020.Em main-pane-height 1021window option to specify the height of the top pane. 1022.It Ic main-vertical 1023Similar to 1024.Ic main-horizontal 1025but the large pane is placed on the left and the others spread from top to 1026bottom along the right. 1027See the 1028.Em main-pane-width 1029window option. 1030.It Ic tiled 1031Panes are spread out as evenly as possible over the window in both rows and 1032columns. 1033.El 1034.Pp 1035In addition, 1036.Ic select-layout 1037may be used to apply a previously used layout - the 1038.Ic list-windows 1039command displays the layout of each window in a form suitable for use with 1040.Ic select-layout . 1041For example: 1042.Bd -literal -offset indent 1043$ tmux list-windows 10440: ksh [159x48] 1045 layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1046$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1047.Ed 1048.Pp 1049.Nm 1050automatically adjusts the size of the layout for the current window size. 1051Note that a layout cannot be applied to a window with more panes than that 1052from which the layout was originally defined. 1053.Pp 1054Commands related to windows and panes are as follows: 1055.Bl -tag -width Ds 1056.It Xo Ic break-pane 1057.Op Fl dP 1058.Op Fl F Ar format 1059.Op Fl t Ar target-pane 1060.Xc 1061.D1 (alias: Ic breakp ) 1062Break 1063.Ar target-pane 1064off from its containing window to make it the only pane in a new window. 1065If 1066.Fl d 1067is given, the new window does not become the current window. 1068The 1069.Fl P 1070option prints information about the new window after it has been created. 1071By default, it uses the format 1072.Ql #{session_name}:#{window_index} 1073but a different format may be specified with 1074.Fl F . 1075.It Xo Ic capture-pane 1076.Op Fl aepPq 1077.Op Fl b Ar buffer-index 1078.Op Fl E Ar end-line 1079.Op Fl S Ar start-line 1080.Op Fl t Ar target-pane 1081.Xc 1082.D1 (alias: Ic capturep ) 1083Capture the contents of a pane. 1084If 1085.Fl p 1086is given, the output goes to stdout, otherwise to the buffer specified with 1087.Fl b 1088or a new buffer if omitted. 1089If 1090.Fl a 1091is given, the alternate screen is used, and the history is not accessible. 1092If no alternate screen exists, an error will be returned unless 1093.Fl q 1094is given. 1095If 1096.Fl e 1097is given, the output includes escape sequences for text and background 1098attributes. 1099.Fl C 1100also escapes non-printable characters as octal \exxx. 1101.Fl J 1102joins wrapped lines and preserves trailing spaces at each line's end. 1103.Fl P 1104captures only any output that the pane has received that is the beginning of an 1105as-yet incomplete escape sequence. 1106.Pp 1107.Fl S 1108and 1109.Fl E 1110specify the starting and ending line numbers, zero is the first line of the 1111visible pane and negative numbers are lines in the history. 1112The default is to capture only the visible contents of the pane. 1113.It Xo 1114.Ic choose-client 1115.Op Fl F Ar format 1116.Op Fl t Ar target-window 1117.Op Ar template 1118.Xc 1119Put a window into client choice mode, allowing a client to be selected 1120interactively from a list. 1121After a client is chosen, 1122.Ql %% 1123is replaced by the client 1124.Xr pty 4 1125path in 1126.Ar template 1127and the result executed as a command. 1128If 1129.Ar template 1130is not given, "detach-client -t '%%'" is used. 1131For the meaning of the 1132.Fl F 1133flag, see the 1134.Sx FORMATS 1135section. 1136This command works only if at least one client is attached. 1137.It Xo 1138.Ic choose-list 1139.Op Fl l Ar items 1140.Op Fl t Ar target-window 1141.Op Ar template 1142.Xc 1143Put a window into list choice mode, allowing 1144.Ar items 1145to be selected. 1146.Ar items 1147can be a comma-separated list to display more than one item. 1148If an item has spaces, that entry must be quoted. 1149After an item is chosen, 1150.Ql %% 1151is replaced by the chosen item in the 1152.Ar template 1153and the result is executed as a command. 1154If 1155.Ar template 1156is not given, "run-shell '%%'" is used. 1157.Ar items 1158also accepts format specifiers. 1159For the meaning of this see the 1160.Sx FORMATS 1161section. 1162This command works only if at least one client is attached. 1163.It Xo 1164.Ic choose-session 1165.Op Fl F Ar format 1166.Op Fl t Ar target-window 1167.Op Ar template 1168.Xc 1169Put a window into session choice mode, where a session may be selected 1170interactively from a list. 1171When one is chosen, 1172.Ql %% 1173is replaced by the session name in 1174.Ar template 1175and the result executed as a command. 1176If 1177.Ar template 1178is not given, "switch-client -t '%%'" is used. 1179For the meaning of the 1180.Fl F 1181flag, see the 1182.Sx FORMATS 1183section. 1184This command works only if at least one client is attached. 1185.It Xo 1186.Ic choose-tree 1187.Op Fl suw 1188.Op Fl b Ar session-template 1189.Op Fl c Ar window-template 1190.Op Fl S Ar format 1191.Op Fl W Ar format 1192.Op Fl t Ar target-window 1193.Xc 1194Put a window into tree choice mode, where either sessions or windows may be 1195selected interactively from a list. 1196By default, windows belonging to a session are indented to show their 1197relationship to a session. 1198.Pp 1199Note that the 1200.Ic choose-window 1201and 1202.Ic choose-session 1203commands are wrappers around 1204.Ic choose-tree . 1205.Pp 1206If 1207.Fl s 1208is given, will show sessions. 1209If 1210.Fl w 1211is given, will show windows. 1212.Pp 1213By default, the tree is collapsed and sessions must be expanded to windows 1214with the right arrow key. 1215The 1216.Fl u 1217option will start with all sessions expanded instead. 1218.Pp 1219If 1220.Fl b 1221is given, will override the default session command. 1222Note that 1223.Ql %% 1224can be used and will be replaced with the session name. 1225The default option if not specified is "switch-client -t '%%'". 1226If 1227.Fl c 1228is given, will override the default window command. 1229Like 1230.Fl b , 1231.Ql %% 1232can be used and will be replaced with the session name and window index. 1233When a window is chosen from the list, the session command is run before the 1234window command. 1235.Pp 1236If 1237.Fl S 1238is given will display the specified format instead of the default session 1239format. 1240If 1241.Fl W 1242is given will display the specified format instead of the default window 1243format. 1244For the meaning of the 1245.Fl s 1246and 1247.Fl w 1248options, see the 1249.Sx FORMATS 1250section. 1251.Pp 1252This command works only if at least one client is attached. 1253.It Xo 1254.Ic choose-window 1255.Op Fl F Ar format 1256.Op Fl t Ar target-window 1257.Op Ar template 1258.Xc 1259Put a window into window choice mode, where a window may be chosen 1260interactively from a list. 1261After a window is selected, 1262.Ql %% 1263is replaced by the session name and window index in 1264.Ar template 1265and the result executed as a command. 1266If 1267.Ar template 1268is not given, "select-window -t '%%'" is used. 1269For the meaning of the 1270.Fl F 1271flag, see the 1272.Sx FORMATS 1273section. 1274This command works only if at least one client is attached. 1275.It Ic display-panes Op Fl t Ar target-client 1276.D1 (alias: Ic displayp) 1277Display a visible indicator of each pane shown by 1278.Ar target-client . 1279See the 1280.Ic display-panes-time , 1281.Ic display-panes-colour , 1282and 1283.Ic display-panes-active-colour 1284session options. 1285While the indicator is on screen, a pane may be selected with the 1286.Ql 0 1287to 1288.Ql 9 1289keys. 1290.It Xo Ic find-window 1291.Op Fl CNT 1292.Op Fl F Ar format 1293.Op Fl t Ar target-window 1294.Ar match-string 1295.Xc 1296.D1 (alias: Ic findw ) 1297Search for the 1298.Xr fnmatch 3 1299pattern 1300.Ar match-string 1301in window names, titles, and visible content (but not history). 1302The flags control matching behavior: 1303.Fl C 1304matches only visible window contents, 1305.Fl N 1306matches only the window name and 1307.Fl T 1308matches only the window title. 1309The default is 1310.Fl CNT . 1311If only one window is matched, it'll be automatically selected, 1312otherwise a choice list is shown. 1313For the meaning of the 1314.Fl F 1315flag, see the 1316.Sx FORMATS 1317section. 1318This command works only if at least one client is attached. 1319.It Xo Ic join-pane 1320.Op Fl bdhv 1321.Oo Fl l 1322.Ar size | 1323.Fl p Ar percentage Oc 1324.Op Fl s Ar src-pane 1325.Op Fl t Ar dst-pane 1326.Xc 1327.D1 (alias: Ic joinp ) 1328Like 1329.Ic split-window , 1330but instead of splitting 1331.Ar dst-pane 1332and creating a new pane, split it and move 1333.Ar src-pane 1334into the space. 1335This can be used to reverse 1336.Ic break-pane . 1337The 1338.Fl b 1339option causes 1340.Ar src-pane 1341to be joined to left of or above 1342.Ar dst-pane . 1343.It Xo Ic kill-pane 1344.Op Fl a 1345.Op Fl t Ar target-pane 1346.Xc 1347.D1 (alias: Ic killp ) 1348Destroy the given pane. 1349If no panes remain in the containing window, it is also destroyed. 1350The 1351.Fl a 1352option kills all but the pane given with 1353.Fl t . 1354.It Xo Ic kill-window 1355.Op Fl a 1356.Op Fl t Ar target-window 1357.Xc 1358.D1 (alias: Ic killw ) 1359Kill the current window or the window at 1360.Ar target-window , 1361removing it from any sessions to which it is linked. 1362The 1363.Fl a 1364option kills all but the window given with 1365.Fl t . 1366.It Ic last-pane Op Fl t Ar target-window 1367.D1 (alias: Ic lastp ) 1368Select the last (previously selected) pane. 1369.It Ic last-window Op Fl t Ar target-session 1370.D1 (alias: Ic last ) 1371Select the last (previously selected) window. 1372If no 1373.Ar target-session 1374is specified, select the last window of the current session. 1375.It Xo Ic link-window 1376.Op Fl dk 1377.Op Fl s Ar src-window 1378.Op Fl t Ar dst-window 1379.Xc 1380.D1 (alias: Ic linkw ) 1381Link the window at 1382.Ar src-window 1383to the specified 1384.Ar dst-window . 1385If 1386.Ar dst-window 1387is specified and no such window exists, the 1388.Ar src-window 1389is linked there. 1390If 1391.Fl k 1392is given and 1393.Ar dst-window 1394exists, it is killed, otherwise an error is generated. 1395If 1396.Fl d 1397is given, the newly linked window is not selected. 1398.It Xo Ic list-panes 1399.Op Fl as 1400.Op Fl F Ar format 1401.Op Fl t Ar target 1402.Xc 1403.D1 (alias: Ic lsp ) 1404If 1405.Fl a 1406is given, 1407.Ar target 1408is ignored and all panes on the server are listed. 1409If 1410.Fl s 1411is given, 1412.Ar target 1413is a session (or the current session). 1414If neither is given, 1415.Ar target 1416is a window (or the current window). 1417For the meaning of the 1418.Fl F 1419flag, see the 1420.Sx FORMATS 1421section. 1422.It Xo Ic list-windows 1423.Op Fl a 1424.Op Fl F Ar format 1425.Op Fl t Ar target-session 1426.Xc 1427.D1 (alias: Ic lsw ) 1428If 1429.Fl a 1430is given, list all windows on the server. 1431Otherwise, list windows in the current session or in 1432.Ar target-session . 1433For the meaning of the 1434.Fl F 1435flag, see the 1436.Sx FORMATS 1437section. 1438.It Xo Ic move-pane 1439.Op Fl bdhv 1440.Oo Fl l 1441.Ar size | 1442.Fl p Ar percentage Oc 1443.Op Fl s Ar src-pane 1444.Op Fl t Ar dst-pane 1445.Xc 1446.D1 (alias: Ic movep ) 1447Like 1448.Ic join-pane , 1449but 1450.Ar src-pane 1451and 1452.Ar dst-pane 1453may belong to the same window. 1454.It Xo Ic move-window 1455.Op Fl rdk 1456.Op Fl s Ar src-window 1457.Op Fl t Ar dst-window 1458.Xc 1459.D1 (alias: Ic movew ) 1460This is similar to 1461.Ic link-window , 1462except the window at 1463.Ar src-window 1464is moved to 1465.Ar dst-window . 1466With 1467.Fl r , 1468all windows in the session are renumbered in sequential order, respecting 1469the 1470.Ic base-index 1471option. 1472.It Xo Ic new-window 1473.Op Fl adkP 1474.Op Fl c Ar start-directory 1475.Op Fl F Ar format 1476.Op Fl n Ar window-name 1477.Op Fl t Ar target-window 1478.Op Ar shell-command 1479.Xc 1480.D1 (alias: Ic neww ) 1481Create a new window. 1482With 1483.Fl a , 1484the new window is inserted at the next index up from the specified 1485.Ar target-window , 1486moving windows up if necessary, 1487otherwise 1488.Ar target-window 1489is the new window location. 1490.Pp 1491If 1492.Fl d 1493is given, the session does not make the new window the current window. 1494.Ar target-window 1495represents the window to be created; if the target already exists an error is 1496shown, unless the 1497.Fl k 1498flag is used, in which case it is destroyed. 1499.Ar shell-command 1500is the command to execute. 1501If 1502.Ar shell-command 1503is not specified, the value of the 1504.Ic default-command 1505option is used. 1506.Fl c 1507specifies the working directory in which the new window is created. 1508It may have an absolute path or one of the following values (or a subdirectory): 1509.Bl -column "XXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXXXX" -offset indent 1510.It Li "Empty string" Ta "Current pane's directory" 1511.It Li "~" Ta "User's home directory" 1512.It Li "-" Ta "Where session was started" 1513.It Li "." Ta "Where server was started" 1514.El 1515.Pp 1516When the shell command completes, the window closes. 1517See the 1518.Ic remain-on-exit 1519option to change this behaviour. 1520.Pp 1521The 1522.Ev TERM 1523environment variable must be set to 1524.Dq screen 1525for all programs running 1526.Em inside 1527.Nm . 1528New windows will automatically have 1529.Dq TERM=screen 1530added to their environment, but care must be taken not to reset this in shell 1531start-up files. 1532.Pp 1533The 1534.Fl P 1535option prints information about the new window after it has been created. 1536By default, it uses the format 1537.Ql #{session_name}:#{window_index} 1538but a different format may be specified with 1539.Fl F . 1540.It Ic next-layout Op Fl t Ar target-window 1541.D1 (alias: Ic nextl ) 1542Move a window to the next layout and rearrange the panes to fit. 1543.It Xo Ic next-window 1544.Op Fl a 1545.Op Fl t Ar target-session 1546.Xc 1547.D1 (alias: Ic next ) 1548Move to the next window in the session. 1549If 1550.Fl a 1551is used, move to the next window with an alert. 1552.It Xo Ic pipe-pane 1553.Op Fl o 1554.Op Fl t Ar target-pane 1555.Op Ar shell-command 1556.Xc 1557.D1 (alias: Ic pipep ) 1558Pipe any output sent by the program in 1559.Ar target-pane 1560to a shell command. 1561A pane may only be piped to one command at a time, any existing pipe is 1562closed before 1563.Ar shell-command 1564is executed. 1565The 1566.Ar shell-command 1567string may contain the special character sequences supported by the 1568.Ic status-left 1569option. 1570If no 1571.Ar shell-command 1572is given, the current pipe (if any) is closed. 1573.Pp 1574The 1575.Fl o 1576option only opens a new pipe if no previous pipe exists, allowing a pipe to 1577be toggled with a single key, for example: 1578.Bd -literal -offset indent 1579bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P' 1580.Ed 1581.It Xo Ic previous-layout 1582.Op Fl t Ar target-window 1583.Xc 1584.D1 (alias: Ic prevl ) 1585Move to the previous layout in the session. 1586.It Xo Ic previous-window 1587.Op Fl a 1588.Op Fl t Ar target-session 1589.Xc 1590.D1 (alias: Ic prev ) 1591Move to the previous window in the session. 1592With 1593.Fl a , 1594move to the previous window with an alert. 1595.It Xo Ic rename-window 1596.Op Fl t Ar target-window 1597.Ar new-name 1598.Xc 1599.D1 (alias: Ic renamew ) 1600Rename the current window, or the window at 1601.Ar target-window 1602if specified, to 1603.Ar new-name . 1604.It Xo Ic resize-pane 1605.Op Fl DLRUZ 1606.Op Fl t Ar target-pane 1607.Op Fl x Ar width 1608.Op Fl y Ar height 1609.Op Ar adjustment 1610.Xc 1611.D1 (alias: Ic resizep ) 1612Resize a pane, up, down, left or right by 1613.Ar adjustment 1614with 1615.Fl U , 1616.Fl D , 1617.Fl L 1618or 1619.Fl R , 1620or 1621to an absolute size 1622with 1623.Fl x 1624or 1625.Fl y . 1626The 1627.Ar adjustment 1628is given in lines or cells (the default is 1). 1629.Pp 1630With 1631.Fl Z , 1632the active pane is toggled between zoomed (occupying the whole of the window) 1633and unzoomed (its normal position in the layout). 1634.It Xo Ic respawn-pane 1635.Op Fl k 1636.Op Fl t Ar target-pane 1637.Op Ar shell-command 1638.Xc 1639.D1 (alias: Ic respawnp ) 1640Reactivate a pane in which the command has exited (see the 1641.Ic remain-on-exit 1642window option). 1643If 1644.Ar shell-command 1645is not given, the command used when the pane was created is executed. 1646The pane must be already inactive, unless 1647.Fl k 1648is given, in which case any existing command is killed. 1649.It Xo Ic respawn-window 1650.Op Fl k 1651.Op Fl t Ar target-window 1652.Op Ar shell-command 1653.Xc 1654.D1 (alias: Ic respawnw ) 1655Reactivate a window in which the command has exited (see the 1656.Ic remain-on-exit 1657window option). 1658If 1659.Ar shell-command 1660is not given, the command used when the window was created is executed. 1661The window must be already inactive, unless 1662.Fl k 1663is given, in which case any existing command is killed. 1664.It Xo Ic rotate-window 1665.Op Fl DU 1666.Op Fl t Ar target-window 1667.Xc 1668.D1 (alias: Ic rotatew ) 1669Rotate the positions of the panes within a window, either upward (numerically 1670lower) with 1671.Fl U 1672or downward (numerically higher). 1673.It Xo Ic select-layout 1674.Op Fl np 1675.Op Fl t Ar target-window 1676.Op Ar layout-name 1677.Xc 1678.D1 (alias: Ic selectl ) 1679Choose a specific layout for a window. 1680If 1681.Ar layout-name 1682is not given, the last preset layout used (if any) is reapplied. 1683.Fl n 1684and 1685.Fl p 1686are equivalent to the 1687.Ic next-layout 1688and 1689.Ic previous-layout 1690commands. 1691.It Xo Ic select-pane 1692.Op Fl lDLRU 1693.Op Fl t Ar target-pane 1694.Xc 1695.D1 (alias: Ic selectp ) 1696Make pane 1697.Ar target-pane 1698the active pane in window 1699.Ar target-window . 1700If one of 1701.Fl D , 1702.Fl L , 1703.Fl R , 1704or 1705.Fl U 1706is used, respectively the pane below, to the left, to the right, or above the 1707target pane is used. 1708.Fl l 1709is the same as using the 1710.Ic last-pane 1711command. 1712.It Xo Ic select-window 1713.Op Fl lnpT 1714.Op Fl t Ar target-window 1715.Xc 1716.D1 (alias: Ic selectw ) 1717Select the window at 1718.Ar target-window . 1719.Fl l , 1720.Fl n 1721and 1722.Fl p 1723are equivalent to the 1724.Ic last-window , 1725.Ic next-window 1726and 1727.Ic previous-window 1728commands. 1729If 1730.Fl T 1731is given and the selected window is already the current window, 1732the command behaves like 1733.Ic last-window . 1734.It Xo Ic split-window 1735.Op Fl dhvP 1736.Op Fl c Ar start-directory 1737.Oo Fl l 1738.Ar size | 1739.Fl p Ar percentage Oc 1740.Op Fl t Ar target-pane 1741.Op Ar shell-command 1742.Op Fl F Ar format 1743.Xc 1744.D1 (alias: Ic splitw ) 1745Create a new pane by splitting 1746.Ar target-pane : 1747.Fl h 1748does a horizontal split and 1749.Fl v 1750a vertical split; if neither is specified, 1751.Fl v 1752is assumed. 1753The 1754.Fl l 1755and 1756.Fl p 1757options specify the size of the new pane in lines (for vertical split) or in 1758cells (for horizontal split), or as a percentage, respectively. 1759All other options have the same meaning as for the 1760.Ic new-window 1761command. 1762.It Xo Ic swap-pane 1763.Op Fl dDU 1764.Op Fl s Ar src-pane 1765.Op Fl t Ar dst-pane 1766.Xc 1767.D1 (alias: Ic swapp ) 1768Swap two panes. 1769If 1770.Fl U 1771is used and no source pane is specified with 1772.Fl s , 1773.Ar dst-pane 1774is swapped with the previous pane (before it numerically); 1775.Fl D 1776swaps with the next pane (after it numerically). 1777.Fl d 1778instructs 1779.Nm 1780not to change the active pane. 1781.It Xo Ic swap-window 1782.Op Fl d 1783.Op Fl s Ar src-window 1784.Op Fl t Ar dst-window 1785.Xc 1786.D1 (alias: Ic swapw ) 1787This is similar to 1788.Ic link-window , 1789except the source and destination windows are swapped. 1790It is an error if no window exists at 1791.Ar src-window . 1792.It Xo Ic unlink-window 1793.Op Fl k 1794.Op Fl t Ar target-window 1795.Xc 1796.D1 (alias: Ic unlinkw ) 1797Unlink 1798.Ar target-window . 1799Unless 1800.Fl k 1801is given, a window may be unlinked only if it is linked to multiple sessions - 1802windows may not be linked to no sessions; 1803if 1804.Fl k 1805is specified and the window is linked to only one session, it is unlinked and 1806destroyed. 1807.El 1808.Sh KEY BINDINGS 1809.Nm 1810allows a command to be bound to most keys, with or without a prefix key. 1811When specifying keys, most represent themselves (for example 1812.Ql A 1813to 1814.Ql Z ) . 1815Ctrl keys may be prefixed with 1816.Ql C- 1817or 1818.Ql ^ , 1819and Alt (meta) with 1820.Ql M- . 1821In addition, the following special key names are accepted: 1822.Em Up , 1823.Em Down , 1824.Em Left , 1825.Em Right , 1826.Em BSpace , 1827.Em BTab , 1828.Em DC 1829(Delete), 1830.Em End , 1831.Em Enter , 1832.Em Escape , 1833.Em F1 1834to 1835.Em F20 , 1836.Em Home , 1837.Em IC 1838(Insert), 1839.Em NPage/PageDown/PgDn , 1840.Em PPage/PageUp/PgUp , 1841.Em Space , 1842and 1843.Em Tab . 1844Note that to bind the 1845.Ql \&" 1846or 1847.Ql ' 1848keys, quotation marks are necessary, for example: 1849.Bd -literal -offset indent 1850bind-key '"' split-window 1851bind-key "'" new-window 1852.Ed 1853.Pp 1854Commands related to key bindings are as follows: 1855.Bl -tag -width Ds 1856.It Xo Ic bind-key 1857.Op Fl cnr 1858.Op Fl t Ar key-table 1859.Ar key Ar command Op Ar arguments 1860.Xc 1861.D1 (alias: Ic bind ) 1862Bind key 1863.Ar key 1864to 1865.Ar command . 1866By default (without 1867.Fl t ) 1868the primary key bindings are modified (those normally activated with the prefix 1869key); in this case, if 1870.Fl n 1871is specified, it is not necessary to use the prefix key, 1872.Ar command 1873is bound to 1874.Ar key 1875alone. 1876The 1877.Fl r 1878flag indicates this key may repeat, see the 1879.Ic repeat-time 1880option. 1881.Pp 1882If 1883.Fl t 1884is present, 1885.Ar key 1886is bound in 1887.Ar key-table : 1888the binding for command mode with 1889.Fl c 1890or for normal mode without. 1891To view the default bindings and possible commands, see the 1892.Ic list-keys 1893command. 1894.It Ic list-keys Op Fl t Ar key-table 1895.D1 (alias: Ic lsk ) 1896List all key bindings. 1897Without 1898.Fl t 1899the primary key bindings - those executed when preceded by the prefix key - 1900are printed. 1901.Pp 1902With 1903.Fl t , 1904the key bindings in 1905.Ar key-table 1906are listed; this may be one of: 1907.Em vi-edit , 1908.Em emacs-edit , 1909.Em vi-choice , 1910.Em emacs-choice , 1911.Em vi-copy 1912or 1913.Em emacs-copy . 1914.It Xo Ic send-keys 1915.Op Fl lR 1916.Op Fl t Ar target-pane 1917.Ar key Ar ... 1918.Xc 1919.D1 (alias: Ic send ) 1920Send a key or keys to a window. 1921Each argument 1922.Ar key 1923is the name of the key (such as 1924.Ql C-a 1925or 1926.Ql npage 1927) to send; if the string is not recognised as a key, it is sent as a series of 1928characters. 1929The 1930.Fl l 1931flag disables key name lookup and sends the keys literally. 1932All arguments are sent sequentially from first to last. 1933The 1934.Fl R 1935flag causes the terminal state to be reset. 1936.It Xo Ic send-prefix 1937.Op Fl 2 1938.Op Fl t Ar target-pane 1939.Xc 1940Send the prefix key, or with 1941.Fl 2 1942the secondary prefix key, to a window as if it was pressed. 1943.It Xo Ic unbind-key 1944.Op Fl acn 1945.Op Fl t Ar key-table 1946.Ar key 1947.Xc 1948.D1 (alias: Ic unbind ) 1949Unbind the command bound to 1950.Ar key . 1951Without 1952.Fl t 1953the primary key bindings are modified; in this case, if 1954.Fl n 1955is specified, the command bound to 1956.Ar key 1957without a prefix (if any) is removed. 1958If 1959.Fl a 1960is present, all key bindings are removed. 1961.Pp 1962If 1963.Fl t 1964is present, 1965.Ar key 1966in 1967.Ar key-table 1968is unbound: the binding for command mode with 1969.Fl c 1970or for normal mode without. 1971.El 1972.Sh OPTIONS 1973The appearance and behaviour of 1974.Nm 1975may be modified by changing the value of various options. 1976There are three types of option: 1977.Em server options , 1978.Em session options 1979and 1980.Em window options . 1981.Pp 1982The 1983.Nm 1984server has a set of global options which do not apply to any particular 1985window or session. 1986These are altered with the 1987.Ic set-option 1988.Fl s 1989command, or displayed with the 1990.Ic show-options 1991.Fl s 1992command. 1993.Pp 1994In addition, each individual session may have a set of session options, and 1995there is a separate set of global session options. 1996Sessions which do not have a particular option configured inherit the value 1997from the global session options. 1998Session options are set or unset with the 1999.Ic set-option 2000command and may be listed with the 2001.Ic show-options 2002command. 2003The available server and session options are listed under the 2004.Ic set-option 2005command. 2006.Pp 2007Similarly, a set of window options is attached to each window, and there is 2008a set of global window options from which any unset options are inherited. 2009Window options are altered with the 2010.Ic set-window-option 2011command and can be listed with the 2012.Ic show-window-options 2013command. 2014All window options are documented with the 2015.Ic set-window-option 2016command. 2017.Pp 2018.Nm 2019also supports user options which are prefixed with a 2020.Ql \&@ . 2021User options may have any name, so long as they are prefixed with 2022.Ql \&@ , 2023and be set to any string. 2024For example 2025.Bd -literal -offset indent 2026$ tmux setw -q @foo "abc123" 2027$ tmux showw -v @foo 2028abc123 2029.Ed 2030.Pp 2031Commands which set options are as follows: 2032.Bl -tag -width Ds 2033.It Xo Ic set-option 2034.Op Fl agoqsuw 2035.Op Fl t Ar target-session | Ar target-window 2036.Ar option Ar value 2037.Xc 2038.D1 (alias: Ic set ) 2039Set a window option with 2040.Fl w 2041(equivalent to the 2042.Ic set-window-option 2043command), 2044a server option with 2045.Fl s , 2046otherwise a session option. 2047.Pp 2048If 2049.Fl g 2050is specified, the global session or window option is set. 2051With 2052.Fl a , 2053and if the option expects a string, 2054.Ar value 2055is appended to the existing setting. 2056The 2057.Fl u 2058flag unsets an option, so a session inherits the option from the global 2059options. 2060It is not possible to unset a global option. 2061.Pp 2062The 2063.Fl o 2064flag prevents setting an option that is already set. 2065.Pp 2066The 2067.Fl q 2068flag suppresses the informational message (as if the 2069.Ic quiet 2070server option was set). 2071.Pp 2072Available window options are listed under 2073.Ic set-window-option . 2074.Pp 2075.Ar value 2076depends on the option and may be a number, a string, or a flag (on, off, or 2077omitted to toggle). 2078.Pp 2079Available server options are: 2080.Bl -tag -width Ds 2081.It Ic buffer-limit Ar number 2082Set the number of buffers; as new buffers are added to the top of the stack, 2083old ones are removed from the bottom if necessary to maintain this maximum 2084length. 2085.It Ic escape-time Ar time 2086Set the time in milliseconds for which 2087.Nm 2088waits after an escape is input to determine if it is part of a function or meta 2089key sequences. 2090The default is 500 milliseconds. 2091.It Xo Ic exit-unattached 2092.Op Ic on | off 2093.Xc 2094If enabled, the server will exit when there are no attached clients. 2095.It Xo Ic quiet 2096.Op Ic on | off 2097.Xc 2098Enable or disable the display of various informational messages (see also the 2099.Fl q 2100command line flag). 2101.It Xo Ic set-clipboard 2102.Op Ic on | off 2103.Xc 2104Attempt to set the terminal clipboard content using the 2105\ee]52;...\e007 2106.Xr xterm 1 2107escape sequences. 2108This option is on by default if there is an 2109.Em \&Ms 2110entry in the 2111.Xr terminfo 5 2112description for the client terminal. 2113Note that this feature needs to be enabled in 2114.Xr xterm 1 2115by setting the resource: 2116.Bd -literal -offset indent 2117disallowedWindowOps: 20,21,SetXprop 2118.Ed 2119.Pp 2120Or changing this property from the 2121.Xr xterm 1 2122interactive menu when required. 2123.El 2124.Pp 2125Available session options are: 2126.Bl -tag -width Ds 2127.It Ic assume-paste-time Ar milliseconds 2128If keys are entered faster than one in 2129.Ar milliseconds , 2130they are assumed to have been pasted rather than typed and 2131.Nm 2132key bindings are not processed. 2133The default is one millisecond and zero disables. 2134.It Ic base-index Ar index 2135Set the base index from which an unused index should be searched when a new 2136window is created. 2137The default is zero. 2138.It Xo Ic bell-action 2139.Op Ic any | none | current 2140.Xc 2141Set action on window bell. 2142.Ic any 2143means a bell in any window linked to a session causes a bell in the current 2144window of that session, 2145.Ic none 2146means all bells are ignored and 2147.Ic current 2148means only bells in windows other than the current window are ignored. 2149.It Xo Ic bell-on-alert 2150.Op Ic on | off 2151.Xc 2152If on, ring the terminal bell when an alert 2153occurs. 2154.It Ic default-command Ar shell-command 2155Set the command used for new windows (if not specified when the window is 2156created) to 2157.Ar shell-command , 2158which may be any 2159.Xr sh 1 2160command. 2161The default is an empty string, which instructs 2162.Nm 2163to create a login shell using the value of the 2164.Ic default-shell 2165option. 2166.It Ic default-path Ar path 2167Set the default working directory for new panes. 2168If empty (the default), the working directory is determined from the process 2169running in the active pane, from the command line environment or from the 2170working directory where the session was created. 2171Otherwise the same options are available as for the 2172.Fl c 2173flag to 2174.Ic new-window . 2175.It Ic default-shell Ar path 2176Specify the default shell. 2177This is used as the login shell for new windows when the 2178.Ic default-command 2179option is set to empty, and must be the full path of the executable. 2180When started 2181.Nm 2182tries to set a default value from the first suitable of the 2183.Ev SHELL 2184environment variable, the shell returned by 2185.Xr getpwuid 3 , 2186or 2187.Pa /bin/sh . 2188This option should be configured when 2189.Nm 2190is used as a login shell. 2191.It Ic default-terminal Ar terminal 2192Set the default terminal for new windows created in this session - the 2193default value of the 2194.Ev TERM 2195environment variable. 2196For 2197.Nm 2198to work correctly, this 2199.Em must 2200be set to 2201.Ql screen 2202or a derivative of it. 2203.It Xo Ic destroy-unattached 2204.Op Ic on | off 2205.Xc 2206If enabled and the session is no longer attached to any clients, it is 2207destroyed. 2208.It Xo Ic detach-on-destroy 2209.Op Ic on | off 2210.Xc 2211If on (the default), the client is detached when the session it is attached to 2212is destroyed. 2213If off, the client is switched to the most recently active of the remaining 2214sessions. 2215.It Ic display-panes-active-colour Ar colour 2216Set the colour used by the 2217.Ic display-panes 2218command to show the indicator for the active pane. 2219.It Ic display-panes-colour Ar colour 2220Set the colour used by the 2221.Ic display-panes 2222command to show the indicators for inactive panes. 2223.It Ic display-panes-time Ar time 2224Set the time in milliseconds for which the indicators shown by the 2225.Ic display-panes 2226command appear. 2227.It Ic display-time Ar time 2228Set the amount of time for which status line messages and other on-screen 2229indicators are displayed. 2230.Ar time 2231is in milliseconds. 2232.It Ic history-limit Ar lines 2233Set the maximum number of lines held in window history. 2234This setting applies only to new windows - existing window histories are not 2235resized and retain the limit at the point they were created. 2236.It Ic lock-after-time Ar number 2237Lock the session (like the 2238.Ic lock-session 2239command) after 2240.Ar number 2241seconds of inactivity, or the entire server (all sessions) if the 2242.Ic lock-server 2243option is set. 2244The default is not to lock (set to 0). 2245.It Ic lock-command Ar shell-command 2246Command to run when locking each client. 2247The default is to run 2248.Xr lock 1 2249with 2250.Fl np . 2251.It Xo Ic lock-server 2252.Op Ic on | off 2253.Xc 2254If this option is 2255.Ic on 2256(the default), 2257instead of each session locking individually as each has been 2258idle for 2259.Ic lock-after-time , 2260the entire server will lock after 2261.Em all 2262sessions would have locked. 2263This has no effect as a session option; it must be set as a global option. 2264.It Ic message-attr Ar attributes 2265Set status line message attributes, where 2266.Ar attributes 2267is either 2268.Ic none 2269or a comma-delimited list of one or more of: 2270.Ic bright 2271(or 2272.Ic bold ) , 2273.Ic dim , 2274.Ic underscore , 2275.Ic blink , 2276.Ic reverse , 2277.Ic hidden , 2278or 2279.Ic italics . 2280.It Ic message-bg Ar colour 2281Set status line message background colour, where 2282.Ar colour 2283is one of: 2284.Ic black , 2285.Ic red , 2286.Ic green , 2287.Ic yellow , 2288.Ic blue , 2289.Ic magenta , 2290.Ic cyan , 2291.Ic white , 2292aixterm bright variants (if supported: 2293.Ic brightred , 2294.Ic brightgreen , 2295and so on), 2296.Ic colour0 2297to 2298.Ic colour255 2299from the 256-colour set, 2300.Ic default , 2301or a hexadecimal RGB string such as 2302.Ql #ffffff , 2303which chooses the closest match from the default 256-colour set. 2304.It Ic message-command-attr Ar attributes 2305Set status line message attributes when in command mode. 2306.It Ic message-command-bg Ar colour 2307Set status line message background colour when in command mode. 2308.It Ic message-command-fg Ar colour 2309Set status line message foreground colour when in command mode. 2310.It Ic message-fg Ar colour 2311Set status line message foreground colour. 2312.It Ic message-limit Ar number 2313Set the number of error or information messages to save in the message log for 2314each client. 2315The default is 20. 2316.It Xo Ic mouse-resize-pane 2317.Op Ic on | off 2318.Xc 2319If on, 2320.Nm 2321captures the mouse and allows panes to be resized by dragging on their borders. 2322.It Xo Ic mouse-select-pane 2323.Op Ic on | off 2324.Xc 2325If on, 2326.Nm 2327captures the mouse and when a window is split into multiple panes the mouse may 2328be used to select the current pane. 2329The mouse click is also passed through to the application as normal. 2330.It Xo Ic mouse-select-window 2331.Op Ic on | off 2332.Xc 2333If on, clicking the mouse on a window name in the status line will select that 2334window. 2335.It Xo Ic mouse-utf8 2336.Op Ic on | off 2337.Xc 2338If enabled, request mouse input as UTF-8 on UTF-8 terminals. 2339.It Ic pane-active-border-bg Ar colour 2340.It Ic pane-active-border-fg Ar colour 2341Set the pane border colour for the currently active pane. 2342.It Ic pane-border-bg Ar colour 2343.It Ic pane-border-fg Ar colour 2344Set the pane border colour for panes aside from the active pane. 2345.It Ic prefix Ar key 2346Set the key accepted as a prefix key. 2347.It Ic prefix2 Ar key 2348Set a secondary key accepted as a prefix key. 2349.It Xo Ic renumber-windows 2350.Op Ic on | off 2351.Xc 2352If on, when a window is closed in a session, automatically renumber the other 2353windows in numerical order. 2354This respects the 2355.Ic base-index 2356option if it has been set. 2357If off, do not renumber the windows. 2358.It Ic repeat-time Ar time 2359Allow multiple commands to be entered without pressing the prefix-key again 2360in the specified 2361.Ar time 2362milliseconds (the default is 500). 2363Whether a key repeats may be set when it is bound using the 2364.Fl r 2365flag to 2366.Ic bind-key . 2367Repeat is enabled for the default keys bound to the 2368.Ic resize-pane 2369command. 2370.It Xo Ic set-remain-on-exit 2371.Op Ic on | off 2372.Xc 2373Set the 2374.Ic remain-on-exit 2375window option for any windows first created in this session. 2376When this option is true, windows in which the running program has 2377exited do not close, instead remaining open but inactivate. 2378Use the 2379.Ic respawn-window 2380command to reactivate such a window, or the 2381.Ic kill-window 2382command to destroy it. 2383.It Xo Ic set-titles 2384.Op Ic on | off 2385.Xc 2386Attempt to set the client terminal title using the 2387.Em tsl 2388and 2389.Em fsl 2390.Xr terminfo 5 2391entries if they exist. 2392.Nm 2393automatically sets these to the \ee]2;...\e007 sequence if 2394the terminal appears to be an xterm. 2395This option is off by default. 2396Note that elinks 2397will only attempt to set the window title if the STY environment 2398variable is set. 2399.It Ic set-titles-string Ar string 2400String used to set the window title if 2401.Ic set-titles 2402is on. 2403Character sequences are replaced as for the 2404.Ic status-left 2405option. 2406.It Xo Ic status 2407.Op Ic on | off 2408.Xc 2409Show or hide the status line. 2410.It Ic status-attr Ar attributes 2411Set status line attributes. 2412.It Ic status-bg Ar colour 2413Set status line background colour. 2414.It Ic status-fg Ar colour 2415Set status line foreground colour. 2416.It Ic status-interval Ar interval 2417Update the status bar every 2418.Ar interval 2419seconds. 2420By default, updates will occur every 15 seconds. 2421A setting of zero disables redrawing at interval. 2422.It Xo Ic status-justify 2423.Op Ic left | centre | right 2424.Xc 2425Set the position of the window list component of the status line: left, centre 2426or right justified. 2427.It Xo Ic status-keys 2428.Op Ic vi | emacs 2429.Xc 2430Use vi or emacs-style 2431key bindings in the status line, for example at the command prompt. 2432The default is emacs, unless the 2433.Ev VISUAL 2434or 2435.Ev EDITOR 2436environment variables are set and contain the string 2437.Ql vi . 2438.It Ic status-left Ar string 2439Display 2440.Ar string 2441(by default the session name) to the left of the status bar. 2442.Ar string 2443will be passed through 2444.Xr strftime 3 2445and formats (see 2446.Sx FORMATS Ns ) 2447will be expanded. 2448It may also contain any of the following special character sequences: 2449.Bl -column "Character pair" "Replaced with" -offset indent 2450.It Sy "Character pair" Ta Sy "Replaced with" 2451.It Li "#(shell-command)" Ta "First line of the command's output" 2452.It Li "#[attributes]" Ta "Colour or attribute change" 2453.It Li "##" Ta "A literal" Ql # 2454.El 2455.Pp 2456The #(shell-command) form executes 2457.Ql shell-command 2458and inserts the first line of its output. 2459Note that shell commands are only executed once at the interval specified by 2460the 2461.Ic status-interval 2462option: if the status line is redrawn in the meantime, the previous result is 2463used. 2464Shell commands are executed with the 2465.Nm 2466global environment set (see the 2467.Sx ENVIRONMENT 2468section). 2469.Pp 2470For details on how the names and titles can be set see the 2471.Sx "NAMES AND TITLES" 2472section. 2473.Pp 2474#[attributes] allows a comma-separated list of attributes to be specified, 2475these may be 2476.Ql fg=colour 2477to set the foreground colour, 2478.Ql bg=colour 2479to set the background colour, the name of one of the attributes (listed under 2480the 2481.Ic message-attr 2482option) to turn an attribute on, or an attribute prefixed with 2483.Ql no 2484to turn one off, for example 2485.Ic nobright . 2486Examples are: 2487.Bd -literal -offset indent 2488#(sysctl vm.loadavg) 2489#[fg=yellow,bold]#(apm -l)%%#[default] [#S] 2490.Ed 2491.Pp 2492Where appropriate, special character sequences may be prefixed with a number to 2493specify the maximum length, for example 2494.Ql #24T . 2495.Pp 2496By default, UTF-8 in 2497.Ar string 2498is not interpreted, to enable UTF-8, use the 2499.Ic status-utf8 2500option. 2501.It Ic status-left-attr Ar attributes 2502Set the attribute of the left part of the status line. 2503.It Ic status-left-bg Ar colour 2504Set the background colour of the left part of the status line. 2505.It Ic status-left-fg Ar colour 2506Set the foreground colour of the left part of the status line. 2507.It Ic status-left-length Ar length 2508Set the maximum 2509.Ar length 2510of the left component of the status bar. 2511The default is 10. 2512.It Xo Ic status-position 2513.Op Ic top | bottom 2514.Xc 2515Set the position of the status line. 2516.It Ic status-right Ar string 2517Display 2518.Ar string 2519to the right of the status bar. 2520By default, the current window title in double quotes, the date and the time 2521are shown. 2522As with 2523.Ic status-left , 2524.Ar string 2525will be passed to 2526.Xr strftime 3 , 2527character pairs are replaced, and UTF-8 is dependent on the 2528.Ic status-utf8 2529option. 2530.It Ic status-right-attr Ar attributes 2531Set the attribute of the right part of the status line. 2532.It Ic status-right-bg Ar colour 2533Set the background colour of the right part of the status line. 2534.It Ic status-right-fg Ar colour 2535Set the foreground colour of the right part of the status line. 2536.It Ic status-right-length Ar length 2537Set the maximum 2538.Ar length 2539of the right component of the status bar. 2540The default is 40. 2541.It Xo Ic status-utf8 2542.Op Ic on | off 2543.Xc 2544Instruct 2545.Nm 2546to treat top-bit-set characters in the 2547.Ic status-left 2548and 2549.Ic status-right 2550strings as UTF-8; notably, this is important for wide characters. 2551This option defaults to off. 2552.It Ic terminal-overrides Ar string 2553Contains a list of entries which override terminal descriptions read using 2554.Xr terminfo 5 . 2555.Ar string 2556is a comma-separated list of items each a colon-separated string made up of a 2557terminal type pattern (matched using 2558.Xr fnmatch 3 ) 2559and a set of 2560.Em name=value 2561entries. 2562.Pp 2563For example, to set the 2564.Ql clear 2565.Xr terminfo 5 2566entry to 2567.Ql \ee[H\ee[2J 2568for all terminal types and the 2569.Ql dch1 2570entry to 2571.Ql \ee[P 2572for the 2573.Ql rxvt 2574terminal type, the option could be set to the string: 2575.Bd -literal -offset indent 2576"*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P" 2577.Ed 2578.Pp 2579The terminal entry value is passed through 2580.Xr strunvis 3 2581before interpretation. 2582The default value forcibly corrects the 2583.Ql colors 2584entry for terminals which support 88 or 256 colours: 2585.Bd -literal -offset indent 2586"*88col*:colors=88,*256col*:colors=256,xterm*:XT" 2587.Ed 2588.It Ic update-environment Ar variables 2589Set a space-separated string containing a list of environment variables to be 2590copied into the session environment when a new session is created or an 2591existing session is attached. 2592Any variables that do not exist in the source environment are set to be 2593removed from the session environment (as if 2594.Fl r 2595was given to the 2596.Ic set-environment 2597command). 2598The default is 2599"DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID 2600XAUTHORITY". 2601.It Xo Ic visual-activity 2602.Op Ic on | off 2603.Xc 2604If on, display a status line message when activity occurs in a window 2605for which the 2606.Ic monitor-activity 2607window option is enabled. 2608.It Xo Ic visual-bell 2609.Op Ic on | off 2610.Xc 2611If this option is on, a message is shown on a bell instead of it being passed 2612through to the terminal (which normally makes a sound). 2613Also see the 2614.Ic bell-action 2615option. 2616.It Xo Ic visual-content 2617.Op Ic on | off 2618.Xc 2619Like 2620.Ic visual-activity , 2621display a message when content is present in a window 2622for which the 2623.Ic monitor-content 2624window option is enabled. 2625.It Xo Ic visual-silence 2626.Op Ic on | off 2627.Xc 2628If 2629.Ic monitor-silence 2630is enabled, prints a message after the interval has expired on a given window. 2631.It Ic word-separators Ar string 2632Sets the session's conception of what characters are considered word 2633separators, for the purposes of the next and previous word commands in 2634copy mode. 2635The default is 2636.Ql \ -_@ . 2637.El 2638.It Xo Ic set-window-option 2639.Op Fl agoqu 2640.Op Fl t Ar target-window 2641.Ar option Ar value 2642.Xc 2643.D1 (alias: Ic setw ) 2644Set a window option. 2645The 2646.Fl a , 2647.Fl g , 2648.Fl o , 2649.Fl q 2650and 2651.Fl u 2652flags work similarly to the 2653.Ic set-option 2654command. 2655.Pp 2656Supported window options are: 2657.Pp 2658.Bl -tag -width Ds -compact 2659.It Xo Ic aggressive-resize 2660.Op Ic on | off 2661.Xc 2662Aggressively resize the chosen window. 2663This means that 2664.Nm 2665will resize the window to the size of the smallest session for which it is the 2666current window, rather than the smallest session to which it is attached. 2667The window may resize when the current window is changed on another sessions; 2668this option is good for full-screen programs which support 2669.Dv SIGWINCH 2670and poor for interactive programs such as shells. 2671.Pp 2672.It Xo Ic allow-rename 2673.Op Ic on | off 2674.Xc 2675Allow programs to change the window name using a terminal escape 2676sequence (\\033k...\\033\\\\). 2677The default is on. 2678.Pp 2679.It Xo Ic alternate-screen 2680.Op Ic on | off 2681.Xc 2682This option configures whether programs running inside 2683.Nm 2684may use the terminal alternate screen feature, which allows the 2685.Em smcup 2686and 2687.Em rmcup 2688.Xr terminfo 5 2689capabilities. 2690The alternate screen feature preserves the contents of the window when an 2691interactive application starts and restores it on exit, so that any output 2692visible before the application starts reappears unchanged after it exits. 2693The default is on. 2694.Pp 2695.It Xo Ic automatic-rename 2696.Op Ic on | off 2697.Xc 2698Control automatic window renaming. 2699When this setting is enabled, 2700.Nm 2701will attempt - on supported platforms - to rename the window to reflect the 2702command currently running in it. 2703This flag is automatically disabled for an individual window when a name 2704is specified at creation with 2705.Ic new-window 2706or 2707.Ic new-session , 2708or later with 2709.Ic rename-window , 2710or with a terminal escape sequence. 2711It may be switched off globally with: 2712.Bd -literal -offset indent 2713set-window-option -g automatic-rename off 2714.Ed 2715.Pp 2716.It Ic c0-change-interval Ar interval 2717.It Ic c0-change-trigger Ar trigger 2718These two options configure a simple form of rate limiting for a pane. 2719If 2720.Nm 2721sees more than 2722.Ar trigger 2723C0 sequences that modify the screen (for example, carriage returns, linefeeds 2724or backspaces) in one millisecond, it will stop updating the pane immediately and 2725instead redraw it entirely every 2726.Ar interval 2727milliseconds. 2728This helps to prevent fast output (such as 2729.Xr yes 1 2730overwhelming the terminal). 2731The default is a trigger of 250 and an interval of 100. 2732A trigger of zero disables the rate limiting. 2733.Pp 2734.It Ic clock-mode-colour Ar colour 2735Set clock colour. 2736.Pp 2737.It Xo Ic clock-mode-style 2738.Op Ic 12 | 24 2739.Xc 2740Set clock hour format. 2741.Pp 2742.It Ic force-height Ar height 2743.It Ic force-width Ar width 2744Prevent 2745.Nm 2746from resizing a window to greater than 2747.Ar width 2748or 2749.Ar height . 2750A value of zero restores the default unlimited setting. 2751.Pp 2752.It Ic main-pane-height Ar height 2753.It Ic main-pane-width Ar width 2754Set the width or height of the main (left or top) pane in the 2755.Ic main-horizontal 2756or 2757.Ic main-vertical 2758layouts. 2759.Pp 2760.It Ic mode-attr Ar attributes 2761Set window modes attributes. 2762.Pp 2763.It Ic mode-bg Ar colour 2764Set window modes background colour. 2765.Pp 2766.It Ic mode-fg Ar colour 2767Set window modes foreground colour. 2768.Pp 2769.It Xo Ic mode-keys 2770.Op Ic vi | emacs 2771.Xc 2772Use vi or emacs-style key bindings in copy and choice modes. 2773As with the 2774.Ic status-keys 2775option, the default is emacs, unless 2776.Ev VISUAL 2777or 2778.Ev EDITOR 2779contains 2780.Ql vi . 2781.Pp 2782.It Xo Ic mode-mouse 2783.Op Ic on | off | copy-mode 2784.Xc 2785Mouse state in modes. 2786If on, the mouse may be used to enter copy mode and copy a selection by 2787dragging, to enter copy mode and scroll with the mouse wheel, or to select an 2788option in choice mode. 2789If set to 2790.Em copy-mode , 2791the mouse behaves as set to on, but cannot be used to enter copy 2792mode. 2793.Pp 2794.It Xo Ic monitor-activity 2795.Op Ic on | off 2796.Xc 2797Monitor for activity in the window. 2798Windows with activity are highlighted in the status line. 2799.Pp 2800.It Ic monitor-content Ar match-string 2801Monitor content in the window. 2802When 2803.Xr fnmatch 3 2804pattern 2805.Ar match-string 2806appears in the window, it is highlighted in the status line. 2807.Pp 2808.It Xo Ic monitor-silence 2809.Op Ic interval 2810.Xc 2811Monitor for silence (no activity) in the window within 2812.Ic interval 2813seconds. 2814Windows that have been silent for the interval are highlighted in the 2815status line. 2816An interval of zero disables the monitoring. 2817.Pp 2818.It Ic other-pane-height Ar height 2819Set the height of the other panes (not the main pane) in the 2820.Ic main-horizontal 2821layout. 2822If this option is set to 0 (the default), it will have no effect. 2823If both the 2824.Ic main-pane-height 2825and 2826.Ic other-pane-height 2827options are set, the main pane will grow taller to make the other panes the 2828specified height, but will never shrink to do so. 2829.Pp 2830.It Ic other-pane-width Ar width 2831Like 2832.Ic other-pane-height , 2833but set the width of other panes in the 2834.Ic main-vertical 2835layout. 2836.Pp 2837.It Ic pane-base-index Ar index 2838Like 2839.Ic base-index , 2840but set the starting index for pane numbers. 2841.Pp 2842.It Xo Ic remain-on-exit 2843.Op Ic on | off 2844.Xc 2845A window with this flag set is not destroyed when the program running in it 2846exits. 2847The window may be reactivated with the 2848.Ic respawn-window 2849command. 2850.Pp 2851.It Xo Ic synchronize-panes 2852.Op Ic on | off 2853.Xc 2854Duplicate input to any pane to all other panes in the same window (only 2855for panes that are not in any special mode). 2856.Pp 2857.It Xo Ic utf8 2858.Op Ic on | off 2859.Xc 2860Instructs 2861.Nm 2862to expect UTF-8 sequences to appear in this window. 2863.Pp 2864.It Ic window-status-bell-attr Ar attributes 2865Set status line attributes for windows which have a bell alert. 2866.Pp 2867.It Ic window-status-bell-bg Ar colour 2868Set status line background colour for windows with a bell alert. 2869.Pp 2870.It Ic window-status-bell-fg Ar colour 2871Set status line foreground colour for windows with a bell alert. 2872.Pp 2873.It Ic window-status-content-attr Ar attributes 2874Set status line attributes for windows which have a content alert. 2875.Pp 2876.It Ic window-status-content-bg Ar colour 2877Set status line background colour for windows with a content alert. 2878.Pp 2879.It Ic window-status-content-fg Ar colour 2880Set status line foreground colour for windows with a content alert. 2881.Pp 2882.It Ic window-status-activity-attr Ar attributes 2883Set status line attributes for windows which have an activity (or silence) alert. 2884.Pp 2885.It Ic window-status-activity-bg Ar colour 2886Set status line background colour for windows with an activity alert. 2887.Pp 2888.It Ic window-status-activity-fg Ar colour 2889Set status line foreground colour for windows with an activity alert. 2890.Pp 2891.It Ic window-status-attr Ar attributes 2892Set status line attributes for a single window. 2893.Pp 2894.It Ic window-status-bg Ar colour 2895Set status line background colour for a single window. 2896.Pp 2897.It Ic window-status-current-attr Ar attributes 2898Set status line attributes for the currently active window. 2899.Pp 2900.It Ic window-status-current-bg Ar colour 2901Set status line background colour for the currently active window. 2902.Pp 2903.It Ic window-status-current-fg Ar colour 2904Set status line foreground colour for the currently active window. 2905.Pp 2906.It Ic window-status-current-format Ar string 2907Like 2908.Ar window-status-format , 2909but is the format used when the window is the current window. 2910.Pp 2911.It Ic window-status-last-attr Ar attributes 2912Set status line attributes for the last active window. 2913.Pp 2914.It Ic window-status-last-bg Ar colour 2915Set status line background colour for the last active window. 2916.Pp 2917.It Ic window-status-last-fg Ar colour 2918Set status line foreground colour for the last active window. 2919.Pp 2920.It Ic window-status-fg Ar colour 2921Set status line foreground colour for a single window. 2922.Pp 2923.It Ic window-status-format Ar string 2924Set the format in which the window is displayed in the status line window list. 2925See the 2926.Ar status-left 2927option for details of special character sequences available. 2928The default is 2929.Ql #I:#W#F . 2930.Pp 2931.It Ic window-status-separator Ar string 2932Sets the separator drawn between windows in the status line. 2933The default is a single space character. 2934.Pp 2935.It Xo Ic xterm-keys 2936.Op Ic on | off 2937.Xc 2938If this option is set, 2939.Nm 2940will generate 2941.Xr xterm 1 -style 2942function key sequences; these have a number included to indicate modifiers such 2943as Shift, Alt or Ctrl. 2944The default is off. 2945.Pp 2946.It Xo Ic wrap-search 2947.Op Ic on | off 2948.Xc 2949If this option is set, searches will wrap around the end of the pane contents. 2950The default is on. 2951.El 2952.It Xo Ic show-options 2953.Op Fl gqsvw 2954.Op Fl t Ar target-session | Ar target-window 2955.Op Ar option 2956.Xc 2957.D1 (alias: Ic show ) 2958Show the window options (or a single window option if given) with 2959.Fl w 2960(equivalent to 2961.Ic show-window-options ) , 2962the server options with 2963.Fl s , 2964otherwise the session options for 2965.Ar target session . 2966Global session or window options are listed if 2967.Fl g 2968is used. 2969.Fl v 2970shows only the option value, not the name. 2971If 2972.Fl q 2973is set, no error will be returned if 2974.Ar option 2975is unset. 2976.It Xo Ic show-window-options 2977.Op Fl gv 2978.Op Fl t Ar target-window 2979.Op Ar option 2980.Xc 2981.D1 (alias: Ic showw ) 2982List the window options or a single option for 2983.Ar target-window , 2984or the global window options if 2985.Fl g 2986is used. 2987.Fl v 2988shows only the option value, not the name. 2989.El 2990.Sh FORMATS 2991Certain commands accept the 2992.Fl F 2993flag with a 2994.Ar format 2995argument. 2996This is a string which controls the output format of the command. 2997Replacement variables are enclosed in 2998.Ql #{ 2999and 3000.Ql } , 3001for example 3002.Ql #{session_name} . 3003Some variables also have an shorter alias such as 3004.Ql #S . 3005Conditionals are also accepted by prefixing with 3006.Ql \&? 3007and separating two alternatives with a comma; 3008if the specified variable exists and is not zero, the first alternative 3009is chosen, otherwise the second is used. 3010For example 3011.Ql #{?session_attached,attached,not attached} 3012will include the string 3013.Ql attached 3014if the session is attached and the string 3015.Ql not attached 3016if it is unattached. 3017.Pp 3018The following variables are available, where appropriate: 3019.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX" 3020.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with" 3021.It Li "alternate_on" Ta "" Ta "If pane is in alternate screen" 3022.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen" 3023.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen" 3024.It Li "buffer_sample" Ta "" Ta "First 50 characters from buffer" 3025.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes" 3026.It Li "client_activity" Ta "" Ta "Integer time client last had activity" 3027.It Li "client_activity_string" Ta "" Ta "String time client last had activity" 3028.It Li "client_created" Ta "" Ta "Integer time client created" 3029.It Li "client_created_string" Ta "" Ta "String time client created" 3030.It Li "client_cwd" Ta "" Ta "Working directory of client" 3031.It Li "client_height" Ta "" Ta "Height of client" 3032.It Li "client_last_session" Ta "" Ta "Name of the client's last session" 3033.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed" 3034.It Li "client_readonly" Ta "" Ta "1 if client is readonly" 3035.It Li "client_session" Ta "" Ta "Name of the client's session" 3036.It Li "client_termname" Ta "" Ta "Terminal name of client" 3037.It Li "client_tty" Ta "" Ta "Pseudo terminal of client" 3038.It Li "client_utf8" Ta "" Ta "1 if client supports utf8" 3039.It Li "client_width" Ta "" Ta "Width of client" 3040.It Li "cursor_flag" Ta "" Ta "Pane cursor flag" 3041.It Li "cursor_x" Ta "" Ta "Cursor X position in pane" 3042.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane" 3043.It Li "history_bytes" Ta "" Ta "Number of bytes in window history" 3044.It Li "history_limit" Ta "" Ta "Maximum window history lines" 3045.It Li "history_size" Ta "" Ta "Size of history in bytes" 3046.It Li "host" Ta "#H" Ta "Hostname of local host" 3047.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)" 3048.It Li "insert_flag" Ta "" Ta "Pane insert flag" 3049.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag" 3050.It Li "keypad_flag" Ta "" Ta "Pane keypad flag" 3051.It Li "line" Ta "" Ta "Line number in the list" 3052.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag" 3053.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag" 3054.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag" 3055.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" 3056.It Li "pane_active" Ta "" Ta "1 if active pane" 3057.It Li "pane_current_command" Ta "" Ta "Current command if available" 3058.It Li "pane_current_path" Ta "" Ta "Current path if available" 3059.It Li "pane_dead" Ta "" Ta "1 if pane is dead" 3060.It Li "pane_height" Ta "" Ta "Height of pane" 3061.It Li "pane_id" Ta "#D" Ta "Unique pane ID" 3062.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode" 3063.It Li "pane_index" Ta "#P" Ta "Index of pane" 3064.It Li "pane_pid" Ta "" Ta "PID of first process in pane" 3065.It Li "pane_start_command" Ta "" Ta "Command pane started with" 3066.It Li "pane_start_path" Ta "" Ta "Path pane started with" 3067.It Li "pane_tabs" Ta "" Ta "Pane tab positions" 3068.It Li "pane_title" Ta "#T" Ta "Title of pane" 3069.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" 3070.It Li "pane_width" Ta "" Ta "Width of pane" 3071.It Li "saved_cursor_x" Ta "" Ta "Saved cursor X in pane" 3072.It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane" 3073.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane" 3074.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane" 3075.It Li "session_attached" Ta "" Ta "1 if session attached" 3076.It Li "session_created" Ta "" Ta "Integer time session created" 3077.It Li "session_created_string" Ta "" Ta "String time session created" 3078.It Li "session_group" Ta "" Ta "Number of session group" 3079.It Li "session_grouped" Ta "" Ta "1 if session in a group" 3080.It Li "session_height" Ta "" Ta "Height of session" 3081.It Li "session_id" Ta "" Ta "Unique session ID" 3082.It Li "session_name" Ta "#S" Ta "Name of session" 3083.It Li "session_width" Ta "" Ta "Width of session" 3084.It Li "session_windows" Ta "" Ta "Number of windows in session" 3085.It Li "window_active" Ta "" Ta "1 if window active" 3086.It Li "window_find_matches" Ta "" Ta "Matched data from the find-window" 3087.It Li "window_flags" Ta "#F" Ta "Window flags" 3088.It Li "window_height" Ta "" Ta "Height of window" 3089.It Li "window_id" Ta "" Ta "Unique window ID" 3090.It Li "window_index" Ta "#I" Ta "Index of window" 3091.It Li "window_layout" Ta "" Ta "Window layout description" 3092.It Li "window_name" Ta "#W" Ta "Name of window" 3093.It Li "window_panes" Ta "" Ta "Number of panes in window" 3094.It Li "window_width" Ta "" Ta "Width of window" 3095.It Li "wrap_flag" Ta "" Ta "Pane wrap flag" 3096.El 3097.Sh NAMES AND TITLES 3098.Nm 3099distinguishes between names and titles. 3100Windows and sessions have names, which may be used to specify them in targets 3101and are displayed in the status line and various lists: the name is the 3102.Nm 3103identifier for a window or session. 3104Only panes have titles. 3105A pane's title is typically set by the program running inside the pane and 3106is not modified by 3107.Nm . 3108It is the same mechanism used to set for example the 3109.Xr xterm 1 3110window title in an 3111.Xr X 7 3112window manager. 3113Windows themselves do not have titles - a window's title is the title of its 3114active pane. 3115.Nm 3116itself may set the title of the terminal in which the client is running, see 3117the 3118.Ic set-titles 3119option. 3120.Pp 3121A session's name is set with the 3122.Ic new-session 3123and 3124.Ic rename-session 3125commands. 3126A window's name is set with one of: 3127.Bl -enum -width Ds 3128.It 3129A command argument (such as 3130.Fl n 3131for 3132.Ic new-window 3133or 3134.Ic new-session ) . 3135.It 3136An escape sequence: 3137.Bd -literal -offset indent 3138$ printf '\e033kWINDOW_NAME\e033\e\e' 3139.Ed 3140.It 3141Automatic renaming, which sets the name to the active command in the window's 3142active pane. 3143See the 3144.Ic automatic-rename 3145option. 3146.El 3147.Pp 3148When a pane is first created, its title is the hostname. 3149A pane's title can be set via the OSC title setting sequence, for example: 3150.Bd -literal -offset indent 3151$ printf '\e033]2;My Title\e033\e\e' 3152.Ed 3153.Sh ENVIRONMENT 3154When the server is started, 3155.Nm 3156copies the environment into the 3157.Em global environment ; 3158in addition, each session has a 3159.Em session environment . 3160When a window is created, the session and global environments are merged. 3161If a variable exists in both, the value from the session environment is used. 3162The result is the initial environment passed to the new process. 3163.Pp 3164The 3165.Ic update-environment 3166session option may be used to update the session environment from the client 3167when a new session is created or an old reattached. 3168.Nm 3169also initialises the 3170.Ev TMUX 3171variable with some internal information to allow commands to be executed 3172from inside, and the 3173.Ev TERM 3174variable with the correct terminal setting of 3175.Ql screen . 3176.Pp 3177Commands to alter and view the environment are: 3178.Bl -tag -width Ds 3179.It Xo Ic set-environment 3180.Op Fl gru 3181.Op Fl t Ar target-session 3182.Ar name Op Ar value 3183.Xc 3184.D1 (alias: Ic setenv ) 3185Set or unset an environment variable. 3186If 3187.Fl g 3188is used, the change is made in the global environment; otherwise, it is applied 3189to the session environment for 3190.Ar target-session . 3191The 3192.Fl u 3193flag unsets a variable. 3194.Fl r 3195indicates the variable is to be removed from the environment before starting a 3196new process. 3197.It Xo Ic show-environment 3198.Op Fl g 3199.Op Fl t Ar target-session 3200.Op Ar variable 3201.Xc 3202.D1 (alias: Ic showenv ) 3203Display the environment for 3204.Ar target-session 3205or the global environment with 3206.Fl g . 3207If 3208.Ar variable 3209is omitted, all variables are shown. 3210Variables removed from the environment are prefixed with 3211.Ql - . 3212.El 3213.Sh STATUS LINE 3214.Nm 3215includes an optional status line which is displayed in the bottom line of each 3216terminal. 3217By default, the status line is enabled (it may be disabled with the 3218.Ic status 3219session option) and contains, from left-to-right: the name of the current 3220session in square brackets; the window list; the title of the active pane 3221in double quotes; and the time and date. 3222.Pp 3223The status line is made of three parts: configurable left and right sections 3224(which may contain dynamic content such as the time or output from a shell 3225command, see the 3226.Ic status-left , 3227.Ic status-left-length , 3228.Ic status-right , 3229and 3230.Ic status-right-length 3231options below), and a central window list. 3232By default, the window list shows the index, name and (if any) flag of the 3233windows present in the current session in ascending numerical order. 3234It may be customised with the 3235.Ar window-status-format 3236and 3237.Ar window-status-current-format 3238options. 3239The flag is one of the following symbols appended to the window name: 3240.Bl -column "Symbol" "Meaning" -offset indent 3241.It Sy "Symbol" Ta Sy "Meaning" 3242.It Li "*" Ta "Denotes the current window." 3243.It Li "-" Ta "Marks the last window (previously selected)." 3244.It Li "#" Ta "Window is monitored and activity has been detected." 3245.It Li "!" Ta "A bell has occurred in the window." 3246.It Li "+" Ta "Window is monitored for content and it has appeared." 3247.It Li "~" Ta "The window has been silent for the monitor-silence interval." 3248.It Li "Z" Ta "The window's active pane is zoomed." 3249.El 3250.Pp 3251The # symbol relates to the 3252.Ic monitor-activity 3253and + to the 3254.Ic monitor-content 3255window options. 3256The window name is printed in inverted colours if an alert (bell, activity or 3257content) is present. 3258.Pp 3259The colour and attributes of the status line may be configured, the entire 3260status line using the 3261.Ic status-attr , 3262.Ic status-fg 3263and 3264.Ic status-bg 3265session options and individual windows using the 3266.Ic window-status-attr , 3267.Ic window-status-fg 3268and 3269.Ic window-status-bg 3270window options. 3271.Pp 3272The status line is automatically refreshed at interval if it has changed, the 3273interval may be controlled with the 3274.Ic status-interval 3275session option. 3276.Pp 3277Commands related to the status line are as follows: 3278.Bl -tag -width Ds 3279.It Xo Ic command-prompt 3280.Op Fl I Ar inputs 3281.Op Fl p Ar prompts 3282.Op Fl t Ar target-client 3283.Op Ar template 3284.Xc 3285Open the command prompt in a client. 3286This may be used from inside 3287.Nm 3288to execute commands interactively. 3289.Pp 3290If 3291.Ar template 3292is specified, it is used as the command. 3293If present, 3294.Fl I 3295is a comma-separated list of the initial text for each prompt. 3296If 3297.Fl p 3298is given, 3299.Ar prompts 3300is a comma-separated list of prompts which are displayed in order; otherwise 3301a single prompt is displayed, constructed from 3302.Ar template 3303if it is present, or 3304.Ql \&: 3305if not. 3306.Pp 3307Both 3308.Ar inputs 3309and 3310.Ar prompts 3311may contain the special character sequences supported by the 3312.Ic status-left 3313option. 3314.Pp 3315Before the command is executed, the first occurrence of the string 3316.Ql %% 3317and all occurrences of 3318.Ql %1 3319are replaced by the response to the first prompt, the second 3320.Ql %% 3321and all 3322.Ql %2 3323are replaced with the response to the second prompt, and so on for further 3324prompts. 3325Up to nine prompt responses may be replaced 3326.Po 3327.Ql %1 3328to 3329.Ql %9 3330.Pc . 3331.It Xo Ic confirm-before 3332.Op Fl p Ar prompt 3333.Op Fl t Ar target-client 3334.Ar command 3335.Xc 3336.D1 (alias: Ic confirm ) 3337Ask for confirmation before executing 3338.Ar command . 3339If 3340.Fl p 3341is given, 3342.Ar prompt 3343is the prompt to display; otherwise a prompt is constructed from 3344.Ar command . 3345It may contain the special character sequences supported by the 3346.Ic status-left 3347option. 3348.Pp 3349This command works only from inside 3350.Nm . 3351.It Xo Ic display-message 3352.Op Fl p 3353.Op Fl c Ar target-client 3354.Op Fl t Ar target-pane 3355.Op Ar message 3356.Xc 3357.D1 (alias: Ic display ) 3358Display a message. 3359If 3360.Fl p 3361is given, the output is printed to stdout, otherwise it is displayed in the 3362.Ar target-client 3363status line. 3364The format of 3365.Ar message 3366is described in the 3367.Sx FORMATS 3368section; information is taken from 3369.Ar target-pane 3370if 3371.Fl t 3372is given, otherwise the active pane for the session attached to 3373.Ar target-client . 3374.El 3375.Sh BUFFERS 3376.Nm 3377maintains a stack of 3378.Em paste buffers . 3379Up to the value of the 3380.Ic buffer-limit 3381option are kept; when a new buffer is added, the buffer at the bottom of the 3382stack is removed. 3383Buffers may be added using 3384.Ic copy-mode 3385or the 3386.Ic set-buffer 3387command, and pasted into a window using the 3388.Ic paste-buffer 3389command. 3390.Pp 3391A configurable history buffer is also maintained for each window. 3392By default, up to 2000 lines are kept; this can be altered with the 3393.Ic history-limit 3394option (see the 3395.Ic set-option 3396command above). 3397.Pp 3398The buffer commands are as follows: 3399.Bl -tag -width Ds 3400.It Xo 3401.Ic choose-buffer 3402.Op Fl F Ar format 3403.Op Fl t Ar target-window 3404.Op Ar template 3405.Xc 3406Put a window into buffer choice mode, where a buffer may be chosen 3407interactively from a list. 3408After a buffer is selected, 3409.Ql %% 3410is replaced by the buffer index in 3411.Ar template 3412and the result executed as a command. 3413If 3414.Ar template 3415is not given, "paste-buffer -b '%%'" is used. 3416For the meaning of the 3417.Fl F 3418flag, see the 3419.Sx FORMATS 3420section. 3421This command works only if at least one client is attached. 3422.It Ic clear-history Op Fl t Ar target-pane 3423.D1 (alias: Ic clearhist ) 3424Remove and free the history for the specified pane. 3425.It Ic delete-buffer Op Fl b Ar buffer-index 3426.D1 (alias: Ic deleteb ) 3427Delete the buffer at 3428.Ar buffer-index , 3429or the top buffer if not specified. 3430.It Xo Ic list-buffers 3431.Op Fl F Ar format 3432.Xc 3433.D1 (alias: Ic lsb ) 3434List the global buffers. 3435For the meaning of the 3436.Fl F 3437flag, see the 3438.Sx FORMATS 3439section. 3440.It Xo Ic load-buffer 3441.Op Fl b Ar buffer-index 3442.Ar path 3443.Xc 3444.D1 (alias: Ic loadb ) 3445Load the contents of the specified paste buffer from 3446.Ar path . 3447.It Xo Ic paste-buffer 3448.Op Fl dpr 3449.Op Fl b Ar buffer-index 3450.Op Fl s Ar separator 3451.Op Fl t Ar target-pane 3452.Xc 3453.D1 (alias: Ic pasteb ) 3454Insert the contents of a paste buffer into the specified pane. 3455If not specified, paste into the current one. 3456With 3457.Fl d , 3458also delete the paste buffer from the stack. 3459When output, any linefeed (LF) characters in the paste buffer are replaced with 3460a separator, by default carriage return (CR). 3461A custom separator may be specified using the 3462.Fl s 3463flag. 3464The 3465.Fl r 3466flag means to do no replacement (equivalent to a separator of LF). 3467If 3468.Fl p 3469is specified, paste bracket control codes are inserted around the 3470buffer if the application has requested bracketed paste mode. 3471.It Xo Ic save-buffer 3472.Op Fl a 3473.Op Fl b Ar buffer-index 3474.Ar path 3475.Xc 3476.D1 (alias: Ic saveb ) 3477Save the contents of the specified paste buffer to 3478.Ar path . 3479The 3480.Fl a 3481option appends to rather than overwriting the file. 3482.It Xo Ic set-buffer 3483.Op Fl b Ar buffer-index 3484.Ar data 3485.Xc 3486.D1 (alias: Ic setb ) 3487Set the contents of the specified buffer to 3488.Ar data . 3489.It Xo Ic show-buffer 3490.Op Fl b Ar buffer-index 3491.Xc 3492.D1 (alias: Ic showb ) 3493Display the contents of the specified buffer. 3494.El 3495.Sh MISCELLANEOUS 3496Miscellaneous commands are as follows: 3497.Bl -tag -width Ds 3498.It Ic clock-mode Op Fl t Ar target-pane 3499Display a large clock. 3500.It Xo Ic if-shell 3501.Op Fl b 3502.Op Fl t Ar target-pane 3503.Ar shell-command command 3504.Op Ar command 3505.Xc 3506.D1 (alias: Ic if ) 3507Execute the first 3508.Ar command 3509if 3510.Ar shell-command 3511returns success or the second 3512.Ar command 3513otherwise. 3514Before being executed, shell-command is expanded using the rules specified in the 3515.Sx FORMATS 3516section, including those relevant to 3517.Ar target-pane . 3518With 3519.Fl b , 3520.Ar shell-command 3521is run in the background. 3522.It Ic lock-server 3523.D1 (alias: Ic lock ) 3524Lock each client individually by running the command specified by the 3525.Ic lock-command 3526option. 3527.It Xo Ic run-shell 3528.Op Fl b 3529.Op Fl t Ar target-pane 3530.Ar shell-command 3531.Xc 3532.D1 (alias: Ic run ) 3533Execute 3534.Ar shell-command 3535in the background without creating a window. 3536Before being executed, shell-command is expanded using the rules specified in 3537the 3538.Sx FORMATS 3539section. 3540With 3541.Fl b , 3542the command is run in the background. 3543After it finishes, any output to stdout is displayed in copy mode (in the pane 3544specified by 3545.Fl t 3546or the current pane if omitted). 3547If the command doesn't return success, the exit status is also displayed. 3548.It Ic server-info 3549.D1 (alias: Ic info ) 3550Show server information and terminal details. 3551.It Xo Ic wait-for 3552.Fl LSU 3553.Ar channel 3554.Xc 3555.D1 (alias: Ic wait ) 3556When used without options, prevents the client from exiting until woken using 3557.Ic wait-for 3558.Fl S 3559with the same channel. 3560When 3561.Fl L 3562is used, the channel is locked and any clients that try to lock the same 3563channel are made to wait until the channel is unlocked with 3564.Ic wait-for 3565.Fl U . 3566This command only works from outside 3567.Nm . 3568.El 3569.Sh TERMINFO EXTENSIONS 3570.Nm 3571understands some extensions to 3572.Xr terminfo 5 : 3573.Bl -tag -width Ds 3574.It Em Cs , Cr 3575Set the cursor colour. 3576The first takes a single string argument and is used to set the colour; 3577the second takes no arguments and restores the default cursor colour. 3578If set, a sequence such as this may be used 3579to change the cursor colour from inside 3580.Nm : 3581.Bd -literal -offset indent 3582$ printf '\e033]12;red\e033\e\e' 3583.Ed 3584.It Em \&Ss , Se 3585Change the cursor style. 3586If set, a sequence such as this may be used 3587to change the cursor to an underline: 3588.Bd -literal -offset indent 3589$ printf '\e033[4 q' 3590.Ed 3591.Pp 3592If 3593.Em Csr 3594is set, it will be used to reset the cursor style instead 3595of 3596.Em Cs . 3597.It Em \&Ms 3598This sequence can be used by 3599.Nm 3600to store the current buffer in the host terminal's selection (clipboard). 3601See the 3602.Em set-clipboard 3603option above and the 3604.Xr xterm 1 3605man page. 3606.El 3607.Sh CONTROL MODE 3608.Nm 3609offers a textual interface called 3610.Em control mode . 3611This allows applications to communicate with 3612.Nm 3613using a simple text-only protocol. 3614.Pp 3615In control mode, a client sends 3616.Nm 3617commands or command sequences terminated by newlines on standard input. 3618Each command will produce one block of output on standard output. 3619An output block consists of a 3620.Em %begin 3621line followed by the output (which may be empty). 3622The output block ends with a 3623.Em %end 3624or 3625.Em %error . 3626.Em %begin 3627and matching 3628.Em %end 3629or 3630.Em %error 3631have two arguments: an integer time (as seconds from epoch) and command number. 3632For example: 3633.Bd -literal -offset indent 3634%begin 1363006971 2 36350: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active) 3636%end 1363006971 2 3637.Ed 3638.Pp 3639In control mode, 3640.Nm 3641outputs notifications. 3642A notification will never occur inside an output block. 3643.Pp 3644The following notifications are defined: 3645.Bl -tag -width Ds 3646.It Ic %exit Op Ar reason 3647The 3648.Nm 3649client is exiting immediately, either because it is not attached to any session 3650or an error occurred. 3651If present, 3652.Ar reason 3653describes why the client exited. 3654.It Ic %layout-change Ar window-id Ar window-layout 3655The layout of a window with ID 3656.Ar window-id 3657changed. 3658The new layout is 3659.Ar window-layout . 3660.It Ic %output Ar pane-id Ar value 3661A window pane produced output. 3662.Ar value 3663escapes non-printable characters and backslash as octal \\xxx. 3664.It Ic %session-changed Ar session-id Ar name 3665The client is now attached to the session with ID 3666.Ar session-id , 3667which is named 3668.Ar name . 3669.It Ic %session-renamed Ar name 3670The current session was renamed to 3671.Ar name . 3672.It Ic %sessions-changed 3673A session was created or destroyed. 3674.It Ic %unlinked-window-add Ar window-id 3675The window with ID 3676.Ar window-id 3677was created but is not linked to the current session. 3678.It Ic %window-add Ar window-id 3679The window with ID 3680.Ar window-id 3681was linked to the current session. 3682.It Ic %window-close Ar window-id 3683The window with ID 3684.Ar window-id 3685closed. 3686.It Ic %window-renamed Ar window-id Ar name 3687The window with ID 3688.Ar window-id 3689was renamed to 3690.Ar name . 3691.El 3692.Sh FILES 3693.Bl -tag -width "/etc/tmux.confXXX" -compact 3694.It Pa ~/.tmux.conf 3695Default 3696.Nm 3697configuration file. 3698.It Pa /etc/tmux.conf 3699System-wide configuration file. 3700.El 3701.Sh EXAMPLES 3702To create a new 3703.Nm 3704session running 3705.Xr vi 1 : 3706.Pp 3707.Dl $ tmux new-session vi 3708.Pp 3709Most commands have a shorter form, known as an alias. 3710For new-session, this is 3711.Ic new : 3712.Pp 3713.Dl $ tmux new vi 3714.Pp 3715Alternatively, the shortest unambiguous form of a command is accepted. 3716If there are several options, they are listed: 3717.Bd -literal -offset indent 3718$ tmux n 3719ambiguous command: n, could be: new-session, new-window, next-window 3720.Ed 3721.Pp 3722Within an active session, a new window may be created by typing 3723.Ql C-b c 3724(Ctrl 3725followed by the 3726.Ql b 3727key 3728followed by the 3729.Ql c 3730key). 3731.Pp 3732Windows may be navigated with: 3733.Ql C-b 0 3734(to select window 0), 3735.Ql C-b 1 3736(to select window 1), and so on; 3737.Ql C-b n 3738to select the next window; and 3739.Ql C-b p 3740to select the previous window. 3741.Pp 3742A session may be detached using 3743.Ql C-b d 3744(or by an external event such as 3745.Xr ssh 1 3746disconnection) and reattached with: 3747.Pp 3748.Dl $ tmux attach-session 3749.Pp 3750Typing 3751.Ql C-b \&? 3752lists the current key bindings in the current window; up and down may be used 3753to navigate the list or 3754.Ql q 3755to exit from it. 3756.Pp 3757Commands to be run when the 3758.Nm 3759server is started may be placed in the 3760.Pa ~/.tmux.conf 3761configuration file. 3762Common examples include: 3763.Pp 3764Changing the default prefix key: 3765.Bd -literal -offset indent 3766set-option -g prefix C-a 3767unbind-key C-b 3768bind-key C-a send-prefix 3769.Ed 3770.Pp 3771Turning the status line off, or changing its colour: 3772.Bd -literal -offset indent 3773set-option -g status off 3774set-option -g status-bg blue 3775.Ed 3776.Pp 3777Setting other options, such as the default command, 3778or locking after 30 minutes of inactivity: 3779.Bd -literal -offset indent 3780set-option -g default-command "exec /bin/ksh" 3781set-option -g lock-after-time 1800 3782.Ed 3783.Pp 3784Creating new key bindings: 3785.Bd -literal -offset indent 3786bind-key b set-option status 3787bind-key / command-prompt "split-window 'exec man %%'" 3788bind-key S command-prompt "new-window -n %1 'ssh %1'" 3789.Ed 3790.Sh SEE ALSO 3791.Xr pty 4 3792.Sh AUTHORS 3793.An Nicholas Marriott Aq nicm@users.sourceforge.net 3794