Add client formats, from Ben Boeckel.
[tmux-openbsd.git] / tmux.1
blob0ea97e95cd50158276eb9507e433fc13fed1eb94
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 28lquv
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 8
102 Like
103 .Fl 2 ,
104 but indicates that the terminal supports 88 colours.
105 .It Fl c Ar shell-command
106 Execute
107 .Ar shell-command
108 using the default shell.
109 If necessary, the
111 server will be started to retrieve the
112 .Ic default-shell
113 option.
114 This option is for compatibility with
115 .Xr sh 1
116 when
118 is used as a login shell.
119 .It Fl f Ar file
120 Specify an alternative configuration file.
121 By default,
123 loads the system configuration file from
124 .Pa /etc/tmux.conf ,
125 if present, then looks for a user configuration file at
126 .Pa ~/.tmux.conf .
127 The configuration file is a set of
129 commands which are executed in sequence when the server is first started.
131 If a command in the configuration file fails,
133 will report an error and exit without executing further commands.
134 .It Fl L Ar socket-name
136 stores the server socket in a directory under
137 .Pa /tmp
139 .Ev TMPDIR
140 if set);
141 the default socket is named
142 .Em default .
143 This option allows a different socket name to be specified, allowing several
144 independent
146 servers to be run.
147 Unlike
148 .Fl S
149 a full path is not necessary: the sockets are all created in the same
150 directory.
152 If the socket is accidentally removed, the
153 .Dv SIGUSR1
154 signal may be sent to the
156 server process to recreate it.
157 .It Fl l
158 Behave as a login shell.
159 This flag currently has no effect and is for compatibility with other shells
160 when using tmux as a login shell.
161 .It Fl q
162 Set the
163 .Ic quiet
164 server option to prevent the server sending various informational messages.
165 .It Fl S Ar socket-path
166 Specify a full alternative path to the server socket.
168 .Fl S
169 is specified, the default socket directory is not used and any
170 .Fl L
171 flag is ignored.
172 .It Fl u
174 attempts to guess if the terminal is likely to support UTF-8 by checking the
175 first of the
176 .Ev LC_ALL ,
177 .Ev LC_CTYPE
179 .Ev LANG
180 environment variables to be set for the string "UTF-8".
181 This is not always correct: the
182 .Fl u
183 flag explicitly informs
185 that UTF-8 is supported.
187 If the server is started from a client passed
188 .Fl u
189 or where UTF-8 is detected, the
190 .Ic utf8
192 .Ic status-utf8
193 options are enabled in the global window and session options respectively.
194 .It Fl v
195 Request verbose logging.
196 This option may be specified multiple times for increasing verbosity.
197 Log messages will be saved into
198 .Pa tmux-client-PID.log
200 .Pa tmux-server-PID.log
201 files in the current directory, where
202 .Em PID
203 is the PID of the server or client process.
204 .It Ar command Op Ar flags
205 This specifies one of a set of commands used to control
206 .Nm ,
207 as described in the following sections.
208 If no commands are specified, the
209 .Ic new-session
210 command is assumed.
212 .Sh KEY BINDINGS
214 may be controlled from an attached client by using a key combination of a
215 prefix key,
216 .Ql C-b
217 (Ctrl-b) by default, followed by a command key.
219 The default command key bindings are:
221 .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
222 .It C-b
223 Send the prefix key (C-b) through to the application.
224 .It C-o
225 Rotate the panes in the current window forwards.
226 .It C-z
227 Suspend the
229 client.
230 .It !
231 Break the current pane out of the window.
232 .It \&"
233 Split the current pane into two, top and bottom.
234 .It #
235 List all paste buffers.
236 .It $
237 Rename the current session.
238 .It %
239 Split the current pane into two, left and right.
240 .It &
241 Kill the current window.
242 .It '
243 Prompt for a window index to select.
244 .It ,
245 Rename the current window.
246 .It -
247 Delete the most recently copied buffer of text.
248 .It .
249 Prompt for an index to move the current window.
250 .It 0 to 9
251 Select windows 0 to 9.
252 .It :
253 Enter the
255 command prompt.
256 .It ;
257 Move to the previously active pane.
258 .It =
259 Choose which buffer to paste interactively from a list.
260 .It \&?
261 List all key bindings.
262 .It D
263 Choose a client to detach.
264 .It \&[
265 Enter copy mode to copy text or view the history.
266 .It \&]
267 Paste the most recently copied buffer of text.
268 .It c
269 Create a new window.
270 .It d
271 Detach the current client.
272 .It f
273 Prompt to search for text in open windows.
274 .It i
275 Display some information about the current window.
276 .It l
277 Move to the previously selected window.
278 .It n
279 Change to the next window.
280 .It o
281 Select the next pane in the current window.
282 .It p
283 Change to the previous window.
284 .It q
285 Briefly display pane indexes.
286 .It r
287 Force redraw of the attached client.
288 .It s
289 Select a new session for the attached client interactively.
290 .It L
291 Switch the attached client back to the last session.
292 .It t
293 Show the time.
294 .It w
295 Choose the current window interactively.
296 .It x
297 Kill the current pane.
298 .It {
299 Swap the current pane with the previous pane.
300 .It }
301 Swap the current pane with the next pane.
302 .It ~
303 Show previous messages from
304 .Nm ,
305 if any.
306 .It Page Up
307 Enter copy mode and scroll one page up.
308 .It Up, Down
309 .It Left, Right
310 Change to the pane above, below, to the left, or to the right of the current
311 pane.
312 .It M-1 to M-5
313 Arrange panes in one of the five preset layouts: even-horizontal,
314 even-vertical, main-horizontal, main-vertical, or tiled.
315 .It M-n
316 Move to the next window with a bell or activity marker.
317 .It M-o
318 Rotate the panes in the current window backwards.
319 .It M-p
320 Move to the previous window with a bell or activity marker.
321 .It C-Up, C-Down
322 .It C-Left, C-Right
323 Resize the current pane in steps of one cell.
324 .It M-Up, M-Down
325 .It M-Left, M-Right
326 Resize the current pane in steps of five cells.
329 Key bindings may be changed with the
330 .Ic bind-key
332 .Ic unbind-key
333 commands.
334 .Sh COMMANDS
335 This section contains a list of the commands supported by
336 .Nm .
337 Most commands accept the optional
338 .Fl t
339 argument with one of
340 .Ar target-client ,
341 .Ar target-session
342 .Ar target-window ,
344 .Ar target-pane .
345 These specify the client, session, window or pane which a command should affect.
346 .Ar target-client
347 is the name of the
348 .Xr pty 4
349 file to which the client is connected, for example either of
350 .Pa /dev/ttyp1
352 .Pa ttyp1
353 for the client attached to
354 .Pa /dev/ttyp1 .
355 If no client is specified, the current client is chosen, if possible, or an
356 error is reported.
357 Clients may be listed with the
358 .Ic list-clients
359 command.
361 .Ar target-session
362 is either the name of a session (as listed by the
363 .Ic list-sessions
364 command) or the name of a client with the same syntax as
365 .Ar target-client ,
366 in which case the session attached to the client is used.
367 When looking for the session name,
369 initially searches for an exact match; if none is found, the session names
370 are checked for any for which
371 .Ar target-session
372 is a prefix or for which it matches as an
373 .Xr fnmatch 3
374 pattern.
375 If a single match is found, it is used as the target session; multiple matches
376 produce an error.
377 If a session is omitted, the current session is used if available; if no
378 current session is available, the most recently used is chosen.
380 .Ar target-window
381 specifies a window in the form
382 .Em session Ns \&: Ns Em window .
383 .Em session
384 follows the same rules as for
385 .Ar target-session ,
387 .Em window
388 is looked for in order: as a window index, for example mysession:1; as an exact
389 window name, such as mysession:mywindow; then as an
390 .Xr fnmatch 3
391 pattern or the start of a window name, such as mysession:mywin* or
392 mysession:mywin.
393 An empty window name specifies the next unused index if appropriate (for
394 example the
395 .Ic new-window
397 .Ic link-window
398 commands)
399 otherwise the current window in
400 .Em session
401 is chosen.
402 The special character
403 .Ql \&!
404 uses the last (previously current) window, or
405 .Ql +
407 .Ql -
408 are the next window or the previous window by number.
409 When the argument does not contain a colon,
411 first attempts to parse it as window; if that fails, an attempt is made to
412 match a session.
414 .Ar target-pane
415 takes a similar form to
416 .Ar target-window
417 but with the optional addition of a period followed by a pane index, for
418 example: mysession:mywindow.1.
419 If the pane index is omitted, the currently active pane in the specified
420 window is used.
421 If neither a colon nor period appears,
423 first attempts to use the argument as a pane index; if that fails, it is looked
424 up as for
425 .Ar target-window .
427 .Ql +
429 .Ql -
430 indicate the next or previous pane index, respectively.
431 One of the strings
432 .Em top ,
433 .Em bottom ,
434 .Em left ,
435 .Em right ,
436 .Em top-left ,
437 .Em top-right ,
438 .Em bottom-left
440 .Em bottom-right
441 may be used instead of a pane index.
443 The special characters
444 .Ql +
446 .Ql -
447 may be followed by an offset, for example:
448 .Bd -literal -offset indent
449 select-window -t:+2
452 When dealing with a session that doesn't contain sequential window indexes,
453 they will be correctly skipped.
456 also gives each pane created in a server an identifier consisting of a
457 .Ql %
458 and a number, starting from zero.
459 A pane's identifier is unique for the life of the
461 server and is passed to the child process of the pane in the
462 .Ev TMUX_PANE
463 environment variable.
464 It may be used alone to target a pane or the window containing it.
466 .Ar shell-command
467 arguments are
468 .Xr sh 1
469 commands.
470 These must be passed as a single item, which typically means quoting them, for
471 example:
472 .Bd -literal -offset indent
473 new-window 'vi /etc/passwd'
476 .Ar command
477 .Op Ar arguments
478 refers to a
480 command, passed with the command and arguments separately, for example:
481 .Bd -literal -offset indent
482 bind-key F1 set-window-option force-width 81
485 Or if using
486 .Xr sh 1 :
487 .Bd -literal -offset indent
488 $ tmux bind-key F1 set-window-option force-width 81
491 Multiple commands may be specified together as part of a
492 .Em command sequence .
493 Each command should be separated by spaces and a semicolon;
494 commands are executed sequentially from left to right and
495 lines ending with a backslash continue on to the next line.
496 A literal semicolon may be included by escaping it with a backslash (for
497 example, when specifying a command sequence to
498 .Ic bind-key ) .
500 Example
502 commands include:
503 .Bd -literal -offset indent
504 refresh-client -t/dev/ttyp2
506 rename-session -tfirst newname
508 set-window-option -t:0 monitor-activity on
510 new-window ; split-window -d
512 bind-key R source-file ~/.tmux.conf \e; \e
513         display-message "source-file done"
516 Or from
517 .Xr sh 1 :
518 .Bd -literal -offset indent
519 $ tmux kill-window -t :1
521 $ tmux new-window \e; split-window -d
523 $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
525 .Sh CLIENTS AND SESSIONS
528 server manages clients, sessions, windows and panes.
529 Clients are attached to sessions to interact with them, either
530 when they are created with the
531 .Ic new-session
532 command, or later with the
533 .Ic attach-session
534 command.
535 Each session has one or more windows
536 .Em linked
537 into it.
538 Windows may be linked to multiple sessions and are made up of one or
539 more panes,
540 each of which contains a pseudo terminal.
541 Commands for creating, linking and otherwise manipulating windows
542 are covered
543 in the
544 .Sx WINDOWS AND PANES
545 section.
547 The following commands are available to manage clients and sessions:
548 .Bl -tag -width Ds
549 .It Xo Ic attach-session
550 .Op Fl dr
551 .Op Fl t Ar target-session
553 .D1 (alias: Ic attach )
554 If run from outside
555 .Nm ,
556 create a new client in the current terminal and attach it to
557 .Ar target-session .
558 If used from inside, switch the current client.
560 .Fl d
561 is specified, any other clients attached to the session are detached.
562 .Fl r
563 signifies the client is read-only (only keys bound to the
564 .Ic detach-client
566 .Ic switch-client
567 commands have any effect)
569 If no server is started,
570 .Ic attach-session
571 will attempt to start it; this will fail unless sessions are created in the
572 configuration file.
575 .Ar target-session
576 rules for
577 .Ic attach-session
578 are slightly adjusted: if
580 needs to select the most recently used session, it will prefer the most
581 recently used
582 .Em unattached
583 session.
584 .It Xo Ic detach-client
585 .Op Fl P
586 .Op Fl s Ar target-session
587 .Op Fl t Ar target-client
589 .D1 (alias: Ic detach )
590 Detach the current client if bound to a key, the client specified with
591 .Fl t ,
592 or all clients currently attached to to the session specified by
593 .Fl s .
595 .Fl P
596 is given, send SIGHUP to the parent process of the client, typically causing it
597 to exit.
598 .It Ic has-session Op Fl t Ar target-session
599 .D1 (alias: Ic has )
600 Report an error and exit with 1 if the specified session does not exist.
601 If it does exist, exit with 0.
602 .It Ic kill-server
603 Kill the
605 server and clients and destroy all sessions.
606 .It Ic kill-session Op Fl t Ar target-session
607 Destroy the given session, closing any windows linked to it and no other
608 sessions, and detaching all clients attached to it.
609 .It Xo Ic list-clients
610 .Op Fl F Ar format
611 .Op Fl t Ar target-session
613 .D1 (alias: Ic lsc )
614 List all clients attached to the server.
615 For the meaning of the
616 .Fl F
617 flag, see the
618 .Sx FORMATS section.
620 .Ar target-session
621 is specified, list only clients connected to that session.
622 .It Ic list-commands
623 .D1 (alias: Ic lscm )
624 List the syntax of all commands supported by
625 .Nm .
626 .It Ic list-sessions Op Fl F Ar format
627 .D1 (alias: Ic ls )
628 List all sessions managed by the server.
629 For the meaning of the
630 .Fl F
631 flag, see the
632 .Sx FORMATS
633 section.
634 .It Ic lock-client Op Fl t Ar target-client
635 .D1 (alias: Ic lockc )
636 Lock
637 .Ar target-client ,
638 see the
639 .Ic lock-server
640 command.
641 .It Ic lock-session Op Fl t Ar target-session
642 .D1 (alias: Ic locks )
643 Lock all clients attached to
644 .Ar target-session .
645 .It Xo Ic new-session
646 .Op Fl d
647 .Op Fl n Ar window-name
648 .Op Fl s Ar session-name
649 .Op Fl t Ar target-session
650 .Op Fl x Ar width
651 .Op Fl y Ar height
652 .Op Ar shell-command
654 .D1 (alias: Ic new )
655 Create a new session with name
656 .Ar session-name .
658 The new session is attached to the current terminal unless
659 .Fl d
660 is given.
661 .Ar window-name
663 .Ar shell-command
664 are the name of and shell command to execute in the initial window.
666 .Fl d
667 is used,
668 .Fl x
670 .Fl y
671 specify the size of the initial window (80 by 24 if not given).
673 If run from a terminal, any
674 .Xr termios 4
675 special characters are saved and used for new windows in the new session.
678 .Fl t
679 is given, the new session is
680 .Em grouped
681 with
682 .Ar target-session .
683 This means they share the same set of windows - all windows from
684 .Ar target-session
685 are linked to the new session and any subsequent new windows or windows being
686 closed are applied to both sessions.
687 The current and previous window and any session options remain independent and
688 either session may be killed without affecting the other.
689 Giving
690 .Fl n
692 .Ar shell-command
693 are invalid if
694 .Fl t
695 is used.
696 .It Xo Ic refresh-client
697 .Op Fl S
698 .Op Fl t Ar target-client
700 .D1 (alias: Ic refresh )
701 Refresh the current client if bound to a key, or a single client if one is given
702 with
703 .Fl t .
705 .Fl S
706 is specified, only update the client's status bar.
707 .It Xo Ic rename-session
708 .Op Fl t Ar target-session
709 .Ar new-name
711 .D1 (alias: Ic rename )
712 Rename the session to
713 .Ar new-name .
714 .It Xo Ic show-messages
715 .Op Fl t Ar target-client
717 .D1 (alias: Ic showmsgs )
718 Any messages displayed on the status line are saved in a per-client message
719 log, up to a maximum of the limit set by the
720 .Ar message-limit
721 session option for the session attached to that client.
722 This command displays the log for
723 .Ar target-client .
724 .It Ic source-file Ar path
725 .D1 (alias: Ic source )
726 Execute commands from
727 .Ar path .
728 .It Ic start-server
729 .D1 (alias: Ic start )
730 Start the
732 server, if not already running, without creating any sessions.
733 .It Xo Ic suspend-client
734 .Op Fl t Ar target-client
736 .D1 (alias: Ic suspendc )
737 Suspend a client by sending
738 .Dv SIGTSTP
739 (tty stop).
740 .It Xo Ic switch-client
741 .Op Fl lnpr
742 .Op Fl c Ar target-client
743 .Op Fl t Ar target-session
745 .D1 (alias: Ic switchc )
746 Switch the current session for client
747 .Ar target-client
749 .Ar target-session .
751 .Fl l ,
752 .Fl n
754 .Fl p
755 is used, the client is moved to the last, next or previous session
756 respectively.
757 .Fl r
758 toggles whether a client is read-only (see the
759 .Ic attach-session
760 command).
762 .Sh WINDOWS AND PANES
765 window may be in one of several modes.
766 The default permits direct access to the terminal attached to the window.
767 The other is copy mode, which permits a section of a window or its
768 history to be copied to a
769 .Em paste buffer
770 for later insertion into another window.
771 This mode is entered with the
772 .Ic copy-mode
773 command, bound to
774 .Ql \&[
775 by default.
776 It is also entered when a command that produces output, such as
777 .Ic list-keys ,
778 is executed from a key binding.
780 The keys available depend on whether emacs or vi mode is selected
781 (see the
782 .Ic mode-keys
783 option).
784 The following keys are supported as appropriate for the mode:
785 .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
786 .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
787 .It Li "Back to indentation" Ta "^" Ta "M-m"
788 .It Li "Bottom of history" Ta "G" Ta "M-<"
789 .It Li "Clear selection" Ta "Escape" Ta "C-g"
790 .It Li "Copy selection" Ta "Enter" Ta "M-w"
791 .It Li "Cursor down" Ta "j" Ta "Down"
792 .It Li "Cursor left" Ta "h" Ta "Left"
793 .It Li "Cursor right" Ta "l" Ta "Right"
794 .It Li "Cursor to bottom line" Ta "L" Ta ""
795 .It Li "Cursor to middle line" Ta "M" Ta "M-r"
796 .It Li "Cursor to top line" Ta "H" Ta "M-R"
797 .It Li "Cursor up" Ta "k" Ta "Up"
798 .It Li "Delete entire line" Ta "d" Ta "C-u"
799 .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
800 .It Li "End of line" Ta "$" Ta "C-e"
801 .It Li "Go to line" Ta ":" Ta "g"
802 .It Li "Half page down" Ta "C-d" Ta "M-Down"
803 .It Li "Half page up" Ta "C-u" Ta "M-Up"
804 .It Li "Jump forward" Ta "f" Ta "f"
805 .It Li "Jump backward" Ta "F" Ta "F"
806 .It Li "Jump again" Ta ";" Ta ";"
807 .It Li "Jump again in reverse" Ta "," Ta ","
808 .It Li "Next page" Ta "C-f" Ta "Page down"
809 .It Li "Next space" Ta "W" Ta ""
810 .It Li "Next space, end of word" Ta "E" Ta ""
811 .It Li "Next word" Ta "w" Ta ""
812 .It Li "Next word end" Ta "e" Ta "M-f"
813 .It Li "Paste buffer" Ta "p" Ta "C-y"
814 .It Li "Previous page" Ta "C-b" Ta "Page up"
815 .It Li "Previous word" Ta "b" Ta "M-b"
816 .It Li "Previous space" Ta "B" Ta ""
817 .It Li "Quit mode" Ta "q" Ta "Escape"
818 .It Li "Rectangle toggle" Ta "v" Ta "R"
819 .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
820 .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
821 .It Li "Search again" Ta "n" Ta "n"
822 .It Li "Search again in reverse" Ta "N" Ta "N"
823 .It Li "Search backward" Ta "?" Ta "C-r"
824 .It Li "Search forward" Ta "/" Ta "C-s"
825 .It Li "Start of line" Ta "0" Ta "C-a"
826 .It Li "Start selection" Ta "Space" Ta "C-Space"
827 .It Li "Top of history" Ta "g" Ta "M->"
828 .It Li "Transpose chars" Ta "" Ta "C-t"
831 The next and previous word keys use space and the
832 .Ql - ,
833 .Ql _
835 .Ql @
836 characters as word delimiters by default, but this can be adjusted by
837 setting the
838 .Em word-separators
839 window option.
840 Next word moves to the start of the next word, next word end to the end of the
841 next word and previous word to the start of the previous word.
842 The three next and previous space keys work similarly but use a space alone as
843 the word separator.
845 The jump commands enable quick movement within a line.
846 For instance, typing
847 .Ql f
848 followed by
849 .Ql /
850 will move the cursor to the next
851 .Ql /
852 character on the current line.
854 .Ql \&;
855 will then jump to the next occurrence.
857 Commands in copy mode may be prefaced by an optional repeat count.
858 With vi key bindings, a prefix is entered using the number keys; with
859 emacs, the Alt (meta) key and a number begins prefix entry.
860 For example, to move the cursor forward by ten words, use
861 .Ql M-1 0 M-f
862 in emacs mode, and
863 .Ql 10w
864 in vi.
866 Mode key bindings are defined in a set of named tables:
867 .Em vi-edit
869 .Em emacs-edit
870 for keys used when line editing at the command prompt;
871 .Em vi-choice
873 .Em emacs-choice
874 for keys used when choosing from lists (such as produced by the
875 .Ic choose-window
876 command); and
877 .Em vi-copy
879 .Em emacs-copy
880 used in copy mode.
881 The tables may be viewed with the
882 .Ic list-keys
883 command and keys modified or removed with
884 .Ic bind-key
886 .Ic unbind-key .
888 The paste buffer key pastes the first line from the top paste buffer on the
889 stack.
891 The synopsis for the
892 .Ic copy-mode
893 command is:
894 .Bl -tag -width Ds
895 .It Xo Ic copy-mode
896 .Op Fl u
897 .Op Fl t Ar target-pane
899 Enter copy mode.
901 .Fl u
902 option scrolls one page up.
905 Each window displayed by
907 may be split into one or more
908 .Em panes ;
909 each pane takes up a certain area of the display and is a separate terminal.
910 A window may be split into panes using the
911 .Ic split-window
912 command.
913 Windows may be split horizontally (with the
914 .Fl h
915 flag) or vertically.
916 Panes may be resized with the
917 .Ic resize-pane
918 command (bound to
919 .Ql C-up ,
920 .Ql C-down
921 .Ql C-left
923 .Ql C-right
924 by default), the current pane may be changed with the
925 .Ic select-pane
926 command and the
927 .Ic rotate-window
929 .Ic swap-pane
930 commands may be used to swap panes without changing their position.
931 Panes are numbered beginning from zero in the order they are created.
933 A number of preset
934 .Em layouts
935 are available.
936 These may be selected with the
937 .Ic select-layout
938 command or cycled with
939 .Ic next-layout
940 (bound to
941 .Ql Space
942 by default); once a layout is chosen, panes within it may be moved and resized
943 as normal.
945 The following layouts are supported:
946 .Bl -tag -width Ds
947 .It Ic even-horizontal
948 Panes are spread out evenly from left to right across the window.
949 .It Ic even-vertical
950 Panes are spread evenly from top to bottom.
951 .It Ic main-horizontal
952 A large (main) pane is shown at the top of the window and the remaining panes
953 are spread from left to right in the leftover space at the bottom.
954 Use the
955 .Em main-pane-height
956 window option to specify the height of the top pane.
957 .It Ic main-vertical
958 Similar to
959 .Ic main-horizontal
960 but the large pane is placed on the left and the others spread from top to
961 bottom along the right.
962 See the
963 .Em main-pane-width
964 window option.
965 .It Ic tiled
966 Panes are spread out as evenly as possible over the window in both rows and
967 columns.
970 In addition,
971 .Ic select-layout
972 may be used to apply a previously used layout - the
973 .Ic list-windows
974 command displays the layout of each window in a form suitable for use with
975 .Ic select-layout .
976 For example:
977 .Bd -literal -offset indent
978 $ tmux list-windows
979 0: ksh [159x48]
980     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
981 $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
985 automatically adjusts the size of the layout for the current window size.
986 Note that a layout cannot be applied to a window with more panes than that
987 from which the layout was originally defined.
989 Commands related to windows and panes are as follows:
990 .Bl -tag -width Ds
991 .It Xo Ic break-pane
992 .Op Fl d
993 .Op Fl t Ar target-pane
995 .D1 (alias: Ic breakp )
996 Break
997 .Ar target-pane
998 off from its containing window to make it the only pane in a new window.
1000 .Fl d
1001 is given, the new window does not become the current window.
1002 .It Xo Ic capture-pane
1003 .Op Fl b Ar buffer-index
1004 .Op Fl E Ar end-line
1005 .Op Fl S Ar start-line
1006 .Op Fl t Ar target-pane
1008 .D1 (alias: Ic capturep )
1009 Capture the contents of a pane to the specified buffer, or a new buffer if none
1010 is specified.
1012 .Fl S
1014 .Fl E
1015 specify the starting and ending line numbers, zero is the first line of the
1016 visible pane and negative numbers are lines in the history.
1017 The default is to capture only the visible contents of the pane.
1018 .It Xo
1019 .Ic choose-client
1020 .Op Fl t Ar target-window
1021 .Op Ar template
1023 Put a window into client choice mode, allowing a client to be selected
1024 interactively from a list.
1025 After a client is chosen,
1026 .Ql %%
1027 is replaced by the client
1028 .Xr pty 4
1029 path in
1030 .Ar template
1031 and the result executed as a command.
1033 .Ar template
1034 is not given, "detach-client -t '%%'" is used.
1035 This command works only from inside
1036 .Nm .
1037 .It Xo
1038 .Ic choose-session
1039 .Op Fl t Ar target-window
1040 .Op Ar template
1042 Put a window into session choice mode, where a session may be selected
1043 interactively from a list.
1044 When one is chosen,
1045 .Ql %%
1046 is replaced by the session name in
1047 .Ar template
1048 and the result executed as a command.
1050 .Ar template
1051 is not given, "switch-client -t '%%'" is used.
1052 This command works only from inside
1053 .Nm .
1054 .It Xo
1055 .Ic choose-window
1056 .Op Fl t Ar target-window
1057 .Op Ar template
1059 Put a window into window choice mode, where a window may be chosen
1060 interactively from a list.
1061 After a window is selected,
1062 .Ql %%
1063 is replaced by the session name and window index in
1064 .Ar template
1065 and the result executed as a command.
1067 .Ar template
1068 is not given, "select-window -t '%%'" is used.
1069 This command works only from inside
1070 .Nm .
1071 .It Ic display-panes Op Fl t Ar target-client
1072 .D1 (alias: Ic displayp)
1073 Display a visible indicator of each pane shown by
1074 .Ar target-client .
1075 See the
1076 .Ic display-panes-time ,
1077 .Ic display-panes-colour ,
1079 .Ic display-panes-active-colour
1080 session options.
1081 While the indicator is on screen, a pane may be selected with the
1082 .Ql 0
1084 .Ql 9
1085 keys.
1086 .It Xo Ic find-window
1087 .Op Fl t Ar target-window
1088 .Ar match-string
1090 .D1 (alias: Ic findw )
1091 Search for the
1092 .Xr fnmatch 3
1093 pattern
1094 .Ar match-string
1095 in window names, titles, and visible content (but not history).
1096 If only one window is matched, it'll be automatically selected, otherwise a
1097 choice list is shown.
1098 This command only works from inside
1099 .Nm .
1100 .It Xo Ic join-pane
1101 .Op Fl dhv
1102 .Oo Fl l
1103 .Ar size |
1104 .Fl p Ar percentage Oc
1105 .Op Fl s Ar src-pane
1106 .Op Fl t Ar dst-pane
1108 .D1 (alias: Ic joinp )
1109 Like
1110 .Ic split-window ,
1111 but instead of splitting
1112 .Ar dst-pane
1113 and creating a new pane, split it and move
1114 .Ar src-pane
1115 into the space.
1116 This can be used to reverse
1117 .Ic break-pane .
1118 .It Xo Ic kill-pane
1119 .Op Fl a
1120 .Op Fl t Ar target-pane
1122 .D1 (alias: Ic killp )
1123 Destroy the given pane.
1124 If no panes remain in the containing window, it is also destroyed.
1126 .Fl a
1127 option kills all but the pane given with
1128 .Fl t .
1129 .It Ic kill-window Op Fl t Ar target-window
1130 .D1 (alias: Ic killw )
1131 Kill the current window or the window at
1132 .Ar target-window ,
1133 removing it from any sessions to which it is linked.
1134 .It Ic last-pane Op Fl t Ar target-window
1135 .D1 (alias: Ic lastp )
1136 Select the last (previously selected) pane.
1137 .It Ic last-window Op Fl t Ar target-session
1138 .D1 (alias: Ic last )
1139 Select the last (previously selected) window.
1140 If no
1141 .Ar target-session
1142 is specified, select the last window of the current session.
1143 .It Xo Ic link-window
1144 .Op Fl dk
1145 .Op Fl s Ar src-window
1146 .Op Fl t Ar dst-window
1148 .D1 (alias: Ic linkw )
1149 Link the window at
1150 .Ar src-window
1151 to the specified
1152 .Ar dst-window .
1154 .Ar dst-window
1155 is specified and no such window exists, the
1156 .Ar src-window
1157 is linked there.
1159 .Fl k
1160 is given and
1161 .Ar dst-window
1162 exists, it is killed, otherwise an error is generated.
1164 .Fl d
1165 is given, the newly linked window is not selected.
1166 .It Xo Ic list-panes
1167 .Op Fl as
1168 .Op Fl F Ar format
1169 .Op Fl t Ar target
1171 .D1 (alias: Ic lsp )
1173 .Fl a
1174 is given,
1175 .Ar target
1176 is ignored and all panes on the server are listed.
1178 .Fl s
1179 is given,
1180 .Ar target
1181 is a session (or the current session).
1182 If neither is given,
1183 .Ar target
1184 is a window (or the current window).
1185 For the meaning of the
1186 .Fl F
1187 flag, see the
1188 .Sx FORMATS
1189 section.
1190 .It Xo Ic list-windows
1191 .Op Fl a
1192 .Op Fl F Ar format
1193 .Op Fl t Ar target-session
1195 .D1 (alias: Ic lsw )
1197 .Fl a
1198 is given, list all windows on the server.
1199 Otherwise, list windows in the current session or in
1200 .Ar target-session .
1201 For the meaning of the
1202 .Fl F
1203 flag, see the
1204 .Sx FORMATS
1205 section.
1206 .It Xo Ic move-window
1207 .Op Fl dk
1208 .Op Fl s Ar src-window
1209 .Op Fl t Ar dst-window
1211 .D1 (alias: Ic movew )
1212 This is similar to
1213 .Ic link-window ,
1214 except the window at
1215 .Ar src-window
1216 is moved to
1217 .Ar dst-window .
1218 .It Xo Ic new-window
1219 .Op Fl adkP
1220 .Op Fl n Ar window-name
1221 .Op Fl t Ar target-window
1222 .Op Ar shell-command
1224 .D1 (alias: Ic neww )
1225 Create a new window.
1226 With
1227 .Fl a ,
1228 the new window is inserted at the next index up from the specified
1229 .Ar target-window ,
1230 moving windows up if necessary,
1231 otherwise
1232 .Ar target-window
1233 is the new window location.
1236 .Fl d
1237 is given, the session does not make the new window the current window.
1238 .Ar target-window
1239 represents the window to be created; if the target already exists an error is
1240 shown, unless the
1241 .Fl k
1242 flag is used, in which case it is destroyed.
1243 .Ar shell-command
1244 is the command to execute.
1246 .Ar shell-command
1247 is not specified, the value of the
1248 .Ic default-command
1249 option is used.
1251 When the shell command completes, the window closes.
1252 See the
1253 .Ic remain-on-exit
1254 option to change this behaviour.
1257 .Ev TERM
1258 environment variable must be set to
1259 .Dq screen
1260 for all programs running
1261 .Em inside
1262 .Nm .
1263 New windows will automatically have
1264 .Dq TERM=screen
1265 added to their environment, but care must be taken not to reset this in shell
1266 start-up files.
1269 .Fl P
1270 option prints the location of the new window after it has been created.
1271 .It Ic next-layout Op Fl t Ar target-window
1272 .D1 (alias: Ic nextl )
1273 Move a window to the next layout and rearrange the panes to fit.
1274 .It Xo Ic next-window
1275 .Op Fl a
1276 .Op Fl t Ar target-session
1278 .D1 (alias: Ic next )
1279 Move to the next window in the session.
1281 .Fl a
1282 is used, move to the next window with a bell, activity or content alert.
1283 .It Xo Ic pipe-pane
1284 .Op Fl o
1285 .Op Fl t Ar target-pane
1286 .Op Ar shell-command
1288 .D1 (alias: Ic pipep )
1289 Pipe any output sent by the program in
1290 .Ar target-pane
1291 to a shell command.
1292 A pane may only be piped to one command at a time, any existing pipe is
1293 closed before
1294 .Ar shell-command
1295 is executed.
1297 .Ar shell-command
1298 string may contain the special character sequences supported by the
1299 .Ic status-left
1300 option.
1301 If no
1302 .Ar shell-command
1303 is given, the current pipe (if any) is closed.
1306 .Fl o
1307 option only opens a new pipe if no previous pipe exists, allowing a pipe to
1308 be toggled with a single key, for example:
1309 .Bd -literal -offset indent
1310 bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1312 .It Xo Ic previous-layout
1313 .Op Fl t Ar target-window
1315 .D1 (alias: Ic prevl )
1316 Move to the previous layout in the session.
1317 .It Xo Ic previous-window
1318 .Op Fl a
1319 .Op Fl t Ar target-session
1321 .D1 (alias: Ic prev )
1322 Move to the previous window in the session.
1323 With
1324 .Fl a ,
1325 move to the previous window with a bell, activity or content alert.
1326 .It Xo Ic rename-window
1327 .Op Fl t Ar target-window
1328 .Ar new-name
1330 .D1 (alias: Ic renamew )
1331 Rename the current window, or the window at
1332 .Ar target-window
1333 if specified, to
1334 .Ar new-name .
1335 .It Xo Ic resize-pane
1336 .Op Fl DLRU
1337 .Op Fl t Ar target-pane
1338 .Op Ar adjustment
1340 .D1 (alias: Ic resizep )
1341 Resize a pane, upward with
1342 .Fl U
1343 (the default), downward with
1344 .Fl D ,
1345 to the left with
1346 .Fl L
1347 and to the right with
1348 .Fl R .
1350 .Ar adjustment
1351 is given in lines or cells (the default is 1).
1352 .It Xo Ic respawn-pane
1353 .Op Fl k
1354 .Op Fl t Ar target-pane
1355 .Op Ar shell-command
1357 .D1 (alias: Ic respawnp )
1358 Reactivate a pane in which the command has exited (see the
1359 .Ic remain-on-exit
1360 window option).
1362 .Ar shell-command
1363 is not given, the command used when the pane was created is executed.
1364 The pane must be already inactive, unless
1365 .Fl k
1366 is given, in which case any existing command is killed.
1367 .It Xo Ic respawn-window
1368 .Op Fl k
1369 .Op Fl t Ar target-window
1370 .Op Ar shell-command
1372 .D1 (alias: Ic respawnw )
1373 Reactivate a window in which the command has exited (see the
1374 .Ic remain-on-exit
1375 window option).
1377 .Ar shell-command
1378 is not given, the command used when the window was created is executed.
1379 The window must be already inactive, unless
1380 .Fl k
1381 is given, in which case any existing command is killed.
1382 .It Xo Ic rotate-window
1383 .Op Fl DU
1384 .Op Fl t Ar target-window
1386 .D1 (alias: Ic rotatew )
1387 Rotate the positions of the panes within a window, either upward (numerically
1388 lower) with
1389 .Fl U
1390 or downward (numerically higher).
1391 .It Xo Ic select-layout
1392 .Op Fl np
1393 .Op Fl t Ar target-window
1394 .Op Ar layout-name
1396 .D1 (alias: Ic selectl )
1397 Choose a specific layout for a window.
1399 .Ar layout-name
1400 is not given, the last preset layout used (if any) is reapplied.
1401 .Fl n
1403 .Fl p
1404 are equivalent to the
1405 .Ic next-layout
1407 .Ic previous-layout
1408 commands.
1409 .It Xo Ic select-pane
1410 .Op Fl lDLRU
1411 .Op Fl t Ar target-pane
1413 .D1 (alias: Ic selectp )
1414 Make pane
1415 .Ar target-pane
1416 the active pane in window
1417 .Ar target-window .
1418 If one of
1419 .Fl D ,
1420 .Fl L ,
1421 .Fl R ,
1423 .Fl U
1424 is used, respectively the pane below, to the left, to the right, or above the
1425 target pane is used.
1426 .Fl l
1427 is the same as using the
1428 .Ic last-pane
1429 command.
1430 .It Xo Ic select-window
1431 .Op Fl lnp
1432 .Op Fl t Ar target-window
1434 .D1 (alias: Ic selectw )
1435 Select the window at
1436 .Ar target-window .
1437 .Fl l ,
1438 .Fl n
1440 .Fl p
1441 are equivalent to the
1442 .Ic last-window ,
1443 .Ic next-window
1445 .Ic previous-window
1446 commands.
1447 .It Xo Ic split-window
1448 .Op Fl dhvP
1449 .Oo Fl l
1450 .Ar size |
1451 .Fl p Ar percentage Oc
1452 .Op Fl t Ar target-pane
1453 .Op Ar shell-command
1455 .D1 (alias: Ic splitw )
1456 Create a new pane by splitting
1457 .Ar target-pane :
1458 .Fl h
1459 does a horizontal split and
1460 .Fl v
1461 a vertical split; if neither is specified,
1462 .Fl v
1463 is assumed.
1465 .Fl l
1467 .Fl p
1468 options specify the size of the new pane in lines (for vertical split) or in
1469 cells (for horizontal split), or as a percentage, respectively.
1470 All other options have the same meaning as for the
1471 .Ic new-window
1472 command.
1473 .It Xo Ic swap-pane
1474 .Op Fl dDU
1475 .Op Fl s Ar src-pane
1476 .Op Fl t Ar dst-pane
1478 .D1 (alias: Ic swapp )
1479 Swap two panes.
1481 .Fl U
1482 is used and no source pane is specified with
1483 .Fl s ,
1484 .Ar dst-pane
1485 is swapped with the previous pane (before it numerically);
1486 .Fl D
1487 swaps with the next pane (after it numerically).
1488 .Fl d
1489 instructs
1491 not to change the active pane.
1492 .It Xo Ic swap-window
1493 .Op Fl d
1494 .Op Fl s Ar src-window
1495 .Op Fl t Ar dst-window
1497 .D1 (alias: Ic swapw )
1498 This is similar to
1499 .Ic link-window ,
1500 except the source and destination windows are swapped.
1501 It is an error if no window exists at
1502 .Ar src-window .
1503 .It Xo Ic unlink-window
1504 .Op Fl k
1505 .Op Fl t Ar target-window
1507 .D1 (alias: Ic unlinkw )
1508 Unlink
1509 .Ar target-window .
1510 Unless
1511 .Fl k
1512 is given, a window may be unlinked only if it is linked to multiple sessions -
1513 windows may not be linked to no sessions;
1515 .Fl k
1516 is specified and the window is linked to only one session, it is unlinked and
1517 destroyed.
1519 .Sh KEY BINDINGS
1521 allows a command to be bound to most keys, with or without a prefix key.
1522 When specifying keys, most represent themselves (for example
1523 .Ql A
1525 .Ql Z ) .
1526 Ctrl keys may be prefixed with
1527 .Ql C-
1529 .Ql ^ ,
1530 and Alt (meta) with
1531 .Ql M- .
1532 In addition, the following special key names are accepted:
1533 .Em Up ,
1534 .Em Down ,
1535 .Em Left ,
1536 .Em Right ,
1537 .Em BSpace ,
1538 .Em BTab ,
1539 .Em DC
1540 (Delete),
1541 .Em End ,
1542 .Em Enter ,
1543 .Em Escape ,
1544 .Em F1
1546 .Em F20 ,
1547 .Em Home ,
1548 .Em IC
1549 (Insert),
1550 .Em NPage
1551 (Page Up),
1552 .Em PPage
1553 (Page Down),
1554 .Em Space ,
1556 .Em Tab .
1557 Note that to bind the
1558 .Ql \&"
1560 .Ql '
1561 keys, quotation marks are necessary, for example:
1562 .Bd -literal -offset indent
1563 bind-key '"' split-window
1564 bind-key "'" new-window
1567 Commands related to key bindings are as follows:
1568 .Bl -tag -width Ds
1569 .It Xo Ic bind-key
1570 .Op Fl cnr
1571 .Op Fl t Ar key-table
1572 .Ar key Ar command Op Ar arguments
1574 .D1 (alias: Ic bind )
1575 Bind key
1576 .Ar key
1578 .Ar command .
1579 By default (without
1580 .Fl t )
1581 the primary key bindings are modified (those normally activated with the prefix
1582 key); in this case, if
1583 .Fl n
1584 is specified, it is not necessary to use the prefix key,
1585 .Ar command
1586 is bound to
1587 .Ar key
1588 alone.
1590 .Fl r
1591 flag indicates this key may repeat, see the
1592 .Ic repeat-time
1593 option.
1596 .Fl t
1597 is present,
1598 .Ar key
1599 is bound in
1600 .Ar key-table :
1601 the binding for command mode with
1602 .Fl c
1603 or for normal mode without.
1604 To view the default bindings and possible commands, see the
1605 .Ic list-keys
1606 command.
1607 .It Ic list-keys Op Fl t Ar key-table
1608 .D1 (alias: Ic lsk )
1609 List all key bindings.
1610 Without
1611 .Fl t
1612 the primary key bindings - those executed when preceded by the prefix key -
1613 are printed.
1614 Keys bound without the prefix key (see
1615 .Ic bind-key
1616 .Fl n )
1617 are marked with
1618 .Ql (no prefix) .
1620 With
1621 .Fl t ,
1622 the key bindings in
1623 .Ar key-table
1624 are listed; this may be one of:
1625 .Em vi-edit ,
1626 .Em emacs-edit ,
1627 .Em vi-choice ,
1628 .Em emacs-choice ,
1629 .Em vi-copy
1631 .Em emacs-copy .
1632 .It Xo Ic send-keys
1633 .Op Fl t Ar target-pane
1634 .Ar key Ar ...
1636 .D1 (alias: Ic send )
1637 Send a key or keys to a window.
1638 Each argument
1639 .Ar key
1640 is the name of the key (such as
1641 .Ql C-a
1643 .Ql npage
1644 ) to send; if the string is not recognised as a key, it is sent as a series of
1645 characters.
1646 All arguments are sent sequentially from first to last.
1647 .It Ic send-prefix Op Fl t Ar target-pane
1648 Send the prefix key to a window as if it was pressed.
1649 If multiple prefix keys are configured, only the first is sent.
1650 .It Xo Ic unbind-key
1651 .Op Fl acn
1652 .Op Fl t Ar key-table
1653 .Ar key
1655 .D1 (alias: Ic unbind )
1656 Unbind the command bound to
1657 .Ar key .
1658 Without
1659 .Fl t
1660 the primary key bindings are modified; in this case, if
1661 .Fl n
1662 is specified, the command bound to
1663 .Ar key
1664 without a prefix (if any) is removed.
1666 .Fl a
1667 is present, all key bindings are removed.
1670 .Fl t
1671 is present,
1672 .Ar key
1674 .Ar key-table
1675 is unbound: the binding for command mode with
1676 .Fl c
1677 or for normal mode without.
1679 .Sh OPTIONS
1680 The appearance and behaviour of
1682 may be modified by changing the value of various options.
1683 There are three types of option:
1684 .Em server options ,
1685 .Em session options
1687 .Em window options .
1691 server has a set of global options which do not apply to any particular
1692 window or session.
1693 These are altered with the
1694 .Ic set-option
1695 .Fl s
1696 command, or displayed with the
1697 .Ic show-options
1698 .Fl s
1699 command.
1701 In addition, each individual session may have a set of session options, and
1702 there is a separate set of global session options.
1703 Sessions which do not have a particular option configured inherit the value
1704 from the global session options.
1705 Session options are set or unset with the
1706 .Ic set-option
1707 command and may be listed with the
1708 .Ic show-options
1709 command.
1710 The available server and session options are listed under the
1711 .Ic set-option
1712 command.
1714 Similarly, a set of window options is attached to each window, and there is
1715 a set of global window options from which any unset options are inherited.
1716 Window options are altered with the
1717 .Ic set-window-option
1718 command and can be listed with the
1719 .Ic show-window-options
1720 command.
1721 All window options are documented with the
1722 .Ic set-window-option
1723 command.
1725 Commands which set options are as follows:
1726 .Bl -tag -width Ds
1727 .It Xo Ic set-option
1728 .Op Fl agsuw
1729 .Op Fl t Ar target-session | Ar target-window
1730 .Ar option Ar value
1732 .D1 (alias: Ic set )
1733 Set a window option with
1734 .Fl w
1735 (equivalent to the
1736 .Ic set-window-option
1737 command),
1738 a server option with
1739 .Fl s ,
1740 otherwise a session option.
1743 .Fl g
1744 is specified, the global session or window option is set.
1745 With
1746 .Fl a ,
1747 and if the option expects a string,
1748 .Ar value
1749 is appended to the existing setting.
1751 .Fl u
1752 flag unsets an option, so a session inherits the option from the global
1753 options.
1754 It is not possible to unset a global option.
1756 Available window options are listed under
1757 .Ic set-window-option .
1759 Available server options are:
1760 .Bl -tag -width Ds
1761 .It Ic buffer-limit Ar number
1762 Set the number of buffers; as new buffers are added to the top of the stack,
1763 old ones are removed from the bottom if necessary to maintain this maximum
1764 length.
1765 .It Ic escape-time Ar time
1766 Set the time in milliseconds for which
1768 waits after an escape is input to determine if it is part of a function or meta
1769 key sequences.
1770 The default is 500 milliseconds.
1771 .It Xo Ic exit-unattached
1772 .Op Ic on | off
1774 If enabled, the server will exit when there are no attached clients.
1775 .It Xo Ic quiet
1776 .Op Ic on | off
1778 Enable or disable the display of various informational messages (see also the
1779 .Fl q
1780 command line flag).
1781 .It Xo Ic set-clipboard
1782 .Op Ic on | off
1784 Attempt to set the terminal clipboard content using the
1785 \ee]52;...\e007
1786 .Xr xterm 1
1787 escape sequences.
1788 This option is on by default if there is an
1789 .Em \&Ms
1790 entry in the
1791 .Xr terminfo 5
1792 description for the client terminal.
1793 Note that this feature needs to be enabled in
1794 .Xr xterm 1
1795 by setting the resource:
1796 .Bd -literal -offset indent
1797 disallowedWindowOps: 20,21,SetXprop
1800 Or changing this property from the
1801 .Xr xterm 1
1802 interactive menu when required.
1805 Available session options are:
1806 .Bl -tag -width Ds
1807 .It Ic base-index Ar index
1808 Set the base index from which an unused index should be searched when a new
1809 window is created.
1810 The default is zero.
1811 .It Xo Ic bell-action
1812 .Op Ic any | none | current
1814 Set action on window bell.
1815 .Ic any
1816 means a bell in any window linked to a session causes a bell in the current
1817 window of that session,
1818 .Ic none
1819 means all bells are ignored and
1820 .Ic current
1821 means only bell in windows other than the current window are ignored.
1822 .It Xo Ic bell-on-alert
1823 .Op Ic on | off
1825 If on, ring the terminal bell when an activity, content or silence alert
1826 occurs.
1827 .It Ic default-command Ar shell-command
1828 Set the command used for new windows (if not specified when the window is
1829 created) to
1830 .Ar shell-command ,
1831 which may be any
1832 .Xr sh 1
1833 command.
1834 The default is an empty string, which instructs
1836 to create a login shell using the value of the
1837 .Ic default-shell
1838 option.
1839 .It Ic default-path Ar path
1840 Set the default working directory for processes created from keys, or
1841 interactively from the prompt.
1842 The default is empty, which means to use the working directory of the shell
1843 from which the server was started if it is available or the user's home if not.
1844 .It Ic default-shell Ar path
1845 Specify the default shell.
1846 This is used as the login shell for new windows when the
1847 .Ic default-command
1848 option is set to empty, and must be the full path of the executable.
1849 When started
1851 tries to set a default value from the first suitable of the
1852 .Ev SHELL
1853 environment variable, the shell returned by
1854 .Xr getpwuid 3 ,
1856 .Pa /bin/sh .
1857 This option should be configured when
1859 is used as a login shell.
1860 .It Ic default-terminal Ar terminal
1861 Set the default terminal for new windows created in this session - the
1862 default value of the
1863 .Ev TERM
1864 environment variable.
1867 to work correctly, this
1868 .Em must
1869 be set to
1870 .Ql screen
1871 or a derivative of it.
1872 .It Xo Ic destroy-unattached
1873 .Op Ic on | off
1875 If enabled and the session is no longer attached to any clients, it is
1876 destroyed.
1877 .It Xo Ic detach-on-destroy
1878 .Op Ic on | off
1880 If on (the default), the client is detached when the session it is attached to
1881 is destroyed.
1882 If off, the client is switched to the most recently active of the remaining
1883 sessions.
1884 .It Ic display-panes-active-colour Ar colour
1885 Set the colour used by the
1886 .Ic display-panes
1887 command to show the indicator for the active pane.
1888 .It Ic display-panes-colour Ar colour
1889 Set the colour used by the
1890 .Ic display-panes
1891 command to show the indicators for inactive panes.
1892 .It Ic display-panes-time Ar time
1893 Set the time in milliseconds for which the indicators shown by the
1894 .Ic display-panes
1895 command appear.
1896 .It Ic display-time Ar time
1897 Set the amount of time for which status line messages and other on-screen
1898 indicators are displayed.
1899 .Ar time
1900 is in milliseconds.
1901 .It Ic history-limit Ar lines
1902 Set the maximum number of lines held in window history.
1903 This setting applies only to new windows - existing window histories are not
1904 resized and retain the limit at the point they were created.
1905 .It Ic lock-after-time Ar number
1906 Lock the session (like the
1907 .Ic lock-session
1908 command) after
1909 .Ar number
1910 seconds of inactivity, or the entire server (all sessions) if the
1911 .Ic lock-server
1912 option is set.
1913 The default is not to lock (set to 0).
1914 .It Ic lock-command Ar shell-command
1915 Command to run when locking each client.
1916 The default is to run
1917 .Xr lock 1
1918 with
1919 .Fl np .
1920 .It Xo Ic lock-server
1921 .Op Ic on | off
1923 If this option is
1924 .Ic on
1925 (the default),
1926 instead of each session locking individually as each has been
1927 idle for
1928 .Ic lock-after-time ,
1929 the entire server will lock after
1930 .Em all
1931 sessions would have locked.
1932 This has no effect as a session option; it must be set as a global option.
1933 .It Ic message-attr Ar attributes
1934 Set status line message attributes, where
1935 .Ar attributes
1936 is either
1937 .Ic none
1938 or a comma-delimited list of one or more of:
1939 .Ic bright
1941 .Ic bold ) ,
1942 .Ic dim ,
1943 .Ic underscore ,
1944 .Ic blink ,
1945 .Ic reverse ,
1946 .Ic hidden ,
1948 .Ic italics .
1949 .It Ic message-bg Ar colour
1950 Set status line message background colour, where
1951 .Ar colour
1952 is one of:
1953 .Ic black ,
1954 .Ic red ,
1955 .Ic green ,
1956 .Ic yellow ,
1957 .Ic blue ,
1958 .Ic magenta ,
1959 .Ic cyan ,
1960 .Ic white ,
1961 .Ic colour0
1963 .Ic colour255
1964 from the 256-colour set,
1965 .Ic default ,
1966 or a hexadecimal RGB string such as
1967 .Ql #ffffff ,
1968 which chooses the closest match from the default 256-colour set.
1969 .It Ic message-fg Ar colour
1970 Set status line message foreground colour.
1971 .It Ic message-limit Ar number
1972 Set the number of error or information messages to save in the message log for
1973 each client.
1974 The default is 20.
1975 .It Xo Ic mouse-resize-pane
1976 .Op Ic on | off
1978 If on,
1980 captures the mouse and allows panes to be resized by dragging on their borders.
1981 .It Xo Ic mouse-select-pane
1982 .Op Ic on | off
1984 If on,
1986 captures the mouse and when a window is split into multiple panes the mouse may
1987 be used to select the current pane.
1988 The mouse click is also passed through to the application as normal.
1989 .It Xo Ic mouse-select-window
1990 .Op Ic on | off
1992 If on, clicking the mouse on a window name in the status line will select that
1993 window.
1994 .It Xo Ic mouse-utf8
1995 .Op Ic on | off
1997 If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1998 .It Ic pane-active-border-bg Ar colour
1999 .It Ic pane-active-border-fg Ar colour
2000 Set the pane border colour for the currently active pane.
2001 .It Ic pane-border-bg Ar colour
2002 .It Ic pane-border-fg Ar colour
2003 Set the pane border colour for panes aside from the active pane.
2004 .It Ic prefix Ar keys
2005 Set the keys accepted as a prefix key.
2006 .Ar keys
2007 is a comma-separated list of key names, each of which individually behave as
2008 the prefix key.
2009 .It Ic repeat-time Ar time
2010 Allow multiple commands to be entered without pressing the prefix-key again
2011 in the specified
2012 .Ar time
2013 milliseconds (the default is 500).
2014 Whether a key repeats may be set when it is bound using the
2015 .Fl r
2016 flag to
2017 .Ic bind-key .
2018 Repeat is enabled for the default keys bound to the
2019 .Ic resize-pane
2020 command.
2021 .It Xo Ic set-remain-on-exit
2022 .Op Ic on | off
2024 Set the
2025 .Ic remain-on-exit
2026 window option for any windows first created in this session.
2027 When this option is true, windows in which the running program has
2028 exited do not close, instead remaining open but inactivate.
2029 Use the
2030 .Ic respawn-window
2031 command to reactivate such a window, or the
2032 .Ic kill-window
2033 command to destroy it.
2034 .It Xo Ic set-titles
2035 .Op Ic on | off
2037 Attempt to set the window title using the \ee]2;...\e007 xterm code if
2038 the terminal appears to be an xterm.
2039 This option is off by default.
2040 Note that elinks
2041 will only attempt to set the window title if the STY environment
2042 variable is set.
2043 .It Ic set-titles-string Ar string
2044 String used to set the window title if
2045 .Ic set-titles
2046 is on.
2047 Character sequences are replaced as for the
2048 .Ic status-left
2049 option.
2050 .It Xo Ic status
2051 .Op Ic on | off
2053 Show or hide the status line.
2054 .It Ic status-attr Ar attributes
2055 Set status line attributes.
2056 .It Ic status-bg Ar colour
2057 Set status line background colour.
2058 .It Ic status-fg Ar colour
2059 Set status line foreground colour.
2060 .It Ic status-interval Ar interval
2061 Update the status bar every
2062 .Ar interval
2063 seconds.
2064 By default, updates will occur every 15 seconds.
2065 A setting of zero disables redrawing at interval.
2066 .It Xo Ic status-justify
2067 .Op Ic left | centre | right
2069 Set the position of the window list component of the status line: left, centre
2070 or right justified.
2071 .It Xo Ic status-keys
2072 .Op Ic vi | emacs
2074 Use vi or emacs-style
2075 key bindings in the status line, for example at the command prompt.
2076 The default is emacs, unless the
2077 .Ev VISUAL
2079 .Ev EDITOR
2080 environment variables are set and contain the string
2081 .Ql vi .
2082 .It Ic status-left Ar string
2083 Display
2084 .Ar string
2085 to the left of the status bar.
2086 .Ar string
2087 will be passed through
2088 .Xr strftime 3
2089 before being used.
2090 By default, the session name is shown.
2091 .Ar string
2092 may contain any of the following special character sequences:
2093 .Bl -column "Character pair" "Replaced with" -offset indent
2094 .It Sy "Character pair" Ta Sy "Replaced with"
2095 .It Li "#(shell-command)" Ta "First line of the command's output"
2096 .It Li "#[attributes]" Ta "Colour or attribute change"
2097 .It Li "#H" Ta "Hostname of local host"
2098 .It Li "#h" Ta "Hostname of local host without the domain name"
2099 .It Li "#F" Ta "Current window flag"
2100 .It Li "#I" Ta "Current window index"
2101 .It Li "#P" Ta "Current pane index"
2102 .It Li "#S" Ta "Session name"
2103 .It Li "#T" Ta "Current window title"
2104 .It Li "#W" Ta "Current window name"
2105 .It Li "##" Ta "A literal" Ql #
2108 The #(shell-command) form executes
2109 .Ql shell-command
2110 and inserts the first line of its output.
2111 Note that shell commands are only executed once at the interval specified by
2113 .Ic status-interval
2114 option: if the status line is redrawn in the meantime, the previous result is
2115 used.
2116 Shell commands are executed with the
2118 global environment set (see the
2119 .Sx ENVIRONMENT
2120 section).
2122 The window title (#T) is the title set by the program running within the window
2123 using the OSC title setting sequence, for example:
2124 .Bd -literal -offset indent
2125 $ printf '\e033]2;My Title\e033\e\e'
2128 When a window is first created, its title is the hostname.
2130 #[attributes] allows a comma-separated list of attributes to be specified,
2131 these may be
2132 .Ql fg=colour
2133 to set the foreground colour,
2134 .Ql bg=colour
2135 to set the background colour, the name of one of the attributes (listed under
2137 .Ic message-attr
2138 option) to turn an attribute on, or an attribute prefixed with
2139 .Ql no
2140 to turn one off, for example
2141 .Ic nobright .
2142 Examples are:
2143 .Bd -literal -offset indent
2144 #(sysctl vm.loadavg)
2145 #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2148 Where appropriate, special character sequences may be prefixed with a number to
2149 specify the maximum length, for example
2150 .Ql #24T .
2152 By default, UTF-8 in
2153 .Ar string
2154 is not interpreted, to enable UTF-8, use the
2155 .Ic status-utf8
2156 option.
2157 .It Ic status-left-attr Ar attributes
2158 Set the attribute of the left part of the status line.
2159 .It Ic status-left-bg Ar colour
2160 Set the background colour of the left part of the status line.
2161 .It Ic status-left-fg Ar colour
2162 Set the foreground colour of the left part of the status line.
2163 .It Ic status-left-length Ar length
2164 Set the maximum
2165 .Ar length
2166 of the left component of the status bar.
2167 The default is 10.
2168 .It Ic status-right Ar string
2169 Display
2170 .Ar string
2171 to the right of the status bar.
2172 By default, the current window title in double quotes, the date and the time
2173 are shown.
2174 As with
2175 .Ic status-left ,
2176 .Ar string
2177 will be passed to
2178 .Xr strftime 3 ,
2179 character pairs are replaced, and UTF-8 is dependent on the
2180 .Ic status-utf8
2181 option.
2182 .It Ic status-right-attr Ar attributes
2183 Set the attribute of the right part of the status line.
2184 .It Ic status-right-bg Ar colour
2185 Set the background colour of the right part of the status line.
2186 .It Ic status-right-fg Ar colour
2187 Set the foreground colour of the right part of the status line.
2188 .It Ic status-right-length Ar length
2189 Set the maximum
2190 .Ar length
2191 of the right component of the status bar.
2192 The default is 40.
2193 .It Xo Ic status-utf8
2194 .Op Ic on | off
2196 Instruct
2198 to treat top-bit-set characters in the
2199 .Ic status-left
2201 .Ic status-right
2202 strings as UTF-8; notably, this is important for wide characters.
2203 This option defaults to off.
2204 .It Ic terminal-overrides Ar string
2205 Contains a list of entries which override terminal descriptions read using
2206 .Xr terminfo 5 .
2207 .Ar string
2208 is a comma-separated list of items each a colon-separated string made up of a
2209 terminal type pattern (matched using
2210 .Xr fnmatch 3 )
2211 and a set of
2212 .Em name=value
2213 entries.
2215 For example, to set the
2216 .Ql clear
2217 .Xr terminfo 5
2218 entry to
2219 .Ql \ee[H\ee[2J
2220 for all terminal types and the
2221 .Ql dch1
2222 entry to
2223 .Ql \ee[P
2224 for the
2225 .Ql rxvt
2226 terminal type, the option could be set to the string:
2227 .Bd -literal -offset indent
2228 "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2231 The terminal entry value is passed through
2232 .Xr strunvis 3
2233 before interpretation.
2234 The default value forcibly corrects the
2235 .Ql colors
2236 entry for terminals which support 88 or 256 colours:
2237 .Bd -literal -offset indent
2238 "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
2240 .It Ic update-environment Ar variables
2241 Set a space-separated string containing a list of environment variables to be
2242 copied into the session environment when a new session is created or an
2243 existing session is attached.
2244 Any variables that do not exist in the source environment are set to be
2245 removed from the session environment (as if
2246 .Fl r
2247 was given to the
2248 .Ic set-environment
2249 command).
2250 The default is
2251 "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2252 XAUTHORITY".
2253 .It Xo Ic visual-activity
2254 .Op Ic on | off
2256 If on, display a status line message when activity occurs in a window
2257 for which the
2258 .Ic monitor-activity
2259 window option is enabled.
2260 .It Xo Ic visual-bell
2261 .Op Ic on | off
2263 If this option is on, a message is shown on a bell instead of it being passed
2264 through to the terminal (which normally makes a sound).
2265 Also see the
2266 .Ic bell-action
2267 option.
2268 .It Xo Ic visual-content
2269 .Op Ic on | off
2271 Like
2272 .Ic visual-activity ,
2273 display a message when content is present in a window
2274 for which the
2275 .Ic monitor-content
2276 window option is enabled.
2277 .It Xo Ic visual-silence
2278 .Op Ic on | off
2281 .Ic monitor-silence
2282 is enabled, prints a message after the interval has expired on a given window.
2284 .It Xo Ic set-window-option
2285 .Op Fl agu
2286 .Op Fl t Ar target-window
2287 .Ar option Ar value
2289 .D1 (alias: Ic setw )
2290 Set a window option.
2292 .Fl a ,
2293 .Fl g
2295 .Fl u
2296 flags work similarly to the
2297 .Ic set-option
2298 command.
2300 Supported window options are:
2302 .Bl -tag -width Ds -compact
2303 .It Xo Ic aggressive-resize
2304 .Op Ic on | off
2306 Aggressively resize the chosen window.
2307 This means that
2309 will resize the window to the size of the smallest session for which it is the
2310 current window, rather than the smallest session to which it is attached.
2311 The window may resize when the current window is changed on another sessions;
2312 this option is good for full-screen programs which support
2313 .Dv SIGWINCH
2314 and poor for interactive programs such as shells.
2316 .It Xo Ic alternate-screen
2317 .Op Ic on | off
2319 This option configures whether programs running inside
2321 may use the terminal alternate screen feature, which allows the
2322 .Em smcup
2324 .Em rmcup
2325 .Xr terminfo 5
2326 capabilities.
2327 The alternate screen feature preserves the contents of the window when an
2328 interactive application starts and restores it on exit, so that any output
2329 visible before the application starts reappears unchanged after it exits.
2330 The default is on.
2332 .It Xo Ic automatic-rename
2333 .Op Ic on | off
2335 Control automatic window renaming.
2336 When this setting is enabled,
2338 will attempt - on supported platforms - to rename the window to reflect the
2339 command currently running in it.
2340 This flag is automatically disabled for an individual window when a name
2341 is specified at creation with
2342 .Ic new-window
2344 .Ic new-session ,
2345 or later with
2346 .Ic rename-window .
2347 It may be switched off globally with:
2348 .Bd -literal -offset indent
2349 set-window-option -g automatic-rename off
2352 .It Ic clock-mode-colour Ar colour
2353 Set clock colour.
2355 .It Xo Ic clock-mode-style
2356 .Op Ic 12 | 24
2358 Set clock hour format.
2360 .It Ic force-height Ar height
2361 .It Ic force-width Ar width
2362 Prevent
2364 from resizing a window to greater than
2365 .Ar width
2367 .Ar height .
2368 A value of zero restores the default unlimited setting.
2370 .It Ic main-pane-height Ar height
2371 .It Ic main-pane-width Ar width
2372 Set the width or height of the main (left or top) pane in the
2373 .Ic main-horizontal
2375 .Ic main-vertical
2376 layouts.
2378 .It Ic mode-attr Ar attributes
2379 Set window modes attributes.
2381 .It Ic mode-bg Ar colour
2382 Set window modes background colour.
2384 .It Ic mode-fg Ar colour
2385 Set window modes foreground colour.
2387 .It Xo Ic mode-keys
2388 .Op Ic vi | emacs
2390 Use vi or emacs-style key bindings in copy and choice modes.
2391 As with the
2392 .Ic status-keys
2393 option, the default is emacs, unless
2394 .Ev VISUAL
2396 .Ev EDITOR
2397 contains
2398 .Ql vi .
2400 .It Xo Ic mode-mouse
2401 .Op Ic on | off | copy-mode
2403 Mouse state in modes.
2404 If on, the mouse may be used to enter copy mode and copy a selection by
2405 dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2406 option in choice mode.
2407 If set to
2408 .Em copy-mode ,
2409 the mouse behaves as set to on, but cannot be used to enter copy
2410 mode.
2412 .It Xo Ic monitor-activity
2413 .Op Ic on | off
2415 Monitor for activity in the window.
2416 Windows with activity are highlighted in the status line.
2418 .It Ic monitor-content Ar match-string
2419 Monitor content in the window.
2420 When
2421 .Xr fnmatch 3
2422 pattern
2423 .Ar match-string
2424 appears in the window, it is highlighted in the status line.
2426 .It Xo Ic monitor-silence
2427 .Op Ic interval
2429 Monitor for silence (no activity) in the window within
2430 .Ic interval
2431 seconds.
2432 Windows that have been silent for the interval are highlighted in the
2433 status line.
2434 An interval of zero disables the monitoring.
2436 .It Ic other-pane-height Ar height
2437 Set the height of the other panes (not the main pane) in the
2438 .Ic main-horizontal
2439 layout.
2440 If this option is set to 0 (the default), it will have no effect.
2441 If both the
2442 .Ic main-pane-height
2444 .Ic other-pane-height
2445 options are set, the main pane will grow taller to make the other panes the
2446 specified height, but will never shrink to do so.
2448 .It Ic other-pane-width Ar width
2449 Like
2450 .Ic other-pane-height ,
2451 but set the width of other panes in the
2452 .Ic main-vertical
2453 layout.
2455 .It Ic pane-base-index Ar index
2456 Like
2457 .Ic base-index ,
2458 but set the starting index for pane numbers.
2460 .It Xo Ic remain-on-exit
2461 .Op Ic on | off
2463 A window with this flag set is not destroyed when the program running in it
2464 exits.
2465 The window may be reactivated with the
2466 .Ic respawn-window
2467 command.
2469 .It Xo Ic synchronize-panes
2470 .Op Ic on | off
2472 Duplicate input to any pane to all other panes in the same window (only
2473 for panes that are not in any special mode).
2475 .It Xo Ic utf8
2476 .Op Ic on | off
2478 Instructs
2480 to expect UTF-8 sequences to appear in this window.
2482 .It Ic window-status-alert-attr Ar attributes
2483 Set status line attributes for windows which have an alert (bell, activity
2484 or content).
2486 .It Ic window-status-alert-bg Ar colour
2487 Set status line background colour for windows with an alert.
2489 .It Ic window-status-alert-fg Ar colour
2490 Set status line foreground colour for windows with an alert.
2492 .It Ic window-status-attr Ar attributes
2493 Set status line attributes for a single window.
2495 .It Ic window-status-bg Ar colour
2496 Set status line background colour for a single window.
2498 .It Ic window-status-current-attr Ar attributes
2499 Set status line attributes for the currently active window.
2501 .It Ic window-status-current-bg Ar colour
2502 Set status line background colour for the currently active window.
2504 .It Ic window-status-current-fg Ar colour
2505 Set status line foreground colour for the currently active window.
2507 .It Ic window-status-current-format Ar string
2508 Like
2509 .Ar window-status-format ,
2510 but is the format used when the window is the current window.
2512 .It Ic window-status-fg Ar colour
2513 Set status line foreground colour for a single window.
2515 .It Ic window-status-format Ar string
2516 Set the format in which the window is displayed in the status line window list.
2517 See the
2518 .Ar status-left
2519 option for details of special character sequences available.
2520 The default is
2521 .Ql #I:#W#F .
2523 .It Ic word-separators Ar string
2524 Sets the window's conception of what characters are considered word
2525 separators, for the purposes of the next and previous word commands in
2526 copy mode.
2527 The default is
2528 .Ql \ -_@ .
2530 .It Xo Ic xterm-keys
2531 .Op Ic on | off
2533 If this option is set,
2535 will generate
2536 .Xr xterm 1 -style
2537 function key sequences; these have a number included to indicate modifiers such
2538 as Shift, Alt or Ctrl.
2539 The default is off.
2541 .It Xo Ic show-options
2542 .Op Fl gsw
2543 .Op Fl t Ar target-session | Ar target-window
2545 .D1 (alias: Ic show )
2546 Show the window options with
2547 .Fl w
2548 (equivalent to
2549 .Ic show-window-options ) ,
2550 the server options with
2551 .Fl s ,
2552 otherwise the session options for
2553 .Ar target session .
2554 Global session or window options are listed if
2555 .Fl g
2556 is used.
2557 .It Xo Ic show-window-options
2558 .Op Fl g
2559 .Op Fl t Ar target-window
2561 .D1 (alias: Ic showw )
2562 List the window options for
2563 .Ar target-window ,
2564 or the global window options if
2565 .Fl g
2566 is used.
2568 .Sh FORMATS
2570 .Ic list-clients ,
2571 .Ic list-sessions ,
2572 .Ic list-windows
2574 .Ic list-panes
2575 commands accept the
2576 .Fl F
2577 flag with a
2578 .Ar format
2579 argument.
2580 This is a string which controls the output format of the command.
2581 Special character sequences are replaced as documented under the
2582 .Ic status-left
2583 option and an additional long form is accepted.
2584 Replacement variables are enclosed in
2585 .Ql #{
2587 .Ql } ,
2588 for example
2589 .Ql #{session_name}
2590 is equivalent to
2591 .Ql #S .
2592 Conditionals are also accepted by prefixing with
2593 .Ql \&?
2594 and separating two alternatives with a comma;
2595 if the specified variable exists and is not zero, the first alternative
2596 is chosen, otherwise the second is used.
2597 For example
2598 .Ql #{?session_attached,attached,not attached}
2599 will include the string
2600 .Ql attached
2601 if the session is attached and the string
2602 .Ql not attached
2603 if it is unattached.
2605 The following variables are available, where appropriate:
2606 .Bl -column "session_created_string" "Replaced with" -offset indent
2607 .It Sy "Variable name" Ta Sy "Replaced with"
2608 .It Li "client_activity" Ta "Integer time client last had activity"
2609 .It Li "client_activity_string" Ta "String time client last had activity"
2610 .It Li "client_created" Ta "Integer time client created"
2611 .It Li "client_created_string" Ta "String time client created"
2612 .It Li "client_cwd" Ta "Working directory of client"
2613 .It Li "client_height" Ta "Height of client"
2614 .It Li "client_readonly" Ta "1 if client is readonly"
2615 .It Li "client_termname" Ta "Terminal name of client"
2616 .It Li "client_tty" Ta "Pseudo terminal of client"
2617 .It Li "client_utf8" Ta "1 if client supports utf8"
2618 .It Li "client_width" Ta "Width of client"
2619 .It Li "host" Ta "Hostname of local host"
2620 .It Li "line" Ta "Line number in the list"
2621 .It Li "pane_active" Ta "1 if active pane"
2622 .It Li "pane_dead" Ta "1 if pane is dead"
2623 .It Li "pane_height" Ta "Height of pane"
2624 .It Li "pane_id" Ta "Unique pane id"
2625 .It Li "pane_pid" Ta "PID of first process in pane"
2626 .It Li "pane_start_command" Ta "Command pane started with"
2627 .It Li "pane_start_path" Ta "Path pane started with"
2628 .It Li "pane_title" Ta "Title of pane"
2629 .It Li "pane_tty" Ta "Pseudo terminal of pane"
2630 .It Li "pane_width" Ta "Width of pane"
2631 .It Li "session_attached" Ta "1 if session attached"
2632 .It Li "session_created" Ta "Integer time session created"
2633 .It Li "session_created_string" Ta "String time session created"
2634 .It Li "session_group" Ta "Number of session group"
2635 .It Li "session_grouped" Ta "1 if session in a group"
2636 .It Li "session_height" Ta "Height of session"
2637 .It Li "session_name" Ta "Name of session"
2638 .It Li "session_width" Ta "Width of session"
2639 .It Li "session_windows" Ta "Number of windows in session"
2640 .It Li "window_active" Ta "1 if window active"
2641 .It Li "window_flags" Ta "Window flags"
2642 .It Li "window_height" Ta "Height of window"
2643 .It Li "window_index" Ta "Index of window"
2644 .It Li "window_layout" Ta "Window layout description"
2645 .It Li "window_name" Ta "Name of window"
2646 .It Li "window_width" Ta "Width of window"
2648 .Sh ENVIRONMENT
2649 When the server is started,
2651 copies the environment into the
2652 .Em global environment ;
2653 in addition, each session has a
2654 .Em session environment .
2655 When a window is created, the session and global environments are merged.
2656 If a variable exists in both, the value from the session environment is used.
2657 The result is the initial environment passed to the new process.
2660 .Ic update-environment
2661 session option may be used to update the session environment from the client
2662 when a new session is created or an old reattached.
2664 also initialises the
2665 .Ev TMUX
2666 variable with some internal information to allow commands to be executed
2667 from inside, and the
2668 .Ev TERM
2669 variable with the correct terminal setting of
2670 .Ql screen .
2672 Commands to alter and view the environment are:
2673 .Bl -tag -width Ds
2674 .It Xo Ic set-environment
2675 .Op Fl gru
2676 .Op Fl t Ar target-session
2677 .Ar name Op Ar value
2679 .D1 (alias: Ic setenv )
2680 Set or unset an environment variable.
2682 .Fl g
2683 is used, the change is made in the global environment; otherwise, it is applied
2684 to the session environment for
2685 .Ar target-session .
2687 .Fl u
2688 flag unsets a variable.
2689 .Fl r
2690 indicates the variable is to be removed from the environment before starting a
2691 new process.
2692 .It Xo Ic show-environment
2693 .Op Fl g
2694 .Op Fl t Ar target-session
2696 .D1 (alias: Ic showenv )
2697 Display the environment for
2698 .Ar target-session
2699 or the global environment with
2700 .Fl g .
2701 Variables removed from the environment are prefixed with
2702 .Ql - .
2704 .Sh STATUS LINE
2706 includes an optional status line which is displayed in the bottom line of each
2707 terminal.
2708 By default, the status line is enabled (it may be disabled with the
2709 .Ic status
2710 session option) and contains, from left-to-right: the name of the current
2711 session in square brackets; the window list; the current window title in double
2712 quotes; and the time and date.
2714 The status line is made of three parts: configurable left and right sections
2715 (which may contain dynamic content such as the time or output from a shell
2716 command, see the
2717 .Ic status-left ,
2718 .Ic status-left-length ,
2719 .Ic status-right ,
2721 .Ic status-right-length
2722 options below), and a central window list.
2723 By default, the window list shows the index, name and (if any) flag of the
2724 windows present in the current session in ascending numerical order.
2725 It may be customised with the
2726 .Ar window-status-format
2728 .Ar window-status-current-format
2729 options.
2730 The flag is one of the following symbols appended to the window name:
2731 .Bl -column "Symbol" "Meaning" -offset indent
2732 .It Sy "Symbol" Ta Sy "Meaning"
2733 .It Li "*" Ta "Denotes the current window."
2734 .It Li "-" Ta "Marks the last window (previously selected)."
2735 .It Li "#" Ta "Window is monitored and activity has been detected."
2736 .It Li "!" Ta "A bell has occurred in the window."
2737 .It Li "+" Ta "Window is monitored for content and it has appeared."
2738 .It Li "~" Ta "The window has been silent for the monitor-silence interval."
2741 The # symbol relates to the
2742 .Ic monitor-activity
2743 and + to the
2744 .Ic monitor-content
2745 window options.
2746 The window name is printed in inverted colours if an alert (bell, activity or
2747 content) is present.
2749 The colour and attributes of the status line may be configured, the entire
2750 status line using the
2751 .Ic status-attr ,
2752 .Ic status-fg
2754 .Ic status-bg
2755 session options and individual windows using the
2756 .Ic window-status-attr ,
2757 .Ic window-status-fg
2759 .Ic window-status-bg
2760 window options.
2762 The status line is automatically refreshed at interval if it has changed, the
2763 interval may be controlled with the
2764 .Ic status-interval
2765 session option.
2767 Commands related to the status line are as follows:
2768 .Bl -tag -width Ds
2769 .It Xo Ic command-prompt
2770 .Op Fl I Ar inputs
2771 .Op Fl p Ar prompts
2772 .Op Fl t Ar target-client
2773 .Op Ar template
2775 Open the command prompt in a client.
2776 This may be used from inside
2778 to execute commands interactively.
2781 .Ar template
2782 is specified, it is used as the command.
2783 If present,
2784 .Fl I
2785 is a comma-separated list of the initial text for each prompt.
2787 .Fl p
2788 is given,
2789 .Ar prompts
2790 is a comma-separated list of prompts which are displayed in order; otherwise
2791 a single prompt is displayed, constructed from
2792 .Ar template
2793 if it is present, or
2794 .Ql \&:
2795 if not.
2797 Both
2798 .Ar inputs
2800 .Ar prompts
2801 may contain the special character sequences supported by the
2802 .Ic status-left
2803 option.
2805 Before the command is executed, the first occurrence of the string
2806 .Ql %%
2807 and all occurrences of
2808 .Ql %1
2809 are replaced by the response to the first prompt, the second
2810 .Ql %%
2811 and all
2812 .Ql %2
2813 are replaced with the response to the second prompt, and so on for further
2814 prompts.
2815 Up to nine prompt responses may be replaced
2817 .Ql %1
2819 .Ql %9
2820 .Pc .
2821 .It Xo Ic confirm-before
2822 .Op Fl p Ar prompt
2823 .Op Fl t Ar target-client
2824 .Ar command
2826 .D1 (alias: Ic confirm )
2827 Ask for confirmation before executing
2828 .Ar command .
2830 .Fl p
2831 is given,
2832 .Ar prompt
2833 is the prompt to display; otherwise a prompt is constructed from
2834 .Ar command .
2835 It may contain the special character sequences supported by the
2836 .Ic status-left
2837 option.
2839 This command works only from inside
2840 .Nm .
2841 .It Xo Ic display-message
2842 .Op Fl p
2843 .Op Fl c Ar target-client
2844 .Op Fl t Ar target-pane
2845 .Op Ar message
2847 .D1 (alias: Ic display )
2848 Display a message.
2850 .Fl p
2851 is given, the output is printed to stdout, otherwise it is displayed in the
2852 .Ar target-client
2853 status line.
2854 The format of
2855 .Ar message
2856 is as for
2857 .Ic status-left ,
2858 with the exception that #() are not handled; information is taken from
2859 .Ar target-pane
2861 .Fl t
2862 is given, otherwise the active pane for the session attached to
2863 .Ar target-client .
2865 .Sh BUFFERS
2867 maintains a stack of
2868 .Em paste buffers .
2869 Up to the value of the
2870 .Ic buffer-limit
2871 option are kept; when a new buffer is added, the buffer at the bottom of the
2872 stack is removed.
2873 Buffers may be added using
2874 .Ic copy-mode
2875 or the
2876 .Ic set-buffer
2877 command, and pasted into a window using the
2878 .Ic paste-buffer
2879 command.
2881 A configurable history buffer is also maintained for each window.
2882 By default, up to 2000 lines are kept; this can be altered with the
2883 .Ic history-limit
2884 option (see the
2885 .Ic set-option
2886 command above).
2888 The buffer commands are as follows:
2889 .Bl -tag -width Ds
2890 .It Xo
2891 .Ic choose-buffer
2892 .Op Fl t Ar target-window
2893 .Op Ar template
2895 Put a window into buffer choice mode, where a buffer may be chosen
2896 interactively from a list.
2897 After a buffer is selected,
2898 .Ql %%
2899 is replaced by the buffer index in
2900 .Ar template
2901 and the result executed as a command.
2903 .Ar template
2904 is not given, "paste-buffer -b '%%'" is used.
2905 This command works only from inside
2906 .Nm .
2907 .It Ic clear-history Op Fl t Ar target-pane
2908 .D1 (alias: Ic clearhist )
2909 Remove and free the history for the specified pane.
2910 .It Ic delete-buffer Op Fl b Ar buffer-index
2911 .D1 (alias: Ic deleteb )
2912 Delete the buffer at
2913 .Ar buffer-index ,
2914 or the top buffer if not specified.
2915 .It Ic list-buffers
2916 .D1 (alias: Ic lsb )
2917 List the global buffers.
2918 .It Xo Ic load-buffer
2919 .Op Fl b Ar buffer-index
2920 .Ar path
2922 .D1 (alias: Ic loadb )
2923 Load the contents of the specified paste buffer from
2924 .Ar path .
2925 .It Xo Ic paste-buffer
2926 .Op Fl dr
2927 .Op Fl b Ar buffer-index
2928 .Op Fl s Ar separator
2929 .Op Fl t Ar target-pane
2931 .D1 (alias: Ic pasteb )
2932 Insert the contents of a paste buffer into the specified pane.
2933 If not specified, paste into the current one.
2934 With
2935 .Fl d ,
2936 also delete the paste buffer from the stack.
2937 When output, any linefeed (LF) characters in the paste buffer are replaced with
2938 a separator, by default carriage return (CR).
2939 A custom separator may be specified using the
2940 .Fl s
2941 flag.
2943 .Fl r
2944 flag means to do no replacement (equivalent to a separator of LF).
2945 .It Xo Ic save-buffer
2946 .Op Fl a
2947 .Op Fl b Ar buffer-index
2948 .Ar path
2950 .D1 (alias: Ic saveb )
2951 Save the contents of the specified paste buffer to
2952 .Ar path .
2954 .Fl a
2955 option appends to rather than overwriting the file.
2956 .It Xo Ic set-buffer
2957 .Op Fl b Ar buffer-index
2958 .Ar data
2960 .D1 (alias: Ic setb )
2961 Set the contents of the specified buffer to
2962 .Ar data .
2963 .It Xo Ic show-buffer
2964 .Op Fl b Ar buffer-index
2966 .D1 (alias: Ic showb )
2967 Display the contents of the specified buffer.
2969 .Sh MISCELLANEOUS
2970 Miscellaneous commands are as follows:
2971 .Bl -tag -width Ds
2972 .It Ic clock-mode Op Fl t Ar target-pane
2973 Display a large clock.
2974 .It Ic if-shell Ar shell-command command
2975 .D1 (alias: Ic if )
2976 Execute
2977 .Ar command
2979 .Ar shell-command
2980 returns success.
2981 .It Ic lock-server
2982 .D1 (alias: Ic lock )
2983 Lock each client individually by running the command specified by the
2984 .Ic lock-command
2985 option.
2986 .It Ic run-shell Ar shell-command
2987 .D1 (alias: Ic run )
2988 Execute
2989 .Ar shell-command
2990 in the background without creating a window.
2991 After it finishes, any output to stdout is displayed in copy mode.
2992 If the command doesn't return success, the exit status is also displayed.
2993 .It Ic server-info
2994 .D1 (alias: Ic info )
2995 Show server information and terminal details.
2997 .Sh TERMINFO EXTENSIONS
2999 understands some extensions to
3000 .Xr terminfo 5 :
3001 .Bl -tag -width Ds
3002 .It Em Cc , Cr
3003 Set the cursor colour.
3004 The first takes a single string argument and is used to set the colour;
3005 the second takes no arguments and restores the default cursor colour.
3006 If set, a sequence such as this may be used
3007 to change the cursor colour from inside
3008 .Nm :
3009 .Bd -literal -offset indent
3010 $ printf '\e033]12;red\e033\e\e'
3012 .It Em Cs , Csr
3013 Change the cursor style.
3014 If set, a sequence such as this may be used
3015 to change the cursor to an underline:
3016 .Bd -literal -offset indent
3017 $ printf '\e033[4 q'
3021 .Em Csr
3022 is set, it will be used to reset the cursor style instead
3024 .Em Cs .
3025 .It Em \&Ms
3026 This sequence can be used by
3028 to store the current buffer in the host terminal's selection (clipboard).
3029 See the
3030 .Em set-clipboard
3031 option above and the
3032 .Xr xterm 1
3033 man page.
3035 .Sh FILES
3036 .Bl -tag -width "/etc/tmux.confXXX" -compact
3037 .It Pa ~/.tmux.conf
3038 Default
3040 configuration file.
3041 .It Pa /etc/tmux.conf
3042 System-wide configuration file.
3044 .Sh EXAMPLES
3045 To create a new
3047 session running
3048 .Xr vi 1 :
3050 .Dl $ tmux new-session vi
3052 Most commands have a shorter form, known as an alias.
3053 For new-session, this is
3054 .Ic new :
3056 .Dl $ tmux new vi
3058 Alternatively, the shortest unambiguous form of a command is accepted.
3059 If there are several options, they are listed:
3060 .Bd -literal -offset indent
3061 $ tmux n
3062 ambiguous command: n, could be: new-session, new-window, next-window
3065 Within an active session, a new window may be created by typing
3066 .Ql C-b c
3067 (Ctrl
3068 followed by the
3069 .Ql b
3071 followed by the
3072 .Ql c
3073 key).
3075 Windows may be navigated with:
3076 .Ql C-b 0
3077 (to select window 0),
3078 .Ql C-b 1
3079 (to select window 1), and so on;
3080 .Ql C-b n
3081 to select the next window; and
3082 .Ql C-b p
3083 to select the previous window.
3085 A session may be detached using
3086 .Ql C-b d
3087 (or by an external event such as
3088 .Xr ssh 1
3089 disconnection) and reattached with:
3091 .Dl $ tmux attach-session
3093 Typing
3094 .Ql C-b \&?
3095 lists the current key bindings in the current window; up and down may be used
3096 to navigate the list or
3097 .Ql q
3098 to exit from it.
3100 Commands to be run when the
3102 server is started may be placed in the
3103 .Pa ~/.tmux.conf
3104 configuration file.
3105 Common examples include:
3107 Changing the default prefix key:
3108 .Bd -literal -offset indent
3109 set-option -g prefix C-a
3110 unbind-key C-b
3111 bind-key C-a send-prefix
3114 Turning the status line off, or changing its colour:
3115 .Bd -literal -offset indent
3116 set-option -g status off
3117 set-option -g status-bg blue
3120 Setting other options, such as the default command,
3121 or locking after 30 minutes of inactivity:
3122 .Bd -literal -offset indent
3123 set-option -g default-command "exec /bin/ksh"
3124 set-option -g lock-after-time 1800
3127 Creating new key bindings:
3128 .Bd -literal -offset indent
3129 bind-key b set-option status
3130 bind-key / command-prompt "split-window 'exec man %%'"
3131 bind-key S command-prompt "new-window -n %1 'ssh %1'"
3133 .Sh SEE ALSO
3134 .Xr pty 4
3135 .Sh AUTHORS
3136 .An Nicholas Marriott Aq nicm@users.sourceforge.net