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