Change the way the working directory for new processes is discovered. If
[tmux-openbsd.git] / tmux.1
blob4c09de68e53f2c4383167ae0644a22fd3f6fe38a
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
619 section.
621 .Ar target-session
622 is specified, list only clients connected to that session.
623 .It Ic list-commands
624 .D1 (alias: Ic lscm )
625 List the syntax of all commands supported by
626 .Nm .
627 .It Ic list-sessions Op Fl F Ar format
628 .D1 (alias: Ic ls )
629 List all sessions managed by the server.
630 For the meaning of the
631 .Fl F
632 flag, see the
633 .Sx FORMATS
634 section.
635 .It Ic lock-client Op Fl t Ar target-client
636 .D1 (alias: Ic lockc )
637 Lock
638 .Ar target-client ,
639 see the
640 .Ic lock-server
641 command.
642 .It Ic lock-session Op Fl t Ar target-session
643 .D1 (alias: Ic locks )
644 Lock all clients attached to
645 .Ar target-session .
646 .It Xo Ic new-session
647 .Op Fl d
648 .Op Fl n Ar window-name
649 .Op Fl s Ar session-name
650 .Op Fl t Ar target-session
651 .Op Fl x Ar width
652 .Op Fl y Ar height
653 .Op Ar shell-command
655 .D1 (alias: Ic new )
656 Create a new session with name
657 .Ar session-name .
659 The new session is attached to the current terminal unless
660 .Fl d
661 is given.
662 .Ar window-name
664 .Ar shell-command
665 are the name of and shell command to execute in the initial window.
667 .Fl d
668 is used,
669 .Fl x
671 .Fl y
672 specify the size of the initial window (80 by 24 if not given).
674 If run from a terminal, any
675 .Xr termios 4
676 special characters are saved and used for new windows in the new session.
679 .Fl t
680 is given, the new session is
681 .Em grouped
682 with
683 .Ar target-session .
684 This means they share the same set of windows - all windows from
685 .Ar target-session
686 are linked to the new session and any subsequent new windows or windows being
687 closed are applied to both sessions.
688 The current and previous window and any session options remain independent and
689 either session may be killed without affecting the other.
690 Giving
691 .Fl n
693 .Ar shell-command
694 are invalid if
695 .Fl t
696 is used.
697 .It Xo Ic refresh-client
698 .Op Fl S
699 .Op Fl t Ar target-client
701 .D1 (alias: Ic refresh )
702 Refresh the current client if bound to a key, or a single client if one is given
703 with
704 .Fl t .
706 .Fl S
707 is specified, only update the client's status bar.
708 .It Xo Ic rename-session
709 .Op Fl t Ar target-session
710 .Ar new-name
712 .D1 (alias: Ic rename )
713 Rename the session to
714 .Ar new-name .
715 .It Xo Ic show-messages
716 .Op Fl t Ar target-client
718 .D1 (alias: Ic showmsgs )
719 Any messages displayed on the status line are saved in a per-client message
720 log, up to a maximum of the limit set by the
721 .Ar message-limit
722 session option for the session attached to that client.
723 This command displays the log for
724 .Ar target-client .
725 .It Ic source-file Ar path
726 .D1 (alias: Ic source )
727 Execute commands from
728 .Ar path .
729 .It Ic start-server
730 .D1 (alias: Ic start )
731 Start the
733 server, if not already running, without creating any sessions.
734 .It Xo Ic suspend-client
735 .Op Fl t Ar target-client
737 .D1 (alias: Ic suspendc )
738 Suspend a client by sending
739 .Dv SIGTSTP
740 (tty stop).
741 .It Xo Ic switch-client
742 .Op Fl lnpr
743 .Op Fl c Ar target-client
744 .Op Fl t Ar target-session
746 .D1 (alias: Ic switchc )
747 Switch the current session for client
748 .Ar target-client
750 .Ar target-session .
752 .Fl l ,
753 .Fl n
755 .Fl p
756 is used, the client is moved to the last, next or previous session
757 respectively.
758 .Fl r
759 toggles whether a client is read-only (see the
760 .Ic attach-session
761 command).
763 .Sh WINDOWS AND PANES
766 window may be in one of several modes.
767 The default permits direct access to the terminal attached to the window.
768 The other is copy mode, which permits a section of a window or its
769 history to be copied to a
770 .Em paste buffer
771 for later insertion into another window.
772 This mode is entered with the
773 .Ic copy-mode
774 command, bound to
775 .Ql \&[
776 by default.
777 It is also entered when a command that produces output, such as
778 .Ic list-keys ,
779 is executed from a key binding.
781 The keys available depend on whether emacs or vi mode is selected
782 (see the
783 .Ic mode-keys
784 option).
785 The following keys are supported as appropriate for the mode:
786 .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
787 .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
788 .It Li "Back to indentation" Ta "^" Ta "M-m"
789 .It Li "Bottom of history" Ta "G" Ta "M-<"
790 .It Li "Clear selection" Ta "Escape" Ta "C-g"
791 .It Li "Copy selection" Ta "Enter" Ta "M-w"
792 .It Li "Cursor down" Ta "j" Ta "Down"
793 .It Li "Cursor left" Ta "h" Ta "Left"
794 .It Li "Cursor right" Ta "l" Ta "Right"
795 .It Li "Cursor to bottom line" Ta "L" Ta ""
796 .It Li "Cursor to middle line" Ta "M" Ta "M-r"
797 .It Li "Cursor to top line" Ta "H" Ta "M-R"
798 .It Li "Cursor up" Ta "k" Ta "Up"
799 .It Li "Delete entire line" Ta "d" Ta "C-u"
800 .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
801 .It Li "End of line" Ta "$" Ta "C-e"
802 .It Li "Go to line" Ta ":" Ta "g"
803 .It Li "Half page down" Ta "C-d" Ta "M-Down"
804 .It Li "Half page up" Ta "C-u" Ta "M-Up"
805 .It Li "Jump forward" Ta "f" Ta "f"
806 .It Li "Jump to forward" Ta "t" Ta ""
807 .It Li "Jump backward" Ta "F" Ta "F"
808 .It Li "Jump to backward" Ta "T" Ta ""
809 .It Li "Jump again" Ta ";" Ta ";"
810 .It Li "Jump again in reverse" Ta "," Ta ","
811 .It Li "Next page" Ta "C-f" Ta "Page down"
812 .It Li "Next space" Ta "W" Ta ""
813 .It Li "Next space, end of word" Ta "E" Ta ""
814 .It Li "Next word" Ta "w" Ta ""
815 .It Li "Next word end" Ta "e" Ta "M-f"
816 .It Li "Paste buffer" Ta "p" Ta "C-y"
817 .It Li "Previous page" Ta "C-b" Ta "Page up"
818 .It Li "Previous word" Ta "b" Ta "M-b"
819 .It Li "Previous space" Ta "B" Ta ""
820 .It Li "Quit mode" Ta "q" Ta "Escape"
821 .It Li "Rectangle toggle" Ta "v" Ta "R"
822 .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
823 .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
824 .It Li "Search again" Ta "n" Ta "n"
825 .It Li "Search again in reverse" Ta "N" Ta "N"
826 .It Li "Search backward" Ta "?" Ta "C-r"
827 .It Li "Search forward" Ta "/" Ta "C-s"
828 .It Li "Start of line" Ta "0" Ta "C-a"
829 .It Li "Start selection" Ta "Space" Ta "C-Space"
830 .It Li "Top of history" Ta "g" Ta "M->"
831 .It Li "Transpose chars" Ta "" Ta "C-t"
834 The next and previous word keys use space and the
835 .Ql - ,
836 .Ql _
838 .Ql @
839 characters as word delimiters by default, but this can be adjusted by
840 setting the
841 .Em word-separators
842 session option.
843 Next word moves to the start of the next word, next word end to the end of the
844 next word and previous word to the start of the previous word.
845 The three next and previous space keys work similarly but use a space alone as
846 the word separator.
848 The jump commands enable quick movement within a line.
849 For instance, typing
850 .Ql f
851 followed by
852 .Ql /
853 will move the cursor to the next
854 .Ql /
855 character on the current line.
857 .Ql \&;
858 will then jump to the next occurrence.
860 Commands in copy mode may be prefaced by an optional repeat count.
861 With vi key bindings, a prefix is entered using the number keys; with
862 emacs, the Alt (meta) key and a number begins prefix entry.
863 For example, to move the cursor forward by ten words, use
864 .Ql M-1 0 M-f
865 in emacs mode, and
866 .Ql 10w
867 in vi.
869 When copying the selection, the repeat count indicates the buffer index to
870 replace, if used.
872 Mode key bindings are defined in a set of named tables:
873 .Em vi-edit
875 .Em emacs-edit
876 for keys used when line editing at the command prompt;
877 .Em vi-choice
879 .Em emacs-choice
880 for keys used when choosing from lists (such as produced by the
881 .Ic choose-window
882 command); and
883 .Em vi-copy
885 .Em emacs-copy
886 used in copy mode.
887 The tables may be viewed with the
888 .Ic list-keys
889 command and keys modified or removed with
890 .Ic bind-key
892 .Ic unbind-key .
894 The paste buffer key pastes the first line from the top paste buffer on the
895 stack.
897 The synopsis for the
898 .Ic copy-mode
899 command is:
900 .Bl -tag -width Ds
901 .It Xo Ic copy-mode
902 .Op Fl u
903 .Op Fl t Ar target-pane
905 Enter copy mode.
907 .Fl u
908 option scrolls one page up.
911 Each window displayed by
913 may be split into one or more
914 .Em panes ;
915 each pane takes up a certain area of the display and is a separate terminal.
916 A window may be split into panes using the
917 .Ic split-window
918 command.
919 Windows may be split horizontally (with the
920 .Fl h
921 flag) or vertically.
922 Panes may be resized with the
923 .Ic resize-pane
924 command (bound to
925 .Ql C-up ,
926 .Ql C-down
927 .Ql C-left
929 .Ql C-right
930 by default), the current pane may be changed with the
931 .Ic select-pane
932 command and the
933 .Ic rotate-window
935 .Ic swap-pane
936 commands may be used to swap panes without changing their position.
937 Panes are numbered beginning from zero in the order they are created.
939 A number of preset
940 .Em layouts
941 are available.
942 These may be selected with the
943 .Ic select-layout
944 command or cycled with
945 .Ic next-layout
946 (bound to
947 .Ql Space
948 by default); once a layout is chosen, panes within it may be moved and resized
949 as normal.
951 The following layouts are supported:
952 .Bl -tag -width Ds
953 .It Ic even-horizontal
954 Panes are spread out evenly from left to right across the window.
955 .It Ic even-vertical
956 Panes are spread evenly from top to bottom.
957 .It Ic main-horizontal
958 A large (main) pane is shown at the top of the window and the remaining panes
959 are spread from left to right in the leftover space at the bottom.
960 Use the
961 .Em main-pane-height
962 window option to specify the height of the top pane.
963 .It Ic main-vertical
964 Similar to
965 .Ic main-horizontal
966 but the large pane is placed on the left and the others spread from top to
967 bottom along the right.
968 See the
969 .Em main-pane-width
970 window option.
971 .It Ic tiled
972 Panes are spread out as evenly as possible over the window in both rows and
973 columns.
976 In addition,
977 .Ic select-layout
978 may be used to apply a previously used layout - the
979 .Ic list-windows
980 command displays the layout of each window in a form suitable for use with
981 .Ic select-layout .
982 For example:
983 .Bd -literal -offset indent
984 $ tmux list-windows
985 0: ksh [159x48]
986     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
987 $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
991 automatically adjusts the size of the layout for the current window size.
992 Note that a layout cannot be applied to a window with more panes than that
993 from which the layout was originally defined.
995 Commands related to windows and panes are as follows:
996 .Bl -tag -width Ds
997 .It Xo Ic break-pane
998 .Op Fl d
999 .Op Fl t Ar target-pane
1001 .D1 (alias: Ic breakp )
1002 Break
1003 .Ar target-pane
1004 off from its containing window to make it the only pane in a new window.
1006 .Fl d
1007 is given, the new window does not become the current window.
1008 .It Xo Ic capture-pane
1009 .Op Fl b Ar buffer-index
1010 .Op Fl E Ar end-line
1011 .Op Fl S Ar start-line
1012 .Op Fl t Ar target-pane
1014 .D1 (alias: Ic capturep )
1015 Capture the contents of a pane to the specified buffer, or a new buffer if none
1016 is specified.
1018 .Fl S
1020 .Fl E
1021 specify the starting and ending line numbers, zero is the first line of the
1022 visible pane and negative numbers are lines in the history.
1023 The default is to capture only the visible contents of the pane.
1024 .It Xo
1025 .Ic choose-client
1026 .Op Fl t Ar target-window
1027 .Op Ar template
1029 Put a window into client choice mode, allowing a client to be selected
1030 interactively from a list.
1031 After a client is chosen,
1032 .Ql %%
1033 is replaced by the client
1034 .Xr pty 4
1035 path in
1036 .Ar template
1037 and the result executed as a command.
1039 .Ar template
1040 is not given, "detach-client -t '%%'" is used.
1041 This command works only from inside
1042 .Nm .
1043 .It Xo
1044 .Ic choose-session
1045 .Op Fl t Ar target-window
1046 .Op Ar template
1048 Put a window into session choice mode, where a session may be selected
1049 interactively from a list.
1050 When one is chosen,
1051 .Ql %%
1052 is replaced by the session name in
1053 .Ar template
1054 and the result executed as a command.
1056 .Ar template
1057 is not given, "switch-client -t '%%'" is used.
1058 This command works only from inside
1059 .Nm .
1060 .It Xo
1061 .Ic choose-window
1062 .Op Fl t Ar target-window
1063 .Op Ar template
1065 Put a window into window choice mode, where a window may be chosen
1066 interactively from a list.
1067 After a window is selected,
1068 .Ql %%
1069 is replaced by the session name and window index in
1070 .Ar template
1071 and the result executed as a command.
1073 .Ar template
1074 is not given, "select-window -t '%%'" is used.
1075 This command works only from inside
1076 .Nm .
1077 .It Ic display-panes Op Fl t Ar target-client
1078 .D1 (alias: Ic displayp)
1079 Display a visible indicator of each pane shown by
1080 .Ar target-client .
1081 See the
1082 .Ic display-panes-time ,
1083 .Ic display-panes-colour ,
1085 .Ic display-panes-active-colour
1086 session options.
1087 While the indicator is on screen, a pane may be selected with the
1088 .Ql 0
1090 .Ql 9
1091 keys.
1092 .It Xo Ic find-window
1093 .Op Fl t Ar target-window
1094 .Ar match-string
1096 .D1 (alias: Ic findw )
1097 Search for the
1098 .Xr fnmatch 3
1099 pattern
1100 .Ar match-string
1101 in window names, titles, and visible content (but not history).
1102 If only one window is matched, it'll be automatically selected, otherwise a
1103 choice list is shown.
1104 This command only works from inside
1105 .Nm .
1106 .It Xo Ic join-pane
1107 .Op Fl dhv
1108 .Oo Fl l
1109 .Ar size |
1110 .Fl p Ar percentage Oc
1111 .Op Fl s Ar src-pane
1112 .Op Fl t Ar dst-pane
1114 .D1 (alias: Ic joinp )
1115 Like
1116 .Ic split-window ,
1117 but instead of splitting
1118 .Ar dst-pane
1119 and creating a new pane, split it and move
1120 .Ar src-pane
1121 into the space.
1122 This can be used to reverse
1123 .Ic break-pane .
1124 .It Xo Ic kill-pane
1125 .Op Fl a
1126 .Op Fl t Ar target-pane
1128 .D1 (alias: Ic killp )
1129 Destroy the given pane.
1130 If no panes remain in the containing window, it is also destroyed.
1132 .Fl a
1133 option kills all but the pane given with
1134 .Fl t .
1135 .It Ic kill-window Op Fl t Ar target-window
1136 .D1 (alias: Ic killw )
1137 Kill the current window or the window at
1138 .Ar target-window ,
1139 removing it from any sessions to which it is linked.
1140 .It Ic last-pane Op Fl t Ar target-window
1141 .D1 (alias: Ic lastp )
1142 Select the last (previously selected) pane.
1143 .It Ic last-window Op Fl t Ar target-session
1144 .D1 (alias: Ic last )
1145 Select the last (previously selected) window.
1146 If no
1147 .Ar target-session
1148 is specified, select the last window of the current session.
1149 .It Xo Ic link-window
1150 .Op Fl dk
1151 .Op Fl s Ar src-window
1152 .Op Fl t Ar dst-window
1154 .D1 (alias: Ic linkw )
1155 Link the window at
1156 .Ar src-window
1157 to the specified
1158 .Ar dst-window .
1160 .Ar dst-window
1161 is specified and no such window exists, the
1162 .Ar src-window
1163 is linked there.
1165 .Fl k
1166 is given and
1167 .Ar dst-window
1168 exists, it is killed, otherwise an error is generated.
1170 .Fl d
1171 is given, the newly linked window is not selected.
1172 .It Xo Ic list-panes
1173 .Op Fl as
1174 .Op Fl F Ar format
1175 .Op Fl t Ar target
1177 .D1 (alias: Ic lsp )
1179 .Fl a
1180 is given,
1181 .Ar target
1182 is ignored and all panes on the server are listed.
1184 .Fl s
1185 is given,
1186 .Ar target
1187 is a session (or the current session).
1188 If neither is given,
1189 .Ar target
1190 is a window (or the current window).
1191 For the meaning of the
1192 .Fl F
1193 flag, see the
1194 .Sx FORMATS
1195 section.
1196 .It Xo Ic list-windows
1197 .Op Fl a
1198 .Op Fl F Ar format
1199 .Op Fl t Ar target-session
1201 .D1 (alias: Ic lsw )
1203 .Fl a
1204 is given, list all windows on the server.
1205 Otherwise, list windows in the current session or in
1206 .Ar target-session .
1207 For the meaning of the
1208 .Fl F
1209 flag, see the
1210 .Sx FORMATS
1211 section.
1212 .It Xo Ic move-window
1213 .Op Fl dk
1214 .Op Fl s Ar src-window
1215 .Op Fl t Ar dst-window
1217 .D1 (alias: Ic movew )
1218 This is similar to
1219 .Ic link-window ,
1220 except the window at
1221 .Ar src-window
1222 is moved to
1223 .Ar dst-window .
1224 .It Xo Ic new-window
1225 .Op Fl adkP
1226 .Op Fl n Ar window-name
1227 .Op Fl t Ar target-window
1228 .Op Ar shell-command
1230 .D1 (alias: Ic neww )
1231 Create a new window.
1232 With
1233 .Fl a ,
1234 the new window is inserted at the next index up from the specified
1235 .Ar target-window ,
1236 moving windows up if necessary,
1237 otherwise
1238 .Ar target-window
1239 is the new window location.
1242 .Fl d
1243 is given, the session does not make the new window the current window.
1244 .Ar target-window
1245 represents the window to be created; if the target already exists an error is
1246 shown, unless the
1247 .Fl k
1248 flag is used, in which case it is destroyed.
1249 .Ar shell-command
1250 is the command to execute.
1252 .Ar shell-command
1253 is not specified, the value of the
1254 .Ic default-command
1255 option is used.
1257 When the shell command completes, the window closes.
1258 See the
1259 .Ic remain-on-exit
1260 option to change this behaviour.
1263 .Ev TERM
1264 environment variable must be set to
1265 .Dq screen
1266 for all programs running
1267 .Em inside
1268 .Nm .
1269 New windows will automatically have
1270 .Dq TERM=screen
1271 added to their environment, but care must be taken not to reset this in shell
1272 start-up files.
1275 .Fl P
1276 option prints the location of the new window after it has been created.
1277 .It Ic next-layout Op Fl t Ar target-window
1278 .D1 (alias: Ic nextl )
1279 Move a window to the next layout and rearrange the panes to fit.
1280 .It Xo Ic next-window
1281 .Op Fl a
1282 .Op Fl t Ar target-session
1284 .D1 (alias: Ic next )
1285 Move to the next window in the session.
1287 .Fl a
1288 is used, move to the next window with a bell, activity or content alert.
1289 .It Xo Ic pipe-pane
1290 .Op Fl o
1291 .Op Fl t Ar target-pane
1292 .Op Ar shell-command
1294 .D1 (alias: Ic pipep )
1295 Pipe any output sent by the program in
1296 .Ar target-pane
1297 to a shell command.
1298 A pane may only be piped to one command at a time, any existing pipe is
1299 closed before
1300 .Ar shell-command
1301 is executed.
1303 .Ar shell-command
1304 string may contain the special character sequences supported by the
1305 .Ic status-left
1306 option.
1307 If no
1308 .Ar shell-command
1309 is given, the current pipe (if any) is closed.
1312 .Fl o
1313 option only opens a new pipe if no previous pipe exists, allowing a pipe to
1314 be toggled with a single key, for example:
1315 .Bd -literal -offset indent
1316 bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1318 .It Xo Ic previous-layout
1319 .Op Fl t Ar target-window
1321 .D1 (alias: Ic prevl )
1322 Move to the previous layout in the session.
1323 .It Xo Ic previous-window
1324 .Op Fl a
1325 .Op Fl t Ar target-session
1327 .D1 (alias: Ic prev )
1328 Move to the previous window in the session.
1329 With
1330 .Fl a ,
1331 move to the previous window with a bell, activity or content alert.
1332 .It Xo Ic rename-window
1333 .Op Fl t Ar target-window
1334 .Ar new-name
1336 .D1 (alias: Ic renamew )
1337 Rename the current window, or the window at
1338 .Ar target-window
1339 if specified, to
1340 .Ar new-name .
1341 .It Xo Ic resize-pane
1342 .Op Fl DLRU
1343 .Op Fl t Ar target-pane
1344 .Op Ar adjustment
1346 .D1 (alias: Ic resizep )
1347 Resize a pane, upward with
1348 .Fl U
1349 (the default), downward with
1350 .Fl D ,
1351 to the left with
1352 .Fl L
1353 and to the right with
1354 .Fl R .
1356 .Ar adjustment
1357 is given in lines or cells (the default is 1).
1358 .It Xo Ic respawn-pane
1359 .Op Fl k
1360 .Op Fl t Ar target-pane
1361 .Op Ar shell-command
1363 .D1 (alias: Ic respawnp )
1364 Reactivate a pane in which the command has exited (see the
1365 .Ic remain-on-exit
1366 window option).
1368 .Ar shell-command
1369 is not given, the command used when the pane was created is executed.
1370 The pane must be already inactive, unless
1371 .Fl k
1372 is given, in which case any existing command is killed.
1373 .It Xo Ic respawn-window
1374 .Op Fl k
1375 .Op Fl t Ar target-window
1376 .Op Ar shell-command
1378 .D1 (alias: Ic respawnw )
1379 Reactivate a window in which the command has exited (see the
1380 .Ic remain-on-exit
1381 window option).
1383 .Ar shell-command
1384 is not given, the command used when the window was created is executed.
1385 The window must be already inactive, unless
1386 .Fl k
1387 is given, in which case any existing command is killed.
1388 .It Xo Ic rotate-window
1389 .Op Fl DU
1390 .Op Fl t Ar target-window
1392 .D1 (alias: Ic rotatew )
1393 Rotate the positions of the panes within a window, either upward (numerically
1394 lower) with
1395 .Fl U
1396 or downward (numerically higher).
1397 .It Xo Ic select-layout
1398 .Op Fl np
1399 .Op Fl t Ar target-window
1400 .Op Ar layout-name
1402 .D1 (alias: Ic selectl )
1403 Choose a specific layout for a window.
1405 .Ar layout-name
1406 is not given, the last preset layout used (if any) is reapplied.
1407 .Fl n
1409 .Fl p
1410 are equivalent to the
1411 .Ic next-layout
1413 .Ic previous-layout
1414 commands.
1415 .It Xo Ic select-pane
1416 .Op Fl lDLRU
1417 .Op Fl t Ar target-pane
1419 .D1 (alias: Ic selectp )
1420 Make pane
1421 .Ar target-pane
1422 the active pane in window
1423 .Ar target-window .
1424 If one of
1425 .Fl D ,
1426 .Fl L ,
1427 .Fl R ,
1429 .Fl U
1430 is used, respectively the pane below, to the left, to the right, or above the
1431 target pane is used.
1432 .Fl l
1433 is the same as using the
1434 .Ic last-pane
1435 command.
1436 .It Xo Ic select-window
1437 .Op Fl lnp
1438 .Op Fl t Ar target-window
1440 .D1 (alias: Ic selectw )
1441 Select the window at
1442 .Ar target-window .
1443 .Fl l ,
1444 .Fl n
1446 .Fl p
1447 are equivalent to the
1448 .Ic last-window ,
1449 .Ic next-window
1451 .Ic previous-window
1452 commands.
1453 .It Xo Ic split-window
1454 .Op Fl dhvP
1455 .Oo Fl l
1456 .Ar size |
1457 .Fl p Ar percentage Oc
1458 .Op Fl t Ar target-pane
1459 .Op Ar shell-command
1461 .D1 (alias: Ic splitw )
1462 Create a new pane by splitting
1463 .Ar target-pane :
1464 .Fl h
1465 does a horizontal split and
1466 .Fl v
1467 a vertical split; if neither is specified,
1468 .Fl v
1469 is assumed.
1471 .Fl l
1473 .Fl p
1474 options specify the size of the new pane in lines (for vertical split) or in
1475 cells (for horizontal split), or as a percentage, respectively.
1476 All other options have the same meaning as for the
1477 .Ic new-window
1478 command.
1479 .It Xo Ic swap-pane
1480 .Op Fl dDU
1481 .Op Fl s Ar src-pane
1482 .Op Fl t Ar dst-pane
1484 .D1 (alias: Ic swapp )
1485 Swap two panes.
1487 .Fl U
1488 is used and no source pane is specified with
1489 .Fl s ,
1490 .Ar dst-pane
1491 is swapped with the previous pane (before it numerically);
1492 .Fl D
1493 swaps with the next pane (after it numerically).
1494 .Fl d
1495 instructs
1497 not to change the active pane.
1498 .It Xo Ic swap-window
1499 .Op Fl d
1500 .Op Fl s Ar src-window
1501 .Op Fl t Ar dst-window
1503 .D1 (alias: Ic swapw )
1504 This is similar to
1505 .Ic link-window ,
1506 except the source and destination windows are swapped.
1507 It is an error if no window exists at
1508 .Ar src-window .
1509 .It Xo Ic unlink-window
1510 .Op Fl k
1511 .Op Fl t Ar target-window
1513 .D1 (alias: Ic unlinkw )
1514 Unlink
1515 .Ar target-window .
1516 Unless
1517 .Fl k
1518 is given, a window may be unlinked only if it is linked to multiple sessions -
1519 windows may not be linked to no sessions;
1521 .Fl k
1522 is specified and the window is linked to only one session, it is unlinked and
1523 destroyed.
1525 .Sh KEY BINDINGS
1527 allows a command to be bound to most keys, with or without a prefix key.
1528 When specifying keys, most represent themselves (for example
1529 .Ql A
1531 .Ql Z ) .
1532 Ctrl keys may be prefixed with
1533 .Ql C-
1535 .Ql ^ ,
1536 and Alt (meta) with
1537 .Ql M- .
1538 In addition, the following special key names are accepted:
1539 .Em Up ,
1540 .Em Down ,
1541 .Em Left ,
1542 .Em Right ,
1543 .Em BSpace ,
1544 .Em BTab ,
1545 .Em DC
1546 (Delete),
1547 .Em End ,
1548 .Em Enter ,
1549 .Em Escape ,
1550 .Em F1
1552 .Em F20 ,
1553 .Em Home ,
1554 .Em IC
1555 (Insert),
1556 .Em NPage/PageDown/PgDn ,
1557 .Em PPage/PageUp/PgUp ,
1558 .Em Space ,
1560 .Em Tab .
1561 Note that to bind the
1562 .Ql \&"
1564 .Ql '
1565 keys, quotation marks are necessary, for example:
1566 .Bd -literal -offset indent
1567 bind-key '"' split-window
1568 bind-key "'" new-window
1571 Commands related to key bindings are as follows:
1572 .Bl -tag -width Ds
1573 .It Xo Ic bind-key
1574 .Op Fl cnr
1575 .Op Fl t Ar key-table
1576 .Ar key Ar command Op Ar arguments
1578 .D1 (alias: Ic bind )
1579 Bind key
1580 .Ar key
1582 .Ar command .
1583 By default (without
1584 .Fl t )
1585 the primary key bindings are modified (those normally activated with the prefix
1586 key); in this case, if
1587 .Fl n
1588 is specified, it is not necessary to use the prefix key,
1589 .Ar command
1590 is bound to
1591 .Ar key
1592 alone.
1594 .Fl r
1595 flag indicates this key may repeat, see the
1596 .Ic repeat-time
1597 option.
1600 .Fl t
1601 is present,
1602 .Ar key
1603 is bound in
1604 .Ar key-table :
1605 the binding for command mode with
1606 .Fl c
1607 or for normal mode without.
1608 To view the default bindings and possible commands, see the
1609 .Ic list-keys
1610 command.
1611 .It Ic list-keys Op Fl t Ar key-table
1612 .D1 (alias: Ic lsk )
1613 List all key bindings.
1614 Without
1615 .Fl t
1616 the primary key bindings - those executed when preceded by the prefix key -
1617 are printed.
1618 Keys bound without the prefix key (see
1619 .Ic bind-key
1620 .Fl n )
1621 are marked with
1622 .Ql (no prefix) .
1624 With
1625 .Fl t ,
1626 the key bindings in
1627 .Ar key-table
1628 are listed; this may be one of:
1629 .Em vi-edit ,
1630 .Em emacs-edit ,
1631 .Em vi-choice ,
1632 .Em emacs-choice ,
1633 .Em vi-copy
1635 .Em emacs-copy .
1636 .It Xo Ic send-keys
1637 .Op Fl t Ar target-pane
1638 .Ar key Ar ...
1640 .D1 (alias: Ic send )
1641 Send a key or keys to a window.
1642 Each argument
1643 .Ar key
1644 is the name of the key (such as
1645 .Ql C-a
1647 .Ql npage
1648 ) to send; if the string is not recognised as a key, it is sent as a series of
1649 characters.
1650 All arguments are sent sequentially from first to last.
1651 .It Ic send-prefix Op Fl t Ar target-pane
1652 Send the prefix key to a window as if it was pressed.
1653 If multiple prefix keys are configured, only the first is sent.
1654 .It Xo Ic unbind-key
1655 .Op Fl acn
1656 .Op Fl t Ar key-table
1657 .Ar key
1659 .D1 (alias: Ic unbind )
1660 Unbind the command bound to
1661 .Ar key .
1662 Without
1663 .Fl t
1664 the primary key bindings are modified; in this case, if
1665 .Fl n
1666 is specified, the command bound to
1667 .Ar key
1668 without a prefix (if any) is removed.
1670 .Fl a
1671 is present, all key bindings are removed.
1674 .Fl t
1675 is present,
1676 .Ar key
1678 .Ar key-table
1679 is unbound: the binding for command mode with
1680 .Fl c
1681 or for normal mode without.
1683 .Sh OPTIONS
1684 The appearance and behaviour of
1686 may be modified by changing the value of various options.
1687 There are three types of option:
1688 .Em server options ,
1689 .Em session options
1691 .Em window options .
1695 server has a set of global options which do not apply to any particular
1696 window or session.
1697 These are altered with the
1698 .Ic set-option
1699 .Fl s
1700 command, or displayed with the
1701 .Ic show-options
1702 .Fl s
1703 command.
1705 In addition, each individual session may have a set of session options, and
1706 there is a separate set of global session options.
1707 Sessions which do not have a particular option configured inherit the value
1708 from the global session options.
1709 Session options are set or unset with the
1710 .Ic set-option
1711 command and may be listed with the
1712 .Ic show-options
1713 command.
1714 The available server and session options are listed under the
1715 .Ic set-option
1716 command.
1718 Similarly, a set of window options is attached to each window, and there is
1719 a set of global window options from which any unset options are inherited.
1720 Window options are altered with the
1721 .Ic set-window-option
1722 command and can be listed with the
1723 .Ic show-window-options
1724 command.
1725 All window options are documented with the
1726 .Ic set-window-option
1727 command.
1729 Commands which set options are as follows:
1730 .Bl -tag -width Ds
1731 .It Xo Ic set-option
1732 .Op Fl agsuw
1733 .Op Fl t Ar target-session | Ar target-window
1734 .Ar option Ar value
1736 .D1 (alias: Ic set )
1737 Set a window option with
1738 .Fl w
1739 (equivalent to the
1740 .Ic set-window-option
1741 command),
1742 a server option with
1743 .Fl s ,
1744 otherwise a session option.
1747 .Fl g
1748 is specified, the global session or window option is set.
1749 With
1750 .Fl a ,
1751 and if the option expects a string,
1752 .Ar value
1753 is appended to the existing setting.
1755 .Fl u
1756 flag unsets an option, so a session inherits the option from the global
1757 options.
1758 It is not possible to unset a global option.
1760 Available window options are listed under
1761 .Ic set-window-option .
1763 Available server options are:
1764 .Bl -tag -width Ds
1765 .It Ic buffer-limit Ar number
1766 Set the number of buffers; as new buffers are added to the top of the stack,
1767 old ones are removed from the bottom if necessary to maintain this maximum
1768 length.
1769 .It Ic escape-time Ar time
1770 Set the time in milliseconds for which
1772 waits after an escape is input to determine if it is part of a function or meta
1773 key sequences.
1774 The default is 500 milliseconds.
1775 .It Xo Ic exit-unattached
1776 .Op Ic on | off
1778 If enabled, the server will exit when there are no attached clients.
1779 .It Xo Ic quiet
1780 .Op Ic on | off
1782 Enable or disable the display of various informational messages (see also the
1783 .Fl q
1784 command line flag).
1785 .It Xo Ic set-clipboard
1786 .Op Ic on | off
1788 Attempt to set the terminal clipboard content using the
1789 \ee]52;...\e007
1790 .Xr xterm 1
1791 escape sequences.
1792 This option is on by default if there is an
1793 .Em \&Ms
1794 entry in the
1795 .Xr terminfo 5
1796 description for the client terminal.
1797 Note that this feature needs to be enabled in
1798 .Xr xterm 1
1799 by setting the resource:
1800 .Bd -literal -offset indent
1801 disallowedWindowOps: 20,21,SetXprop
1804 Or changing this property from the
1805 .Xr xterm 1
1806 interactive menu when required.
1809 Available session options are:
1810 .Bl -tag -width Ds
1811 .It Ic base-index Ar index
1812 Set the base index from which an unused index should be searched when a new
1813 window is created.
1814 The default is zero.
1815 .It Xo Ic bell-action
1816 .Op Ic any | none | current
1818 Set action on window bell.
1819 .Ic any
1820 means a bell in any window linked to a session causes a bell in the current
1821 window of that session,
1822 .Ic none
1823 means all bells are ignored and
1824 .Ic current
1825 means only bell in windows other than the current window are ignored.
1826 .It Xo Ic bell-on-alert
1827 .Op Ic on | off
1829 If on, ring the terminal bell when an activity, content or silence alert
1830 occurs.
1831 .It Ic default-command Ar shell-command
1832 Set the command used for new windows (if not specified when the window is
1833 created) to
1834 .Ar shell-command ,
1835 which may be any
1836 .Xr sh 1
1837 command.
1838 The default is an empty string, which instructs
1840 to create a login shell using the value of the
1841 .Ic default-shell
1842 option.
1843 .It Ic default-path Ar path
1844 Set the default working directory for new panes.
1845 If empty (the default), the working directory is determined from the process
1846 running in the active pane, from the command line environment or from the
1847 working directory where the session was created.
1848 .It Ic default-shell Ar path
1849 Specify the default shell.
1850 This is used as the login shell for new windows when the
1851 .Ic default-command
1852 option is set to empty, and must be the full path of the executable.
1853 When started
1855 tries to set a default value from the first suitable of the
1856 .Ev SHELL
1857 environment variable, the shell returned by
1858 .Xr getpwuid 3 ,
1860 .Pa /bin/sh .
1861 This option should be configured when
1863 is used as a login shell.
1864 .It Ic default-terminal Ar terminal
1865 Set the default terminal for new windows created in this session - the
1866 default value of the
1867 .Ev TERM
1868 environment variable.
1871 to work correctly, this
1872 .Em must
1873 be set to
1874 .Ql screen
1875 or a derivative of it.
1876 .It Xo Ic destroy-unattached
1877 .Op Ic on | off
1879 If enabled and the session is no longer attached to any clients, it is
1880 destroyed.
1881 .It Xo Ic detach-on-destroy
1882 .Op Ic on | off
1884 If on (the default), the client is detached when the session it is attached to
1885 is destroyed.
1886 If off, the client is switched to the most recently active of the remaining
1887 sessions.
1888 .It Ic display-panes-active-colour Ar colour
1889 Set the colour used by the
1890 .Ic display-panes
1891 command to show the indicator for the active pane.
1892 .It Ic display-panes-colour Ar colour
1893 Set the colour used by the
1894 .Ic display-panes
1895 command to show the indicators for inactive panes.
1896 .It Ic display-panes-time Ar time
1897 Set the time in milliseconds for which the indicators shown by the
1898 .Ic display-panes
1899 command appear.
1900 .It Ic display-time Ar time
1901 Set the amount of time for which status line messages and other on-screen
1902 indicators are displayed.
1903 .Ar time
1904 is in milliseconds.
1905 .It Ic history-limit Ar lines
1906 Set the maximum number of lines held in window history.
1907 This setting applies only to new windows - existing window histories are not
1908 resized and retain the limit at the point they were created.
1909 .It Ic lock-after-time Ar number
1910 Lock the session (like the
1911 .Ic lock-session
1912 command) after
1913 .Ar number
1914 seconds of inactivity, or the entire server (all sessions) if the
1915 .Ic lock-server
1916 option is set.
1917 The default is not to lock (set to 0).
1918 .It Ic lock-command Ar shell-command
1919 Command to run when locking each client.
1920 The default is to run
1921 .Xr lock 1
1922 with
1923 .Fl np .
1924 .It Xo Ic lock-server
1925 .Op Ic on | off
1927 If this option is
1928 .Ic on
1929 (the default),
1930 instead of each session locking individually as each has been
1931 idle for
1932 .Ic lock-after-time ,
1933 the entire server will lock after
1934 .Em all
1935 sessions would have locked.
1936 This has no effect as a session option; it must be set as a global option.
1937 .It Ic message-attr Ar attributes
1938 Set status line message attributes, where
1939 .Ar attributes
1940 is either
1941 .Ic none
1942 or a comma-delimited list of one or more of:
1943 .Ic bright
1945 .Ic bold ) ,
1946 .Ic dim ,
1947 .Ic underscore ,
1948 .Ic blink ,
1949 .Ic reverse ,
1950 .Ic hidden ,
1952 .Ic italics .
1953 .It Ic message-bg Ar colour
1954 Set status line message background colour, where
1955 .Ar colour
1956 is one of:
1957 .Ic black ,
1958 .Ic red ,
1959 .Ic green ,
1960 .Ic yellow ,
1961 .Ic blue ,
1962 .Ic magenta ,
1963 .Ic cyan ,
1964 .Ic white ,
1965 .Ic colour0
1967 .Ic colour255
1968 from the 256-colour set,
1969 .Ic default ,
1970 or a hexadecimal RGB string such as
1971 .Ql #ffffff ,
1972 which chooses the closest match from the default 256-colour set.
1973 .It Ic message-command-attr Ar attributes
1974 Set status line message attributes when in command mode.
1975 .It Ic message-command-bg Ar colour
1976 Set status line message background colour when in command mode.
1977 .It Ic message-command-fg Ar colour
1978 Set status line message foreground colour when in command mode.
1979 .It Ic message-fg Ar colour
1980 Set status line message foreground colour.
1981 .It Ic message-limit Ar number
1982 Set the number of error or information messages to save in the message log for
1983 each client.
1984 The default is 20.
1985 .It Xo Ic mouse-resize-pane
1986 .Op Ic on | off
1988 If on,
1990 captures the mouse and allows panes to be resized by dragging on their borders.
1991 .It Xo Ic mouse-select-pane
1992 .Op Ic on | off
1994 If on,
1996 captures the mouse and when a window is split into multiple panes the mouse may
1997 be used to select the current pane.
1998 The mouse click is also passed through to the application as normal.
1999 .It Xo Ic mouse-select-window
2000 .Op Ic on | off
2002 If on, clicking the mouse on a window name in the status line will select that
2003 window.
2004 .It Xo Ic mouse-utf8
2005 .Op Ic on | off
2007 If enabled, request mouse input as UTF-8 on UTF-8 terminals.
2008 .It Ic pane-active-border-bg Ar colour
2009 .It Ic pane-active-border-fg Ar colour
2010 Set the pane border colour for the currently active pane.
2011 .It Ic pane-border-bg Ar colour
2012 .It Ic pane-border-fg Ar colour
2013 Set the pane border colour for panes aside from the active pane.
2014 .It Ic prefix Ar keys
2015 Set the keys accepted as a prefix key.
2016 .Ar keys
2017 is a comma-separated list of key names, each of which individually behave as
2018 the prefix key.
2019 .It Ic repeat-time Ar time
2020 Allow multiple commands to be entered without pressing the prefix-key again
2021 in the specified
2022 .Ar time
2023 milliseconds (the default is 500).
2024 Whether a key repeats may be set when it is bound using the
2025 .Fl r
2026 flag to
2027 .Ic bind-key .
2028 Repeat is enabled for the default keys bound to the
2029 .Ic resize-pane
2030 command.
2031 .It Xo Ic set-remain-on-exit
2032 .Op Ic on | off
2034 Set the
2035 .Ic remain-on-exit
2036 window option for any windows first created in this session.
2037 When this option is true, windows in which the running program has
2038 exited do not close, instead remaining open but inactivate.
2039 Use the
2040 .Ic respawn-window
2041 command to reactivate such a window, or the
2042 .Ic kill-window
2043 command to destroy it.
2044 .It Xo Ic set-titles
2045 .Op Ic on | off
2047 Attempt to set the window title using the \ee]2;...\e007 xterm code if
2048 the terminal appears to be an xterm.
2049 This option is off by default.
2050 Note that elinks
2051 will only attempt to set the window title if the STY environment
2052 variable is set.
2053 .It Ic set-titles-string Ar string
2054 String used to set the window title if
2055 .Ic set-titles
2056 is on.
2057 Character sequences are replaced as for the
2058 .Ic status-left
2059 option.
2060 .It Xo Ic status
2061 .Op Ic on | off
2063 Show or hide the status line.
2064 .It Ic status-attr Ar attributes
2065 Set status line attributes.
2066 .It Ic status-bg Ar colour
2067 Set status line background colour.
2068 .It Ic status-fg Ar colour
2069 Set status line foreground colour.
2070 .It Ic status-interval Ar interval
2071 Update the status bar every
2072 .Ar interval
2073 seconds.
2074 By default, updates will occur every 15 seconds.
2075 A setting of zero disables redrawing at interval.
2076 .It Xo Ic status-justify
2077 .Op Ic left | centre | right
2079 Set the position of the window list component of the status line: left, centre
2080 or right justified.
2081 .It Xo Ic status-keys
2082 .Op Ic vi | emacs
2084 Use vi or emacs-style
2085 key bindings in the status line, for example at the command prompt.
2086 The default is emacs, unless the
2087 .Ev VISUAL
2089 .Ev EDITOR
2090 environment variables are set and contain the string
2091 .Ql vi .
2092 .It Ic status-left Ar string
2093 Display
2094 .Ar string
2095 to the left of the status bar.
2096 .Ar string
2097 will be passed through
2098 .Xr strftime 3
2099 before being used.
2100 By default, the session name is shown.
2101 .Ar string
2102 may contain any of the following special character sequences:
2103 .Bl -column "Character pair" "Replaced with" -offset indent
2104 .It Sy "Character pair" Ta Sy "Replaced with"
2105 .It Li "#(shell-command)" Ta "First line of the command's output"
2106 .It Li "#[attributes]" Ta "Colour or attribute change"
2107 .It Li "#H" Ta "Hostname of local host"
2108 .It Li "#h" Ta "Hostname of local host without the domain name"
2109 .It Li "#F" Ta "Current window flag"
2110 .It Li "#I" Ta "Current window index"
2111 .It Li "#P" Ta "Current pane index"
2112 .It Li "#S" Ta "Session name"
2113 .It Li "#T" Ta "Current window title"
2114 .It Li "#W" Ta "Current window name"
2115 .It Li "##" Ta "A literal" Ql #
2118 The #(shell-command) form executes
2119 .Ql shell-command
2120 and inserts the first line of its output.
2121 Note that shell commands are only executed once at the interval specified by
2123 .Ic status-interval
2124 option: if the status line is redrawn in the meantime, the previous result is
2125 used.
2126 Shell commands are executed with the
2128 global environment set (see the
2129 .Sx ENVIRONMENT
2130 section).
2132 The window title (#T) is the title set by the program running within the window
2133 using the OSC title setting sequence, for example:
2134 .Bd -literal -offset indent
2135 $ printf '\e033]2;My Title\e033\e\e'
2138 When a window is first created, its title is the hostname.
2140 #[attributes] allows a comma-separated list of attributes to be specified,
2141 these may be
2142 .Ql fg=colour
2143 to set the foreground colour,
2144 .Ql bg=colour
2145 to set the background colour, the name of one of the attributes (listed under
2147 .Ic message-attr
2148 option) to turn an attribute on, or an attribute prefixed with
2149 .Ql no
2150 to turn one off, for example
2151 .Ic nobright .
2152 Examples are:
2153 .Bd -literal -offset indent
2154 #(sysctl vm.loadavg)
2155 #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2158 Where appropriate, special character sequences may be prefixed with a number to
2159 specify the maximum length, for example
2160 .Ql #24T .
2162 By default, UTF-8 in
2163 .Ar string
2164 is not interpreted, to enable UTF-8, use the
2165 .Ic status-utf8
2166 option.
2167 .It Ic status-left-attr Ar attributes
2168 Set the attribute of the left part of the status line.
2169 .It Ic status-left-bg Ar colour
2170 Set the background colour of the left part of the status line.
2171 .It Ic status-left-fg Ar colour
2172 Set the foreground colour of the left part of the status line.
2173 .It Ic status-left-length Ar length
2174 Set the maximum
2175 .Ar length
2176 of the left component of the status bar.
2177 The default is 10.
2178 .It Ic status-right Ar string
2179 Display
2180 .Ar string
2181 to the right of the status bar.
2182 By default, the current window title in double quotes, the date and the time
2183 are shown.
2184 As with
2185 .Ic status-left ,
2186 .Ar string
2187 will be passed to
2188 .Xr strftime 3 ,
2189 character pairs are replaced, and UTF-8 is dependent on the
2190 .Ic status-utf8
2191 option.
2192 .It Ic status-right-attr Ar attributes
2193 Set the attribute of the right part of the status line.
2194 .It Ic status-right-bg Ar colour
2195 Set the background colour of the right part of the status line.
2196 .It Ic status-right-fg Ar colour
2197 Set the foreground colour of the right part of the status line.
2198 .It Ic status-right-length Ar length
2199 Set the maximum
2200 .Ar length
2201 of the right component of the status bar.
2202 The default is 40.
2203 .It Xo Ic status-utf8
2204 .Op Ic on | off
2206 Instruct
2208 to treat top-bit-set characters in the
2209 .Ic status-left
2211 .Ic status-right
2212 strings as UTF-8; notably, this is important for wide characters.
2213 This option defaults to off.
2214 .It Ic terminal-overrides Ar string
2215 Contains a list of entries which override terminal descriptions read using
2216 .Xr terminfo 5 .
2217 .Ar string
2218 is a comma-separated list of items each a colon-separated string made up of a
2219 terminal type pattern (matched using
2220 .Xr fnmatch 3 )
2221 and a set of
2222 .Em name=value
2223 entries.
2225 For example, to set the
2226 .Ql clear
2227 .Xr terminfo 5
2228 entry to
2229 .Ql \ee[H\ee[2J
2230 for all terminal types and the
2231 .Ql dch1
2232 entry to
2233 .Ql \ee[P
2234 for the
2235 .Ql rxvt
2236 terminal type, the option could be set to the string:
2237 .Bd -literal -offset indent
2238 "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2241 The terminal entry value is passed through
2242 .Xr strunvis 3
2243 before interpretation.
2244 The default value forcibly corrects the
2245 .Ql colors
2246 entry for terminals which support 88 or 256 colours:
2247 .Bd -literal -offset indent
2248 "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
2250 .It Ic update-environment Ar variables
2251 Set a space-separated string containing a list of environment variables to be
2252 copied into the session environment when a new session is created or an
2253 existing session is attached.
2254 Any variables that do not exist in the source environment are set to be
2255 removed from the session environment (as if
2256 .Fl r
2257 was given to the
2258 .Ic set-environment
2259 command).
2260 The default is
2261 "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2262 XAUTHORITY".
2263 .It Xo Ic visual-activity
2264 .Op Ic on | off
2266 If on, display a status line message when activity occurs in a window
2267 for which the
2268 .Ic monitor-activity
2269 window option is enabled.
2270 .It Xo Ic visual-bell
2271 .Op Ic on | off
2273 If this option is on, a message is shown on a bell instead of it being passed
2274 through to the terminal (which normally makes a sound).
2275 Also see the
2276 .Ic bell-action
2277 option.
2278 .It Xo Ic visual-content
2279 .Op Ic on | off
2281 Like
2282 .Ic visual-activity ,
2283 display a message when content is present in a window
2284 for which the
2285 .Ic monitor-content
2286 window option is enabled.
2287 .It Xo Ic visual-silence
2288 .Op Ic on | off
2291 .Ic monitor-silence
2292 is enabled, prints a message after the interval has expired on a given window.
2293 .It Ic word-separators Ar string
2294 Sets the session's conception of what characters are considered word
2295 separators, for the purposes of the next and previous word commands in
2296 copy mode.
2297 The default is
2298 .Ql \ -_@ .
2300 .It Xo Ic set-window-option
2301 .Op Fl agu
2302 .Op Fl t Ar target-window
2303 .Ar option Ar value
2305 .D1 (alias: Ic setw )
2306 Set a window option.
2308 .Fl a ,
2309 .Fl g
2311 .Fl u
2312 flags work similarly to the
2313 .Ic set-option
2314 command.
2316 Supported window options are:
2318 .Bl -tag -width Ds -compact
2319 .It Xo Ic aggressive-resize
2320 .Op Ic on | off
2322 Aggressively resize the chosen window.
2323 This means that
2325 will resize the window to the size of the smallest session for which it is the
2326 current window, rather than the smallest session to which it is attached.
2327 The window may resize when the current window is changed on another sessions;
2328 this option is good for full-screen programs which support
2329 .Dv SIGWINCH
2330 and poor for interactive programs such as shells.
2332 .It Xo Ic alternate-screen
2333 .Op Ic on | off
2335 This option configures whether programs running inside
2337 may use the terminal alternate screen feature, which allows the
2338 .Em smcup
2340 .Em rmcup
2341 .Xr terminfo 5
2342 capabilities.
2343 The alternate screen feature preserves the contents of the window when an
2344 interactive application starts and restores it on exit, so that any output
2345 visible before the application starts reappears unchanged after it exits.
2346 The default is on.
2348 .It Xo Ic automatic-rename
2349 .Op Ic on | off
2351 Control automatic window renaming.
2352 When this setting is enabled,
2354 will attempt - on supported platforms - to rename the window to reflect the
2355 command currently running in it.
2356 This flag is automatically disabled for an individual window when a name
2357 is specified at creation with
2358 .Ic new-window
2360 .Ic new-session ,
2361 or later with
2362 .Ic rename-window .
2363 It may be switched off globally with:
2364 .Bd -literal -offset indent
2365 set-window-option -g automatic-rename off
2368 .It Ic clock-mode-colour Ar colour
2369 Set clock colour.
2371 .It Xo Ic clock-mode-style
2372 .Op Ic 12 | 24
2374 Set clock hour format.
2376 .It Ic force-height Ar height
2377 .It Ic force-width Ar width
2378 Prevent
2380 from resizing a window to greater than
2381 .Ar width
2383 .Ar height .
2384 A value of zero restores the default unlimited setting.
2386 .It Ic main-pane-height Ar height
2387 .It Ic main-pane-width Ar width
2388 Set the width or height of the main (left or top) pane in the
2389 .Ic main-horizontal
2391 .Ic main-vertical
2392 layouts.
2394 .It Ic mode-attr Ar attributes
2395 Set window modes attributes.
2397 .It Ic mode-bg Ar colour
2398 Set window modes background colour.
2400 .It Ic mode-fg Ar colour
2401 Set window modes foreground colour.
2403 .It Xo Ic mode-keys
2404 .Op Ic vi | emacs
2406 Use vi or emacs-style key bindings in copy and choice modes.
2407 As with the
2408 .Ic status-keys
2409 option, the default is emacs, unless
2410 .Ev VISUAL
2412 .Ev EDITOR
2413 contains
2414 .Ql vi .
2416 .It Xo Ic mode-mouse
2417 .Op Ic on | off | copy-mode
2419 Mouse state in modes.
2420 If on, the mouse may be used to enter copy mode and copy a selection by
2421 dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2422 option in choice mode.
2423 If set to
2424 .Em copy-mode ,
2425 the mouse behaves as set to on, but cannot be used to enter copy
2426 mode.
2428 .It Xo Ic monitor-activity
2429 .Op Ic on | off
2431 Monitor for activity in the window.
2432 Windows with activity are highlighted in the status line.
2434 .It Ic monitor-content Ar match-string
2435 Monitor content in the window.
2436 When
2437 .Xr fnmatch 3
2438 pattern
2439 .Ar match-string
2440 appears in the window, it is highlighted in the status line.
2442 .It Xo Ic monitor-silence
2443 .Op Ic interval
2445 Monitor for silence (no activity) in the window within
2446 .Ic interval
2447 seconds.
2448 Windows that have been silent for the interval are highlighted in the
2449 status line.
2450 An interval of zero disables the monitoring.
2452 .It Ic other-pane-height Ar height
2453 Set the height of the other panes (not the main pane) in the
2454 .Ic main-horizontal
2455 layout.
2456 If this option is set to 0 (the default), it will have no effect.
2457 If both the
2458 .Ic main-pane-height
2460 .Ic other-pane-height
2461 options are set, the main pane will grow taller to make the other panes the
2462 specified height, but will never shrink to do so.
2464 .It Ic other-pane-width Ar width
2465 Like
2466 .Ic other-pane-height ,
2467 but set the width of other panes in the
2468 .Ic main-vertical
2469 layout.
2471 .It Ic pane-base-index Ar index
2472 Like
2473 .Ic base-index ,
2474 but set the starting index for pane numbers.
2476 .It Xo Ic remain-on-exit
2477 .Op Ic on | off
2479 A window with this flag set is not destroyed when the program running in it
2480 exits.
2481 The window may be reactivated with the
2482 .Ic respawn-window
2483 command.
2485 .It Xo Ic synchronize-panes
2486 .Op Ic on | off
2488 Duplicate input to any pane to all other panes in the same window (only
2489 for panes that are not in any special mode).
2491 .It Xo Ic utf8
2492 .Op Ic on | off
2494 Instructs
2496 to expect UTF-8 sequences to appear in this window.
2498 .It Ic window-status-alert-attr Ar attributes
2499 Set status line attributes for windows which have an alert (bell, activity
2500 or content).
2502 .It Ic window-status-alert-bg Ar colour
2503 Set status line background colour for windows with an alert.
2505 .It Ic window-status-alert-fg Ar colour
2506 Set status line foreground colour for windows with an alert.
2508 .It Ic window-status-attr Ar attributes
2509 Set status line attributes for a single window.
2511 .It Ic window-status-bg Ar colour
2512 Set status line background colour for a single window.
2514 .It Ic window-status-current-attr Ar attributes
2515 Set status line attributes for the currently active window.
2517 .It Ic window-status-current-bg Ar colour
2518 Set status line background colour for the currently active window.
2520 .It Ic window-status-current-fg Ar colour
2521 Set status line foreground colour for the currently active window.
2523 .It Ic window-status-current-format Ar string
2524 Like
2525 .Ar window-status-format ,
2526 but is the format used when the window is the current window.
2528 .It Ic window-status-fg Ar colour
2529 Set status line foreground colour for a single window.
2531 .It Ic window-status-format Ar string
2532 Set the format in which the window is displayed in the status line window list.
2533 See the
2534 .Ar status-left
2535 option for details of special character sequences available.
2536 The default is
2537 .Ql #I:#W#F .
2539 .It Xo Ic xterm-keys
2540 .Op Ic on | off
2542 If this option is set,
2544 will generate
2545 .Xr xterm 1 -style
2546 function key sequences; these have a number included to indicate modifiers such
2547 as Shift, Alt or Ctrl.
2548 The default is off.
2550 .It Xo Ic show-options
2551 .Op Fl gsw
2552 .Op Fl t Ar target-session | Ar target-window
2554 .D1 (alias: Ic show )
2555 Show the window options with
2556 .Fl w
2557 (equivalent to
2558 .Ic show-window-options ) ,
2559 the server options with
2560 .Fl s ,
2561 otherwise the session options for
2562 .Ar target session .
2563 Global session or window options are listed if
2564 .Fl g
2565 is used.
2566 .It Xo Ic show-window-options
2567 .Op Fl g
2568 .Op Fl t Ar target-window
2570 .D1 (alias: Ic showw )
2571 List the window options for
2572 .Ar target-window ,
2573 or the global window options if
2574 .Fl g
2575 is used.
2577 .Sh FORMATS
2579 .Ic list-clients ,
2580 .Ic list-sessions ,
2581 .Ic list-windows
2583 .Ic list-panes
2584 commands accept the
2585 .Fl F
2586 flag with a
2587 .Ar format
2588 argument.
2589 This is a string which controls the output format of the command.
2590 Special character sequences are replaced as documented under the
2591 .Ic status-left
2592 option and an additional long form is accepted.
2593 Replacement variables are enclosed in
2594 .Ql #{
2596 .Ql } ,
2597 for example
2598 .Ql #{session_name}
2599 is equivalent to
2600 .Ql #S .
2601 Conditionals are also accepted by prefixing with
2602 .Ql \&?
2603 and separating two alternatives with a comma;
2604 if the specified variable exists and is not zero, the first alternative
2605 is chosen, otherwise the second is used.
2606 For example
2607 .Ql #{?session_attached,attached,not attached}
2608 will include the string
2609 .Ql attached
2610 if the session is attached and the string
2611 .Ql not attached
2612 if it is unattached.
2614 The following variables are available, where appropriate:
2615 .Bl -column "session_created_string" "Replaced with" -offset indent
2616 .It Sy "Variable name" Ta Sy "Replaced with"
2617 .It Li "client_activity" Ta "Integer time client last had activity"
2618 .It Li "client_activity_string" Ta "String time client last had activity"
2619 .It Li "client_created" Ta "Integer time client created"
2620 .It Li "client_created_string" Ta "String time client created"
2621 .It Li "client_cwd" Ta "Working directory of client"
2622 .It Li "client_height" Ta "Height of client"
2623 .It Li "client_readonly" Ta "1 if client is readonly"
2624 .It Li "client_termname" Ta "Terminal name of client"
2625 .It Li "client_tty" Ta "Pseudo terminal of client"
2626 .It Li "client_utf8" Ta "1 if client supports utf8"
2627 .It Li "client_width" Ta "Width of client"
2628 .It Li "host" Ta "Hostname of local host"
2629 .It Li "line" Ta "Line number in the list"
2630 .It Li "pane_active" Ta "1 if active pane"
2631 .It Li "pane_dead" Ta "1 if pane is dead"
2632 .It Li "pane_height" Ta "Height of pane"
2633 .It Li "pane_id" Ta "Unique pane id"
2634 .It Li "pane_pid" Ta "PID of first process in pane"
2635 .It Li "pane_start_command" Ta "Command pane started with"
2636 .It Li "pane_start_path" Ta "Path pane started with"
2637 .It Li "pane_title" Ta "Title of pane"
2638 .It Li "pane_tty" Ta "Pseudo terminal of pane"
2639 .It Li "pane_width" Ta "Width of pane"
2640 .It Li "session_attached" Ta "1 if session attached"
2641 .It Li "session_created" Ta "Integer time session created"
2642 .It Li "session_created_string" Ta "String time session created"
2643 .It Li "session_group" Ta "Number of session group"
2644 .It Li "session_grouped" Ta "1 if session in a group"
2645 .It Li "session_height" Ta "Height of session"
2646 .It Li "session_name" Ta "Name of session"
2647 .It Li "session_width" Ta "Width of session"
2648 .It Li "session_windows" Ta "Number of windows in session"
2649 .It Li "window_active" Ta "1 if window active"
2650 .It Li "window_flags" Ta "Window flags"
2651 .It Li "window_height" Ta "Height of window"
2652 .It Li "window_index" Ta "Index of window"
2653 .It Li "window_layout" Ta "Window layout description"
2654 .It Li "window_name" Ta "Name of window"
2655 .It Li "window_width" Ta "Width of window"
2657 .Sh ENVIRONMENT
2658 When the server is started,
2660 copies the environment into the
2661 .Em global environment ;
2662 in addition, each session has a
2663 .Em session environment .
2664 When a window is created, the session and global environments are merged.
2665 If a variable exists in both, the value from the session environment is used.
2666 The result is the initial environment passed to the new process.
2669 .Ic update-environment
2670 session option may be used to update the session environment from the client
2671 when a new session is created or an old reattached.
2673 also initialises the
2674 .Ev TMUX
2675 variable with some internal information to allow commands to be executed
2676 from inside, and the
2677 .Ev TERM
2678 variable with the correct terminal setting of
2679 .Ql screen .
2681 Commands to alter and view the environment are:
2682 .Bl -tag -width Ds
2683 .It Xo Ic set-environment
2684 .Op Fl gru
2685 .Op Fl t Ar target-session
2686 .Ar name Op Ar value
2688 .D1 (alias: Ic setenv )
2689 Set or unset an environment variable.
2691 .Fl g
2692 is used, the change is made in the global environment; otherwise, it is applied
2693 to the session environment for
2694 .Ar target-session .
2696 .Fl u
2697 flag unsets a variable.
2698 .Fl r
2699 indicates the variable is to be removed from the environment before starting a
2700 new process.
2701 .It Xo Ic show-environment
2702 .Op Fl g
2703 .Op Fl t Ar target-session
2705 .D1 (alias: Ic showenv )
2706 Display the environment for
2707 .Ar target-session
2708 or the global environment with
2709 .Fl g .
2710 Variables removed from the environment are prefixed with
2711 .Ql - .
2713 .Sh STATUS LINE
2715 includes an optional status line which is displayed in the bottom line of each
2716 terminal.
2717 By default, the status line is enabled (it may be disabled with the
2718 .Ic status
2719 session option) and contains, from left-to-right: the name of the current
2720 session in square brackets; the window list; the current window title in double
2721 quotes; and the time and date.
2723 The status line is made of three parts: configurable left and right sections
2724 (which may contain dynamic content such as the time or output from a shell
2725 command, see the
2726 .Ic status-left ,
2727 .Ic status-left-length ,
2728 .Ic status-right ,
2730 .Ic status-right-length
2731 options below), and a central window list.
2732 By default, the window list shows the index, name and (if any) flag of the
2733 windows present in the current session in ascending numerical order.
2734 It may be customised with the
2735 .Ar window-status-format
2737 .Ar window-status-current-format
2738 options.
2739 The flag is one of the following symbols appended to the window name:
2740 .Bl -column "Symbol" "Meaning" -offset indent
2741 .It Sy "Symbol" Ta Sy "Meaning"
2742 .It Li "*" Ta "Denotes the current window."
2743 .It Li "-" Ta "Marks the last window (previously selected)."
2744 .It Li "#" Ta "Window is monitored and activity has been detected."
2745 .It Li "!" Ta "A bell has occurred in the window."
2746 .It Li "+" Ta "Window is monitored for content and it has appeared."
2747 .It Li "~" Ta "The window has been silent for the monitor-silence interval."
2750 The # symbol relates to the
2751 .Ic monitor-activity
2752 and + to the
2753 .Ic monitor-content
2754 window options.
2755 The window name is printed in inverted colours if an alert (bell, activity or
2756 content) is present.
2758 The colour and attributes of the status line may be configured, the entire
2759 status line using the
2760 .Ic status-attr ,
2761 .Ic status-fg
2763 .Ic status-bg
2764 session options and individual windows using the
2765 .Ic window-status-attr ,
2766 .Ic window-status-fg
2768 .Ic window-status-bg
2769 window options.
2771 The status line is automatically refreshed at interval if it has changed, the
2772 interval may be controlled with the
2773 .Ic status-interval
2774 session option.
2776 Commands related to the status line are as follows:
2777 .Bl -tag -width Ds
2778 .It Xo Ic command-prompt
2779 .Op Fl I Ar inputs
2780 .Op Fl p Ar prompts
2781 .Op Fl t Ar target-client
2782 .Op Ar template
2784 Open the command prompt in a client.
2785 This may be used from inside
2787 to execute commands interactively.
2790 .Ar template
2791 is specified, it is used as the command.
2792 If present,
2793 .Fl I
2794 is a comma-separated list of the initial text for each prompt.
2796 .Fl p
2797 is given,
2798 .Ar prompts
2799 is a comma-separated list of prompts which are displayed in order; otherwise
2800 a single prompt is displayed, constructed from
2801 .Ar template
2802 if it is present, or
2803 .Ql \&:
2804 if not.
2806 Both
2807 .Ar inputs
2809 .Ar prompts
2810 may contain the special character sequences supported by the
2811 .Ic status-left
2812 option.
2814 Before the command is executed, the first occurrence of the string
2815 .Ql %%
2816 and all occurrences of
2817 .Ql %1
2818 are replaced by the response to the first prompt, the second
2819 .Ql %%
2820 and all
2821 .Ql %2
2822 are replaced with the response to the second prompt, and so on for further
2823 prompts.
2824 Up to nine prompt responses may be replaced
2826 .Ql %1
2828 .Ql %9
2829 .Pc .
2830 .It Xo Ic confirm-before
2831 .Op Fl p Ar prompt
2832 .Op Fl t Ar target-client
2833 .Ar command
2835 .D1 (alias: Ic confirm )
2836 Ask for confirmation before executing
2837 .Ar command .
2839 .Fl p
2840 is given,
2841 .Ar prompt
2842 is the prompt to display; otherwise a prompt is constructed from
2843 .Ar command .
2844 It may contain the special character sequences supported by the
2845 .Ic status-left
2846 option.
2848 This command works only from inside
2849 .Nm .
2850 .It Xo Ic display-message
2851 .Op Fl p
2852 .Op Fl c Ar target-client
2853 .Op Fl t Ar target-pane
2854 .Op Ar message
2856 .D1 (alias: Ic display )
2857 Display a message.
2859 .Fl p
2860 is given, the output is printed to stdout, otherwise it is displayed in the
2861 .Ar target-client
2862 status line.
2863 The format of
2864 .Ar message
2865 is as for
2866 .Ic status-left ,
2867 with the exception that #() are not handled; information is taken from
2868 .Ar target-pane
2870 .Fl t
2871 is given, otherwise the active pane for the session attached to
2872 .Ar target-client .
2874 .Sh BUFFERS
2876 maintains a stack of
2877 .Em paste buffers .
2878 Up to the value of the
2879 .Ic buffer-limit
2880 option are kept; when a new buffer is added, the buffer at the bottom of the
2881 stack is removed.
2882 Buffers may be added using
2883 .Ic copy-mode
2884 or the
2885 .Ic set-buffer
2886 command, and pasted into a window using the
2887 .Ic paste-buffer
2888 command.
2890 A configurable history buffer is also maintained for each window.
2891 By default, up to 2000 lines are kept; this can be altered with the
2892 .Ic history-limit
2893 option (see the
2894 .Ic set-option
2895 command above).
2897 The buffer commands are as follows:
2898 .Bl -tag -width Ds
2899 .It Xo
2900 .Ic choose-buffer
2901 .Op Fl t Ar target-window
2902 .Op Ar template
2904 Put a window into buffer choice mode, where a buffer may be chosen
2905 interactively from a list.
2906 After a buffer is selected,
2907 .Ql %%
2908 is replaced by the buffer index in
2909 .Ar template
2910 and the result executed as a command.
2912 .Ar template
2913 is not given, "paste-buffer -b '%%'" is used.
2914 This command works only from inside
2915 .Nm .
2916 .It Ic clear-history Op Fl t Ar target-pane
2917 .D1 (alias: Ic clearhist )
2918 Remove and free the history for the specified pane.
2919 .It Ic delete-buffer Op Fl b Ar buffer-index
2920 .D1 (alias: Ic deleteb )
2921 Delete the buffer at
2922 .Ar buffer-index ,
2923 or the top buffer if not specified.
2924 .It Ic list-buffers
2925 .D1 (alias: Ic lsb )
2926 List the global buffers.
2927 .It Xo Ic load-buffer
2928 .Op Fl b Ar buffer-index
2929 .Ar path
2931 .D1 (alias: Ic loadb )
2932 Load the contents of the specified paste buffer from
2933 .Ar path .
2934 .It Xo Ic paste-buffer
2935 .Op Fl dr
2936 .Op Fl b Ar buffer-index
2937 .Op Fl s Ar separator
2938 .Op Fl t Ar target-pane
2940 .D1 (alias: Ic pasteb )
2941 Insert the contents of a paste buffer into the specified pane.
2942 If not specified, paste into the current one.
2943 With
2944 .Fl d ,
2945 also delete the paste buffer from the stack.
2946 When output, any linefeed (LF) characters in the paste buffer are replaced with
2947 a separator, by default carriage return (CR).
2948 A custom separator may be specified using the
2949 .Fl s
2950 flag.
2952 .Fl r
2953 flag means to do no replacement (equivalent to a separator of LF).
2954 .It Xo Ic save-buffer
2955 .Op Fl a
2956 .Op Fl b Ar buffer-index
2957 .Ar path
2959 .D1 (alias: Ic saveb )
2960 Save the contents of the specified paste buffer to
2961 .Ar path .
2963 .Fl a
2964 option appends to rather than overwriting the file.
2965 .It Xo Ic set-buffer
2966 .Op Fl b Ar buffer-index
2967 .Ar data
2969 .D1 (alias: Ic setb )
2970 Set the contents of the specified buffer to
2971 .Ar data .
2972 .It Xo Ic show-buffer
2973 .Op Fl b Ar buffer-index
2975 .D1 (alias: Ic showb )
2976 Display the contents of the specified buffer.
2978 .Sh MISCELLANEOUS
2979 Miscellaneous commands are as follows:
2980 .Bl -tag -width Ds
2981 .It Ic clock-mode Op Fl t Ar target-pane
2982 Display a large clock.
2983 .It Ic if-shell Ar shell-command command Op Ar command
2984 .D1 (alias: Ic if )
2985 Execute the first
2986 .Ar command
2988 .Ar shell-command
2989 returns success or the second
2990 .Ar command
2991 otherwise.
2992 .It Ic lock-server
2993 .D1 (alias: Ic lock )
2994 Lock each client individually by running the command specified by the
2995 .Ic lock-command
2996 option.
2997 .It Ic run-shell Ar shell-command
2998 .D1 (alias: Ic run )
2999 Execute
3000 .Ar shell-command
3001 in the background without creating a window.
3002 After it finishes, any output to stdout is displayed in copy mode.
3003 If the command doesn't return success, the exit status is also displayed.
3004 .It Ic server-info
3005 .D1 (alias: Ic info )
3006 Show server information and terminal details.
3008 .Sh TERMINFO EXTENSIONS
3010 understands some extensions to
3011 .Xr terminfo 5 :
3012 .Bl -tag -width Ds
3013 .It Em Cc , Cr
3014 Set the cursor colour.
3015 The first takes a single string argument and is used to set the colour;
3016 the second takes no arguments and restores the default cursor colour.
3017 If set, a sequence such as this may be used
3018 to change the cursor colour from inside
3019 .Nm :
3020 .Bd -literal -offset indent
3021 $ printf '\e033]12;red\e033\e\e'
3023 .It Em Cs , Csr
3024 Change the cursor style.
3025 If set, a sequence such as this may be used
3026 to change the cursor to an underline:
3027 .Bd -literal -offset indent
3028 $ printf '\e033[4 q'
3032 .Em Csr
3033 is set, it will be used to reset the cursor style instead
3035 .Em Cs .
3036 .It Em \&Ms
3037 This sequence can be used by
3039 to store the current buffer in the host terminal's selection (clipboard).
3040 See the
3041 .Em set-clipboard
3042 option above and the
3043 .Xr xterm 1
3044 man page.
3046 .Sh FILES
3047 .Bl -tag -width "/etc/tmux.confXXX" -compact
3048 .It Pa ~/.tmux.conf
3049 Default
3051 configuration file.
3052 .It Pa /etc/tmux.conf
3053 System-wide configuration file.
3055 .Sh EXAMPLES
3056 To create a new
3058 session running
3059 .Xr vi 1 :
3061 .Dl $ tmux new-session vi
3063 Most commands have a shorter form, known as an alias.
3064 For new-session, this is
3065 .Ic new :
3067 .Dl $ tmux new vi
3069 Alternatively, the shortest unambiguous form of a command is accepted.
3070 If there are several options, they are listed:
3071 .Bd -literal -offset indent
3072 $ tmux n
3073 ambiguous command: n, could be: new-session, new-window, next-window
3076 Within an active session, a new window may be created by typing
3077 .Ql C-b c
3078 (Ctrl
3079 followed by the
3080 .Ql b
3082 followed by the
3083 .Ql c
3084 key).
3086 Windows may be navigated with:
3087 .Ql C-b 0
3088 (to select window 0),
3089 .Ql C-b 1
3090 (to select window 1), and so on;
3091 .Ql C-b n
3092 to select the next window; and
3093 .Ql C-b p
3094 to select the previous window.
3096 A session may be detached using
3097 .Ql C-b d
3098 (or by an external event such as
3099 .Xr ssh 1
3100 disconnection) and reattached with:
3102 .Dl $ tmux attach-session
3104 Typing
3105 .Ql C-b \&?
3106 lists the current key bindings in the current window; up and down may be used
3107 to navigate the list or
3108 .Ql q
3109 to exit from it.
3111 Commands to be run when the
3113 server is started may be placed in the
3114 .Pa ~/.tmux.conf
3115 configuration file.
3116 Common examples include:
3118 Changing the default prefix key:
3119 .Bd -literal -offset indent
3120 set-option -g prefix C-a
3121 unbind-key C-b
3122 bind-key C-a send-prefix
3125 Turning the status line off, or changing its colour:
3126 .Bd -literal -offset indent
3127 set-option -g status off
3128 set-option -g status-bg blue
3131 Setting other options, such as the default command,
3132 or locking after 30 minutes of inactivity:
3133 .Bd -literal -offset indent
3134 set-option -g default-command "exec /bin/ksh"
3135 set-option -g lock-after-time 1800
3138 Creating new key bindings:
3139 .Bd -literal -offset indent
3140 bind-key b set-option status
3141 bind-key / command-prompt "split-window 'exec man %%'"
3142 bind-key S command-prompt "new-window -n %1 'ssh %1'"
3144 .Sh SEE ALSO
3145 .Xr pty 4
3146 .Sh AUTHORS
3147 .An Nicholas Marriott Aq nicm@users.sourceforge.net