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