fix error in previous;
[tmux-openbsd.git] / tmux.1
blob2f1bd90e9cf744b0c6236e4c6aa4645851a7e6bf
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.
495 A literal semicolon may be included by escaping it with a backslash (for
496 example, when specifying a command sequence to
497 .Ic bind-key ) .
499 Example
501 commands include:
502 .Bd -literal -offset indent
503 refresh-client -t/dev/ttyp2
505 rename-session -tfirst newname
507 set-window-option -t:0 monitor-activity on
509 new-window ; split-window -d
512 Or from
513 .Xr sh 1 :
514 .Bd -literal -offset indent
515 $ tmux kill-window -t :1
517 $ tmux new-window \e; split-window -d
519 $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
521 .Sh CLIENTS AND SESSIONS
524 server manages clients, sessions, windows and panes.
525 Clients are attached to sessions to interact with them, either
526 when they are created with the
527 .Ic new-session
528 command, or later with the
529 .Ic attach-session
530 command.
531 Each session has one or more windows
532 .Em linked
533 into it.
534 Windows may be linked to multiple sessions and are made up of one or
535 more panes,
536 each of which contains a pseudo terminal.
537 Commands for creating, linking and otherwise manipulating windows
538 are covered
539 in the
540 .Sx WINDOWS AND PANES
541 section.
543 The following commands are available to manage clients and sessions:
544 .Bl -tag -width Ds
545 .It Xo Ic attach-session
546 .Op Fl dr
547 .Op Fl t Ar target-session
549 .D1 (alias: Ic attach )
550 If run from outside
551 .Nm ,
552 create a new client in the current terminal and attach it to
553 .Ar target-session .
554 If used from inside, switch the current client.
556 .Fl d
557 is specified, any other clients attached to the session are detached.
558 .Fl r
559 signifies the client is read-only (only keys bound to the
560 .Ic detach-client
561 command have any effect)
563 If no server is started,
564 .Ic attach-session
565 will attempt to start it; this will fail unless sessions are created in the
566 configuration file.
569 .Ar target-session
570 rules for
571 .Ic attach-session
572 are slightly adjusted: if
574 needs to select the most recently used session, it will prefer the most
575 recently used
576 .Em unattached
577 session.
578 .It Xo Ic detach-client
579 .Op Fl P
580 .Op Fl s Ar target-session
581 .Op Fl t Ar target-client
583 .D1 (alias: Ic detach )
584 Detach the current client if bound to a key, the client specified with
585 .Fl t ,
586 or all clients currently attached to to the session specified by
587 .Fl s .
589 .Fl P
590 is given, send SIGHUP to the parent process of the client, typically causing it
591 to exit.
592 .It Ic has-session Op Fl t Ar target-session
593 .D1 (alias: Ic has )
594 Report an error and exit with 1 if the specified session does not exist.
595 If it does exist, exit with 0.
596 .It Ic kill-server
597 Kill the
599 server and clients and destroy all sessions.
600 .It Ic kill-session Op Fl t Ar target-session
601 Destroy the given session, closing any windows linked to it and no other
602 sessions, and detaching all clients attached to it.
603 .It Ic list-clients Op Fl t Ar target-session
604 .D1 (alias: Ic lsc )
605 List all clients attached to the server.
607 .Ar target-session
608 is specified, list only clients connected to that session.
609 .It Ic list-commands
610 .D1 (alias: Ic lscm )
611 List the syntax of all commands supported by
612 .Nm .
613 .It Ic list-sessions
614 .D1 (alias: Ic ls )
615 List all sessions managed by the server.
616 .It Ic lock-client Op Fl t Ar target-client
617 .D1 (alias: Ic lockc )
618 Lock
619 .Ar target-client ,
620 see the
621 .Ic lock-server
622 command.
623 .It Ic lock-session Op Fl t Ar target-session
624 .D1 (alias: Ic locks )
625 Lock all clients attached to
626 .Ar target-session .
627 .It Xo Ic new-session
628 .Op Fl d
629 .Op Fl n Ar window-name
630 .Op Fl s Ar session-name
631 .Op Fl t Ar target-session
632 .Op Fl x Ar width
633 .Op Fl y Ar height
634 .Op Ar shell-command
636 .D1 (alias: Ic new )
637 Create a new session with name
638 .Ar session-name .
640 The new session is attached to the current terminal unless
641 .Fl d
642 is given.
643 .Ar window-name
645 .Ar shell-command
646 are the name of and shell command to execute in the initial window.
648 .Fl d
649 is used,
650 .Fl x
652 .Fl y
653 specify the size of the initial window (80 by 24 if not given).
655 If run from a terminal, any
656 .Xr termios 4
657 special characters are saved and used for new windows in the new session.
660 .Fl t
661 is given, the new session is
662 .Em grouped
663 with
664 .Ar target-session .
665 This means they share the same set of windows - all windows from
666 .Ar target-session
667 are linked to the new session and any subsequent new windows or windows being
668 closed are applied to both sessions.
669 The current and previous window and any session options remain independent and
670 either session may be killed without affecting the other.
671 Giving
672 .Fl n
674 .Ar shell-command
675 are invalid if
676 .Fl t
677 is used.
678 .It Ic refresh-client Op Fl t Ar target-client
679 .D1 (alias: Ic refresh )
680 Refresh the current client if bound to a key, or a single client if one is given
681 with
682 .Fl t .
683 .It Xo Ic rename-session
684 .Op Fl t Ar target-session
685 .Ar new-name
687 .D1 (alias: Ic rename )
688 Rename the session to
689 .Ar new-name .
690 .It Xo Ic show-messages
691 .Op Fl t Ar target-client
693 .D1 (alias: Ic showmsgs )
694 Any messages displayed on the status line are saved in a per-client message
695 log, up to a maximum of the limit set by the
696 .Ar message-limit
697 session option for the session attached to that client.
698 This command displays the log for
699 .Ar target-client .
700 .It Ic source-file Ar path
701 .D1 (alias: Ic source )
702 Execute commands from
703 .Ar path .
704 .It Ic start-server
705 .D1 (alias: Ic start )
706 Start the
708 server, if not already running, without creating any sessions.
709 .It Xo Ic suspend-client
710 .Op Fl t Ar target-client
712 .D1 (alias: Ic suspendc )
713 Suspend a client by sending
714 .Dv SIGTSTP
715 (tty stop).
716 .It Xo Ic switch-client
717 .Op Fl lnp
718 .Op Fl c Ar target-client
719 .Op Fl t Ar target-session
721 .D1 (alias: Ic switchc )
722 Switch the current session for client
723 .Ar target-client
725 .Ar target-session .
727 .Fl l ,
728 .Fl n
730 .Fl p
731 is used, the client is moved to the last, next or previous session
732 respectively.
734 .Sh WINDOWS AND PANES
737 window may be in one of several modes.
738 The default permits direct access to the terminal attached to the window.
739 The other is copy mode, which permits a section of a window or its
740 history to be copied to a
741 .Em paste buffer
742 for later insertion into another window.
743 This mode is entered with the
744 .Ic copy-mode
745 command, bound to
746 .Ql \&[
747 by default.
748 It is also entered when a command that produces output, such as
749 .Ic list-keys ,
750 is executed from a key binding.
752 The keys available depend on whether emacs or vi mode is selected
753 (see the
754 .Ic mode-keys
755 option).
756 The following keys are supported as appropriate for the mode:
757 .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
758 .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
759 .It Li "Back to indentation" Ta "^" Ta "M-m"
760 .It Li "Bottom of history" Ta "G" Ta "M-<"
761 .It Li "Clear selection" Ta "Escape" Ta "C-g"
762 .It Li "Copy selection" Ta "Enter" Ta "M-w"
763 .It Li "Cursor down" Ta "j" Ta "Down"
764 .It Li "Cursor left" Ta "h" Ta "Left"
765 .It Li "Cursor right" Ta "l" Ta "Right"
766 .It Li "Cursor to bottom line" Ta "L" Ta ""
767 .It Li "Cursor to middle line" Ta "M" Ta "M-r"
768 .It Li "Cursor to top line" Ta "H" Ta "M-R"
769 .It Li "Cursor up" Ta "k" Ta "Up"
770 .It Li "Delete entire line" Ta "d" Ta "C-u"
771 .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
772 .It Li "End of line" Ta "$" Ta "C-e"
773 .It Li "Go to line" Ta ":" Ta "g"
774 .It Li "Half page down" Ta "C-d" Ta "M-Down"
775 .It Li "Half page up" Ta "C-u" Ta "M-Up"
776 .It Li "Jump forward" Ta "f" Ta "f"
777 .It Li "Jump backward" Ta "F" Ta "F"
778 .It Li "Jump again" Ta ";" Ta ";"
779 .It Li "Jump again in reverse" Ta "," Ta ","
780 .It Li "Next page" Ta "C-f" Ta "Page down"
781 .It Li "Next space" Ta "W" Ta ""
782 .It Li "Next space, end of word" Ta "E" Ta ""
783 .It Li "Next word" Ta "w" Ta ""
784 .It Li "Next word end" Ta "e" Ta "M-f"
785 .It Li "Paste buffer" Ta "p" Ta "C-y"
786 .It Li "Previous page" Ta "C-b" Ta "Page up"
787 .It Li "Previous word" Ta "b" Ta "M-b"
788 .It Li "Previous space" Ta "B" Ta ""
789 .It Li "Quit mode" Ta "q" Ta "Escape"
790 .It Li "Rectangle toggle" Ta "v" Ta "R"
791 .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
792 .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
793 .It Li "Search again" Ta "n" Ta "n"
794 .It Li "Search again in reverse" Ta "N" Ta "N"
795 .It Li "Search backward" Ta "?" Ta "C-r"
796 .It Li "Search forward" Ta "/" Ta "C-s"
797 .It Li "Start of line" Ta "0" Ta "C-a"
798 .It Li "Start selection" Ta "Space" Ta "C-Space"
799 .It Li "Top of history" Ta "g" Ta "M->"
800 .It Li "Transpose chars" Ta "" Ta "C-t"
803 The next and previous word keys use space and the
804 .Ql - ,
805 .Ql _
807 .Ql @
808 characters as word delimiters by default, but this can be adjusted by
809 setting the
810 .Em word-separators
811 window option.
812 Next word moves to the start of the next word, next word end to the end of the
813 next word and previous word to the start of the previous word.
814 The three next and previous space keys work similarly but use a space alone as
815 the word separator.
817 The jump commands enable quick movement within a line.
818 For instance, typing
819 .Ql f
820 followed by
821 .Ql /
822 will move the cursor to the next
823 .Ql /
824 character on the current line.
826 .Ql \&;
827 will then jump to the next occurrence.
829 Commands in copy mode may be prefaced by an optional repeat count.
830 With vi key bindings, a prefix is entered using the number keys; with
831 emacs, the Alt (meta) key and a number begins prefix entry.
832 For example, to move the cursor forward by ten words, use
833 .Ql M-1 0 M-f
834 in emacs mode, and
835 .Ql 10w
836 in vi.
838 Mode key bindings are defined in a set of named tables:
839 .Em vi-edit
841 .Em emacs-edit
842 for keys used when line editing at the command prompt;
843 .Em vi-choice
845 .Em emacs-choice
846 for keys used when choosing from lists (such as produced by the
847 .Ic choose-window
848 command); and
849 .Em vi-copy
851 .Em emacs-copy
852 used in copy mode.
853 The tables may be viewed with the
854 .Ic list-keys
855 command and keys modified or removed with
856 .Ic bind-key
858 .Ic unbind-key .
860 The paste buffer key pastes the first line from the top paste buffer on the
861 stack.
863 The synopsis for the
864 .Ic copy-mode
865 command is:
866 .Bl -tag -width Ds
867 .It Xo Ic copy-mode
868 .Op Fl u
869 .Op Fl t Ar target-pane
871 Enter copy mode.
873 .Fl u
874 option scrolls one page up.
877 Each window displayed by
879 may be split into one or more
880 .Em panes ;
881 each pane takes up a certain area of the display and is a separate terminal.
882 A window may be split into panes using the
883 .Ic split-window
884 command.
885 Windows may be split horizontally (with the
886 .Fl h
887 flag) or vertically.
888 Panes may be resized with the
889 .Ic resize-pane
890 command (bound to
891 .Ql C-up ,
892 .Ql C-down
893 .Ql C-left
895 .Ql C-right
896 by default), the current pane may be changed with the
897 .Ic select-pane
898 command and the
899 .Ic rotate-window
901 .Ic swap-pane
902 commands may be used to swap panes without changing their position.
903 Panes are numbered beginning from zero in the order they are created.
905 A number of preset
906 .Em layouts
907 are available.
908 These may be selected with the
909 .Ic select-layout
910 command or cycled with
911 .Ic next-layout
912 (bound to
913 .Ql Space
914 by default); once a layout is chosen, panes within it may be moved and resized
915 as normal.
917 The following layouts are supported:
918 .Bl -tag -width Ds
919 .It Ic even-horizontal
920 Panes are spread out evenly from left to right across the window.
921 .It Ic even-vertical
922 Panes are spread evenly from top to bottom.
923 .It Ic main-horizontal
924 A large (main) pane is shown at the top of the window and the remaining panes
925 are spread from left to right in the leftover space at the bottom.
926 Use the
927 .Em main-pane-height
928 window option to specify the height of the top pane.
929 .It Ic main-vertical
930 Similar to
931 .Ic main-horizontal
932 but the large pane is placed on the left and the others spread from top to
933 bottom along the right.
934 See the
935 .Em main-pane-width
936 window option.
937 .It Ic tiled
938 Panes are spread out as evenly as possible over the window in both rows and
939 columns.
942 In addition,
943 .Ic select-layout
944 may be used to apply a previously used layout - the
945 .Ic list-windows
946 command displays the layout of each window in a form suitable for use with
947 .Ic select-layout .
948 For example:
949 .Bd -literal -offset indent
950 $ tmux list-windows
951 0: ksh [159x48]
952     layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
953 $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
957 automatically adjusts the size of the layout for the current window size.
958 Note that a layout cannot be applied to a window with more panes than that
959 from which the layout was originally defined.
961 Commands related to windows and panes are as follows:
962 .Bl -tag -width Ds
963 .It Xo Ic break-pane
964 .Op Fl d
965 .Op Fl t Ar target-pane
967 .D1 (alias: Ic breakp )
968 Break
969 .Ar target-pane
970 off from its containing window to make it the only pane in a new window.
972 .Fl d
973 is given, the new window does not become the current window.
974 .It Xo Ic capture-pane
975 .Op Fl b Ar buffer-index
976 .Op Fl E Ar end-line
977 .Op Fl S Ar start-line
978 .Op Fl t Ar target-pane
980 .D1 (alias: Ic capturep )
981 Capture the contents of a pane to the specified buffer, or a new buffer if none
982 is specified.
984 .Fl S
986 .Fl E
987 specify the starting and ending line numbers, zero is the first line of the
988 visible pane and negative numbers are lines in the history.
989 The default is to capture only the visible contents of the pane.
990 .It Xo
991 .Ic choose-client
992 .Op Fl t Ar target-window
993 .Op Ar template
995 Put a window into client choice mode, allowing a client to be selected
996 interactively from a list.
997 After a client is chosen,
998 .Ql %%
999 is replaced by the client
1000 .Xr pty 4
1001 path in
1002 .Ar template
1003 and the result executed as a command.
1005 .Ar template
1006 is not given, "detach-client -t '%%'" is used.
1007 This command works only from inside
1008 .Nm .
1009 .It Xo
1010 .Ic choose-session
1011 .Op Fl t Ar target-window
1012 .Op Ar template
1014 Put a window into session choice mode, where a session may be selected
1015 interactively from a list.
1016 When one is chosen,
1017 .Ql %%
1018 is replaced by the session name in
1019 .Ar template
1020 and the result executed as a command.
1022 .Ar template
1023 is not given, "switch-client -t '%%'" is used.
1024 This command works only from inside
1025 .Nm .
1026 .It Xo
1027 .Ic choose-window
1028 .Op Fl t Ar target-window
1029 .Op Ar template
1031 Put a window into window choice mode, where a window may be chosen
1032 interactively from a list.
1033 After a window is selected,
1034 .Ql %%
1035 is replaced by the session name and window index in
1036 .Ar template
1037 and the result executed as a command.
1039 .Ar template
1040 is not given, "select-window -t '%%'" is used.
1041 This command works only from inside
1042 .Nm .
1043 .It Ic display-panes Op Fl t Ar target-client
1044 .D1 (alias: Ic displayp)
1045 Display a visible indicator of each pane shown by
1046 .Ar target-client .
1047 See the
1048 .Ic display-panes-time ,
1049 .Ic display-panes-colour ,
1051 .Ic display-panes-active-colour
1052 session options.
1053 While the indicator is on screen, a pane may be selected with the
1054 .Ql 0
1056 .Ql 9
1057 keys.
1058 .It Xo Ic find-window
1059 .Op Fl t Ar target-window
1060 .Ar match-string
1062 .D1 (alias: Ic findw )
1063 Search for the
1064 .Xr fnmatch 3
1065 pattern
1066 .Ar match-string
1067 in window names, titles, and visible content (but not history).
1068 If only one window is matched, it'll be automatically selected, otherwise a
1069 choice list is shown.
1070 This command only works from inside
1071 .Nm .
1072 .It Xo Ic join-pane
1073 .Op Fl dhv
1074 .Oo Fl l
1075 .Ar size |
1076 .Fl p Ar percentage Oc
1077 .Op Fl s Ar src-pane
1078 .Op Fl t Ar dst-pane
1080 .D1 (alias: Ic joinp )
1081 Like
1082 .Ic split-window ,
1083 but instead of splitting
1084 .Ar dst-pane
1085 and creating a new pane, split it and move
1086 .Ar src-pane
1087 into the space.
1088 This can be used to reverse
1089 .Ic break-pane .
1090 .It Xo Ic kill-pane
1091 .Op Fl a
1092 .Op Fl t Ar target-pane
1094 .D1 (alias: Ic killp )
1095 Destroy the given pane.
1096 If no panes remain in the containing window, it is also destroyed.
1098 .Fl a
1099 option kills all but the pane given with
1100 .Fl t .
1101 .It Ic kill-window Op Fl t Ar target-window
1102 .D1 (alias: Ic killw )
1103 Kill the current window or the window at
1104 .Ar target-window ,
1105 removing it from any sessions to which it is linked.
1106 .It Ic last-pane Op Fl t Ar target-window
1107 .D1 (alias: Ic lastp )
1108 Select the last (previously selected) pane.
1109 .It Ic last-window Op Fl t Ar target-session
1110 .D1 (alias: Ic last )
1111 Select the last (previously selected) window.
1112 If no
1113 .Ar target-session
1114 is specified, select the last window of the current session.
1115 .It Xo Ic link-window
1116 .Op Fl dk
1117 .Op Fl s Ar src-window
1118 .Op Fl t Ar dst-window
1120 .D1 (alias: Ic linkw )
1121 Link the window at
1122 .Ar src-window
1123 to the specified
1124 .Ar dst-window .
1126 .Ar dst-window
1127 is specified and no such window exists, the
1128 .Ar src-window
1129 is linked there.
1131 .Fl k
1132 is given and
1133 .Ar dst-window
1134 exists, it is killed, otherwise an error is generated.
1136 .Fl d
1137 is given, the newly linked window is not selected.
1138 .It Xo Ic list-panes
1139 .Op Fl as
1140 .Op Fl t Ar target
1142 .D1 (alias: Ic lsp )
1144 .Fl a
1145 is given,
1146 .Ar target
1147 is ignored and all panes on the server are listed.
1149 .Fl s
1150 is given,
1151 .Ar target
1152 is a session (or the current session).
1153 If neither is given,
1154 .Ar target
1155 is a window (or the current window).
1156 .It Xo Ic list-windows
1157 .Op Fl a
1158 .Op Fl t Ar target-session
1160 .D1 (alias: Ic lsw )
1162 .Fl a
1163 is given, list all windows on the server.
1164 Otherwise, list windows in the current session or in
1165 .Ar target-session .
1166 .It Xo Ic move-window
1167 .Op Fl dk
1168 .Op Fl s Ar src-window
1169 .Op Fl t Ar dst-window
1171 .D1 (alias: Ic movew )
1172 This is similar to
1173 .Ic link-window ,
1174 except the window at
1175 .Ar src-window
1176 is moved to
1177 .Ar dst-window .
1178 .It Xo Ic new-window
1179 .Op Fl adkP
1180 .Op Fl n Ar window-name
1181 .Op Fl t Ar target-window
1182 .Op Ar shell-command
1184 .D1 (alias: Ic neww )
1185 Create a new window.
1186 With
1187 .Fl a ,
1188 the new window is inserted at the next index up from the specified
1189 .Ar target-window ,
1190 moving windows up if necessary,
1191 otherwise
1192 .Ar target-window
1193 is the new window location.
1196 .Fl d
1197 is given, the session does not make the new window the current window.
1198 .Ar target-window
1199 represents the window to be created; if the target already exists an error is
1200 shown, unless the
1201 .Fl k
1202 flag is used, in which case it is destroyed.
1203 .Ar shell-command
1204 is the command to execute.
1206 .Ar shell-command
1207 is not specified, the value of the
1208 .Ic default-command
1209 option is used.
1211 When the shell command completes, the window closes.
1212 See the
1213 .Ic remain-on-exit
1214 option to change this behaviour.
1217 .Ev TERM
1218 environment variable must be set to
1219 .Dq screen
1220 for all programs running
1221 .Em inside
1222 .Nm .
1223 New windows will automatically have
1224 .Dq TERM=screen
1225 added to their environment, but care must be taken not to reset this in shell
1226 start-up files.
1229 .Fl P
1230 option prints the location of the new window after it has been created.
1231 .It Ic next-layout Op Fl t Ar target-window
1232 .D1 (alias: Ic nextl )
1233 Move a window to the next layout and rearrange the panes to fit.
1234 .It Xo Ic next-window
1235 .Op Fl a
1236 .Op Fl t Ar target-session
1238 .D1 (alias: Ic next )
1239 Move to the next window in the session.
1241 .Fl a
1242 is used, move to the next window with a bell, activity or content alert.
1243 .It Xo Ic pipe-pane
1244 .Op Fl o
1245 .Op Fl t Ar target-pane
1246 .Op Ar shell-command
1248 .D1 (alias: Ic pipep )
1249 Pipe any output sent by the program in
1250 .Ar target-pane
1251 to a shell command.
1252 A pane may only be piped to one command at a time, any existing pipe is
1253 closed before
1254 .Ar shell-command
1255 is executed.
1257 .Ar shell-command
1258 string may contain the special character sequences supported by the
1259 .Ic status-left
1260 option.
1261 If no
1262 .Ar shell-command
1263 is given, the current pipe (if any) is closed.
1266 .Fl o
1267 option only opens a new pipe if no previous pipe exists, allowing a pipe to
1268 be toggled with a single key, for example:
1269 .Bd -literal -offset indent
1270 bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
1272 .It Xo Ic previous-layout
1273 .Op Fl t Ar target-window
1275 .D1 (alias: Ic prevl )
1276 Move to the previous layout in the session.
1277 .It Xo Ic previous-window
1278 .Op Fl a
1279 .Op Fl t Ar target-session
1281 .D1 (alias: Ic prev )
1282 Move to the previous window in the session.
1283 With
1284 .Fl a ,
1285 move to the previous window with a bell, activity or content alert.
1286 .It Xo Ic rename-window
1287 .Op Fl t Ar target-window
1288 .Ar new-name
1290 .D1 (alias: Ic renamew )
1291 Rename the current window, or the window at
1292 .Ar target-window
1293 if specified, to
1294 .Ar new-name .
1295 .It Xo Ic resize-pane
1296 .Op Fl DLRU
1297 .Op Fl t Ar target-pane
1298 .Op Ar adjustment
1300 .D1 (alias: Ic resizep )
1301 Resize a pane, upward with
1302 .Fl U
1303 (the default), downward with
1304 .Fl D ,
1305 to the left with
1306 .Fl L
1307 and to the right with
1308 .Fl R .
1310 .Ar adjustment
1311 is given in lines or cells (the default is 1).
1312 .It Xo Ic respawn-pane
1313 .Op Fl k
1314 .Op Fl t Ar target-pane
1315 .Op Ar shell-command
1317 .D1 (alias: Ic respawnp )
1318 Reactivate a pane in which the command has exited (see the
1319 .Ic remain-on-exit
1320 window option).
1322 .Ar shell-command
1323 is not given, the command used when the pane was created is executed.
1324 The pane must be already inactive, unless
1325 .Fl k
1326 is given, in which case any existing command is killed.
1327 .It Xo Ic respawn-window
1328 .Op Fl k
1329 .Op Fl t Ar target-window
1330 .Op Ar shell-command
1332 .D1 (alias: Ic respawnw )
1333 Reactivate a window in which the command has exited (see the
1334 .Ic remain-on-exit
1335 window option).
1337 .Ar shell-command
1338 is not given, the command used when the window was created is executed.
1339 The window must be already inactive, unless
1340 .Fl k
1341 is given, in which case any existing command is killed.
1342 .It Xo Ic rotate-window
1343 .Op Fl DU
1344 .Op Fl t Ar target-window
1346 .D1 (alias: Ic rotatew )
1347 Rotate the positions of the panes within a window, either upward (numerically
1348 lower) with
1349 .Fl U
1350 or downward (numerically higher).
1351 .It Xo Ic select-layout
1352 .Op Fl np
1353 .Op Fl t Ar target-window
1354 .Op Ar layout-name
1356 .D1 (alias: Ic selectl )
1357 Choose a specific layout for a window.
1359 .Ar layout-name
1360 is not given, the last preset layout used (if any) is reapplied.
1361 .Fl n
1363 .Fl p
1364 are equivalent to the
1365 .Ic next-layout
1367 .Ic previous-layout
1368 commands.
1369 .It Xo Ic select-pane
1370 .Op Fl lDLRU
1371 .Op Fl t Ar target-pane
1373 .D1 (alias: Ic selectp )
1374 Make pane
1375 .Ar target-pane
1376 the active pane in window
1377 .Ar target-window .
1378 If one of
1379 .Fl D ,
1380 .Fl L ,
1381 .Fl R ,
1383 .Fl U
1384 is used, respectively the pane below, to the left, to the right, or above the
1385 target pane is used.
1386 .Fl l
1387 is the same as using the
1388 .Ic last-pane
1389 command.
1390 .It Xo Ic select-window
1391 .Op Fl lnp
1392 .Op Fl t Ar target-window
1394 .D1 (alias: Ic selectw )
1395 Select the window at
1396 .Ar target-window .
1397 .Fl l ,
1398 .Fl n
1400 .Fl p
1401 are equivalent to the
1402 .Ic last-window ,
1403 .Ic next-window
1405 .Ic previous-window
1406 commands.
1407 .It Xo Ic split-window
1408 .Op Fl dhvP
1409 .Oo Fl l
1410 .Ar size |
1411 .Fl p Ar percentage Oc
1412 .Op Fl t Ar target-pane
1413 .Op Ar shell-command
1415 .D1 (alias: Ic splitw )
1416 Create a new pane by splitting
1417 .Ar target-pane :
1418 .Fl h
1419 does a horizontal split and
1420 .Fl v
1421 a vertical split; if neither is specified,
1422 .Fl v
1423 is assumed.
1425 .Fl l
1427 .Fl p
1428 options specify the size of the new pane in lines (for vertical split) or in
1429 cells (for horizontal split), or as a percentage, respectively.
1430 All other options have the same meaning as for the
1431 .Ic new-window
1432 command.
1433 .It Xo Ic swap-pane
1434 .Op Fl dDU
1435 .Op Fl s Ar src-pane
1436 .Op Fl t Ar dst-pane
1438 .D1 (alias: Ic swapp )
1439 Swap two panes.
1441 .Fl U
1442 is used and no source pane is specified with
1443 .Fl s ,
1444 .Ar dst-pane
1445 is swapped with the previous pane (before it numerically);
1446 .Fl D
1447 swaps with the next pane (after it numerically).
1448 .Fl d
1449 instructs
1451 not to change the active pane.
1452 .It Xo Ic swap-window
1453 .Op Fl d
1454 .Op Fl s Ar src-window
1455 .Op Fl t Ar dst-window
1457 .D1 (alias: Ic swapw )
1458 This is similar to
1459 .Ic link-window ,
1460 except the source and destination windows are swapped.
1461 It is an error if no window exists at
1462 .Ar src-window .
1463 .It Xo Ic unlink-window
1464 .Op Fl k
1465 .Op Fl t Ar target-window
1467 .D1 (alias: Ic unlinkw )
1468 Unlink
1469 .Ar target-window .
1470 Unless
1471 .Fl k
1472 is given, a window may be unlinked only if it is linked to multiple sessions -
1473 windows may not be linked to no sessions;
1475 .Fl k
1476 is specified and the window is linked to only one session, it is unlinked and
1477 destroyed.
1479 .Sh KEY BINDINGS
1481 allows a command to be bound to most keys, with or without a prefix key.
1482 When specifying keys, most represent themselves (for example
1483 .Ql A
1485 .Ql Z ) .
1486 Ctrl keys may be prefixed with
1487 .Ql C-
1489 .Ql ^ ,
1490 and Alt (meta) with
1491 .Ql M- .
1492 In addition, the following special key names are accepted:
1493 .Em Up ,
1494 .Em Down ,
1495 .Em Left ,
1496 .Em Right ,
1497 .Em BSpace ,
1498 .Em BTab ,
1499 .Em DC
1500 (Delete),
1501 .Em End ,
1502 .Em Enter ,
1503 .Em Escape ,
1504 .Em F1
1506 .Em F20 ,
1507 .Em Home ,
1508 .Em IC
1509 (Insert),
1510 .Em NPage
1511 (Page Up),
1512 .Em PPage
1513 (Page Down),
1514 .Em Space ,
1516 .Em Tab .
1517 Note that to bind the
1518 .Ql \&"
1520 .Ql '
1521 keys, quotation marks are necessary, for example:
1522 .Bd -literal -offset indent
1523 bind-key '"' split-window
1524 bind-key "'" new-window
1527 Commands related to key bindings are as follows:
1528 .Bl -tag -width Ds
1529 .It Xo Ic bind-key
1530 .Op Fl cnr
1531 .Op Fl t Ar key-table
1532 .Ar key Ar command Op Ar arguments
1534 .D1 (alias: Ic bind )
1535 Bind key
1536 .Ar key
1538 .Ar command .
1539 By default (without
1540 .Fl t )
1541 the primary key bindings are modified (those normally activated with the prefix
1542 key); in this case, if
1543 .Fl n
1544 is specified, it is not necessary to use the prefix key,
1545 .Ar command
1546 is bound to
1547 .Ar key
1548 alone.
1550 .Fl r
1551 flag indicates this key may repeat, see the
1552 .Ic repeat-time
1553 option.
1556 .Fl t
1557 is present,
1558 .Ar key
1559 is bound in
1560 .Ar key-table :
1561 the binding for command mode with
1562 .Fl c
1563 or for normal mode without.
1564 To view the default bindings and possible commands, see the
1565 .Ic list-keys
1566 command.
1567 .It Ic list-keys Op Fl t Ar key-table
1568 .D1 (alias: Ic lsk )
1569 List all key bindings.
1570 Without
1571 .Fl t
1572 the primary key bindings - those executed when preceded by the prefix key -
1573 are printed.
1574 Keys bound without the prefix key (see
1575 .Ic bind-key
1576 .Fl n )
1577 are marked with
1578 .Ql (no prefix) .
1580 With
1581 .Fl t ,
1582 the key bindings in
1583 .Ar key-table
1584 are listed; this may be one of:
1585 .Em vi-edit ,
1586 .Em emacs-edit ,
1587 .Em vi-choice ,
1588 .Em emacs-choice ,
1589 .Em vi-copy
1591 .Em emacs-copy .
1592 .It Xo Ic send-keys
1593 .Op Fl t Ar target-pane
1594 .Ar key Ar ...
1596 .D1 (alias: Ic send )
1597 Send a key or keys to a window.
1598 Each argument
1599 .Ar key
1600 is the name of the key (such as
1601 .Ql C-a
1603 .Ql npage
1604 ) to send; if the string is not recognised as a key, it is sent as a series of
1605 characters.
1606 All arguments are sent sequentially from first to last.
1607 .It Ic send-prefix Op Fl t Ar target-pane
1608 Send the prefix key to a window as if it was pressed.
1609 If multiple prefix keys are configured, only the first is sent.
1610 .It Xo Ic unbind-key
1611 .Op Fl acn
1612 .Op Fl t Ar key-table
1613 .Ar key
1615 .D1 (alias: Ic unbind )
1616 Unbind the command bound to
1617 .Ar key .
1618 Without
1619 .Fl t
1620 the primary key bindings are modified; in this case, if
1621 .Fl n
1622 is specified, the command bound to
1623 .Ar key
1624 without a prefix (if any) is removed.
1626 .Fl a
1627 is present, all key bindings are removed.
1630 .Fl t
1631 is present,
1632 .Ar key
1634 .Ar key-table
1635 is unbound: the binding for command mode with
1636 .Fl c
1637 or for normal mode without.
1639 .Sh OPTIONS
1640 The appearance and behaviour of
1642 may be modified by changing the value of various options.
1643 There are three types of option:
1644 .Em server options ,
1645 .Em session options
1647 .Em window options .
1651 server has a set of global options which do not apply to any particular
1652 window or session.
1653 These are altered with the
1654 .Ic set-option
1655 .Fl s
1656 command, or displayed with the
1657 .Ic show-options
1658 .Fl s
1659 command.
1661 In addition, each individual session may have a set of session options, and
1662 there is a separate set of global session options.
1663 Sessions which do not have a particular option configured inherit the value
1664 from the global session options.
1665 Session options are set or unset with the
1666 .Ic set-option
1667 command and may be listed with the
1668 .Ic show-options
1669 command.
1670 The available server and session options are listed under the
1671 .Ic set-option
1672 command.
1674 Similarly, a set of window options is attached to each window, and there is
1675 a set of global window options from which any unset options are inherited.
1676 Window options are altered with the
1677 .Ic set-window-option
1678 command and can be listed with the
1679 .Ic show-window-options
1680 command.
1681 All window options are documented with the
1682 .Ic set-window-option
1683 command.
1685 Commands which set options are as follows:
1686 .Bl -tag -width Ds
1687 .It Xo Ic set-option
1688 .Op Fl agsuw
1689 .Op Fl t Ar target-session | Ar target-window
1690 .Ar option Ar value
1692 .D1 (alias: Ic set )
1693 Set a window option with
1694 .Fl w
1695 (equivalent to the
1696 .Ic set-window-option
1697 command),
1698 a server option with
1699 .Fl s ,
1700 otherwise a session option.
1703 .Fl g
1704 is specified, the global session or window option is set.
1705 With
1706 .Fl a ,
1707 and if the option expects a string,
1708 .Ar value
1709 is appended to the existing setting.
1711 .Fl u
1712 flag unsets an option, so a session inherits the option from the global
1713 options.
1714 It is not possible to unset a global option.
1716 Available window options are listed under
1717 .Ic set-window-option .
1719 Available server options are:
1720 .Bl -tag -width Ds
1721 .It Ic buffer-limit Ar number
1722 Set the number of buffers; as new buffers are added to the top of the stack,
1723 old ones are removed from the bottom if necessary to maintain this maximum
1724 length.
1725 .It Ic escape-time Ar time
1726 Set the time in milliseconds for which
1728 waits after an escape is input to determine if it is part of a function or meta
1729 key sequences.
1730 The default is 500 milliseconds.
1731 .It Xo Ic exit-unattached
1732 .Op Ic on | off
1734 If enabled, the server will exit when there are no attached clients.
1735 .It Xo Ic quiet
1736 .Op Ic on | off
1738 Enable or disable the display of various informational messages (see also the
1739 .Fl q
1740 command line flag).
1741 .It Xo Ic set-clipboard
1742 .Op Ic on | off
1744 Attempt to set the terminal clipboard content using the
1745 \ee]52;...\e007
1746 .Xr xterm 1
1747 escape sequences.
1748 This option is on by default if there is an
1749 .Em \&Ms
1750 entry in the
1751 .Xr terminfo 5
1752 description for the client terminal.
1753 Note that this feature needs to be enabled in
1754 .Xr xterm 1
1755 by setting the resource:
1756 .Bd -literal -offset indent
1757 disallowedWindowOps: 20,21,SetXprop
1760 Or changing this property from the
1761 .Xr xterm 1
1762 interactive menu when required.
1765 Available session options are:
1766 .Bl -tag -width Ds
1767 .It Ic base-index Ar index
1768 Set the base index from which an unused index should be searched when a new
1769 window is created.
1770 The default is zero.
1771 .It Xo Ic bell-action
1772 .Op Ic any | none | current
1774 Set action on window bell.
1775 .Ic any
1776 means a bell in any window linked to a session causes a bell in the current
1777 window of that session,
1778 .Ic none
1779 means all bells are ignored and
1780 .Ic current
1781 means only bell in windows other than the current window are ignored.
1782 .It Xo Ic bell-on-alert
1783 .Op Ic on | off
1785 If on, ring the terminal bell when an activity, content or silence alert
1786 occurs.
1787 .It Ic default-command Ar shell-command
1788 Set the command used for new windows (if not specified when the window is
1789 created) to
1790 .Ar shell-command ,
1791 which may be any
1792 .Xr sh 1
1793 command.
1794 The default is an empty string, which instructs
1796 to create a login shell using the value of the
1797 .Ic default-shell
1798 option.
1799 .It Ic default-path Ar path
1800 Set the default working directory for processes created from keys, or
1801 interactively from the prompt.
1802 The default is empty, which means to use the working directory of the shell
1803 from which the server was started if it is available or the user's home if not.
1804 .It Ic default-shell Ar path
1805 Specify the default shell.
1806 This is used as the login shell for new windows when the
1807 .Ic default-command
1808 option is set to empty, and must be the full path of the executable.
1809 When started
1811 tries to set a default value from the first suitable of the
1812 .Ev SHELL
1813 environment variable, the shell returned by
1814 .Xr getpwuid 3 ,
1816 .Pa /bin/sh .
1817 This option should be configured when
1819 is used as a login shell.
1820 .It Ic default-terminal Ar terminal
1821 Set the default terminal for new windows created in this session - the
1822 default value of the
1823 .Ev TERM
1824 environment variable.
1827 to work correctly, this
1828 .Em must
1829 be set to
1830 .Ql screen
1831 or a derivative of it.
1832 .It Xo Ic destroy-unattached
1833 .Op Ic on | off
1835 If enabled and the session is no longer attached to any clients, it is
1836 destroyed.
1837 .It Xo Ic detach-on-destroy
1838 .Op Ic on | off
1840 If on (the default), the client is detached when the session it is attached to
1841 is destroyed.
1842 If off, the client is switched to the most recently active of the remaining
1843 sessions.
1844 .It Ic display-panes-active-colour Ar colour
1845 Set the colour used by the
1846 .Ic display-panes
1847 command to show the indicator for the active pane.
1848 .It Ic display-panes-colour Ar colour
1849 Set the colour used by the
1850 .Ic display-panes
1851 command to show the indicators for inactive panes.
1852 .It Ic display-panes-time Ar time
1853 Set the time in milliseconds for which the indicators shown by the
1854 .Ic display-panes
1855 command appear.
1856 .It Ic display-time Ar time
1857 Set the amount of time for which status line messages and other on-screen
1858 indicators are displayed.
1859 .Ar time
1860 is in milliseconds.
1861 .It Ic history-limit Ar lines
1862 Set the maximum number of lines held in window history.
1863 This setting applies only to new windows - existing window histories are not
1864 resized and retain the limit at the point they were created.
1865 .It Ic lock-after-time Ar number
1866 Lock the session (like the
1867 .Ic lock-session
1868 command) after
1869 .Ar number
1870 seconds of inactivity, or the entire server (all sessions) if the
1871 .Ic lock-server
1872 option is set.
1873 The default is not to lock (set to 0).
1874 .It Ic lock-command Ar shell-command
1875 Command to run when locking each client.
1876 The default is to run
1877 .Xr lock 1
1878 with
1879 .Fl np .
1880 .It Xo Ic lock-server
1881 .Op Ic on | off
1883 If this option is
1884 .Ic on
1885 (the default),
1886 instead of each session locking individually as each has been
1887 idle for
1888 .Ic lock-after-time ,
1889 the entire server will lock after
1890 .Em all
1891 sessions would have locked.
1892 This has no effect as a session option; it must be set as a global option.
1893 .It Ic message-attr Ar attributes
1894 Set status line message attributes, where
1895 .Ar attributes
1896 is either
1897 .Ic none
1898 or a comma-delimited list of one or more of:
1899 .Ic bright
1901 .Ic bold ) ,
1902 .Ic dim ,
1903 .Ic underscore ,
1904 .Ic blink ,
1905 .Ic reverse ,
1906 .Ic hidden ,
1908 .Ic italics .
1909 .It Ic message-bg Ar colour
1910 Set status line message background colour, where
1911 .Ar colour
1912 is one of:
1913 .Ic black ,
1914 .Ic red ,
1915 .Ic green ,
1916 .Ic yellow ,
1917 .Ic blue ,
1918 .Ic magenta ,
1919 .Ic cyan ,
1920 .Ic white ,
1921 .Ic colour0
1923 .Ic colour255
1924 from the 256-colour set,
1925 .Ic default ,
1926 or a hexadecimal RGB string such as
1927 .Ql #ffffff ,
1928 which chooses the closest match from the default 256-colour set.
1929 .It Ic message-fg Ar colour
1930 Set status line message foreground colour.
1931 .It Ic message-limit Ar number
1932 Set the number of error or information messages to save in the message log for
1933 each client.
1934 The default is 20.
1935 .It Xo Ic mouse-resize-pane
1936 .Op Ic on | off
1938 If on,
1940 captures the mouse and allows panes to be resized by dragging on their borders.
1941 .It Xo Ic mouse-select-pane
1942 .Op Ic on | off
1944 If on,
1946 captures the mouse and when a window is split into multiple panes the mouse may
1947 be used to select the current pane.
1948 The mouse click is also passed through to the application as normal.
1949 .It Xo Ic mouse-select-window
1950 .Op Ic on | off
1952 If on, clicking the mouse on a window name in the status line will select that
1953 window.
1954 .It Xo Ic mouse-utf8
1955 .Op Ic on | off
1957 If enabled, request mouse input as UTF-8 on UTF-8 terminals.
1958 .It Ic pane-active-border-bg Ar colour
1959 .It Ic pane-active-border-fg Ar colour
1960 Set the pane border colour for the currently active pane.
1961 .It Ic pane-border-bg Ar colour
1962 .It Ic pane-border-fg Ar colour
1963 Set the pane border colour for panes aside from the active pane.
1964 .It Ic prefix Ar keys
1965 Set the keys accepted as a prefix key.
1966 .Ar keys
1967 is a comma-separated list of key names, each of which individually behave as
1968 the prefix key.
1969 .It Ic repeat-time Ar time
1970 Allow multiple commands to be entered without pressing the prefix-key again
1971 in the specified
1972 .Ar time
1973 milliseconds (the default is 500).
1974 Whether a key repeats may be set when it is bound using the
1975 .Fl r
1976 flag to
1977 .Ic bind-key .
1978 Repeat is enabled for the default keys bound to the
1979 .Ic resize-pane
1980 command.
1981 .It Xo Ic set-remain-on-exit
1982 .Op Ic on | off
1984 Set the
1985 .Ic remain-on-exit
1986 window option for any windows first created in this session.
1987 When this option is true, windows in which the running program has
1988 exited do not close, instead remaining open but inactivate.
1989 Use the
1990 .Ic respawn-window
1991 command to reactivate such a window, or the
1992 .Ic kill-window
1993 command to destroy it.
1994 .It Xo Ic set-titles
1995 .Op Ic on | off
1997 Attempt to set the window title using the \ee]2;...\e007 xterm code if
1998 the terminal appears to be an xterm.
1999 This option is off by default.
2000 Note that elinks
2001 will only attempt to set the window title if the STY environment
2002 variable is set.
2003 .It Ic set-titles-string Ar string
2004 String used to set the window title if
2005 .Ic set-titles
2006 is on.
2007 Character sequences are replaced as for the
2008 .Ic status-left
2009 option.
2010 .It Xo Ic status
2011 .Op Ic on | off
2013 Show or hide the status line.
2014 .It Ic status-attr Ar attributes
2015 Set status line attributes.
2016 .It Ic status-bg Ar colour
2017 Set status line background colour.
2018 .It Ic status-fg Ar colour
2019 Set status line foreground colour.
2020 .It Ic status-interval Ar interval
2021 Update the status bar every
2022 .Ar interval
2023 seconds.
2024 By default, updates will occur every 15 seconds.
2025 A setting of zero disables redrawing at interval.
2026 .It Xo Ic status-justify
2027 .Op Ic left | centre | right
2029 Set the position of the window list component of the status line: left, centre
2030 or right justified.
2031 .It Xo Ic status-keys
2032 .Op Ic vi | emacs
2034 Use vi or emacs-style
2035 key bindings in the status line, for example at the command prompt.
2036 The default is emacs, unless the
2037 .Ev VISUAL
2039 .Ev EDITOR
2040 environment variables are set and contain the string
2041 .Ql vi .
2042 .It Ic status-left Ar string
2043 Display
2044 .Ar string
2045 to the left of the status bar.
2046 .Ar string
2047 will be passed through
2048 .Xr strftime 3
2049 before being used.
2050 By default, the session name is shown.
2051 .Ar string
2052 may contain any of the following special character sequences:
2053 .Bl -column "Character pair" "Replaced with" -offset indent
2054 .It Sy "Character pair" Ta Sy "Replaced with"
2055 .It Li "#(shell-command)" Ta "First line of the command's output"
2056 .It Li "#[attributes]" Ta "Colour or attribute change"
2057 .It Li "#H" Ta "Hostname of local host"
2058 .It Li "#h" Ta "Hostname of local host without the domain name"
2059 .It Li "#F" Ta "Current window flag"
2060 .It Li "#I" Ta "Current window index"
2061 .It Li "#P" Ta "Current pane index"
2062 .It Li "#S" Ta "Session name"
2063 .It Li "#T" Ta "Current window title"
2064 .It Li "#W" Ta "Current window name"
2065 .It Li "##" Ta "A literal" Ql #
2068 The #(shell-command) form executes
2069 .Ql shell-command
2070 and inserts the first line of its output.
2071 Note that shell commands are only executed once at the interval specified by
2073 .Ic status-interval
2074 option: if the status line is redrawn in the meantime, the previous result is
2075 used.
2076 Shell commands are executed with the
2078 global environment set (see the
2079 .Sx ENVIRONMENT
2080 section).
2082 The window title (#T) is the title set by the program running within the window
2083 using the OSC title setting sequence, for example:
2084 .Bd -literal -offset indent
2085 $ printf '\e033]2;My Title\e033\e\e'
2088 When a window is first created, its title is the hostname.
2090 #[attributes] allows a comma-separated list of attributes to be specified,
2091 these may be
2092 .Ql fg=colour
2093 to set the foreground colour,
2094 .Ql bg=colour
2095 to set the background colour, the name of one of the attributes (listed under
2097 .Ic message-attr
2098 option) to turn an attribute on, or an attribute prefixed with
2099 .Ql no
2100 to turn one off, for example
2101 .Ic nobright .
2102 Examples are:
2103 .Bd -literal -offset indent
2104 #(sysctl vm.loadavg)
2105 #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
2108 Where appropriate, special character sequences may be prefixed with a number to
2109 specify the maximum length, for example
2110 .Ql #24T .
2112 By default, UTF-8 in
2113 .Ar string
2114 is not interpreted, to enable UTF-8, use the
2115 .Ic status-utf8
2116 option.
2117 .It Ic status-left-attr Ar attributes
2118 Set the attribute of the left part of the status line.
2119 .It Ic status-left-bg Ar colour
2120 Set the background colour of the left part of the status line.
2121 .It Ic status-left-fg Ar colour
2122 Set the foreground colour of the left part of the status line.
2123 .It Ic status-left-length Ar length
2124 Set the maximum
2125 .Ar length
2126 of the left component of the status bar.
2127 The default is 10.
2128 .It Ic status-right Ar string
2129 Display
2130 .Ar string
2131 to the right of the status bar.
2132 By default, the current window title in double quotes, the date and the time
2133 are shown.
2134 As with
2135 .Ic status-left ,
2136 .Ar string
2137 will be passed to
2138 .Xr strftime 3 ,
2139 character pairs are replaced, and UTF-8 is dependent on the
2140 .Ic status-utf8
2141 option.
2142 .It Ic status-right-attr Ar attributes
2143 Set the attribute of the right part of the status line.
2144 .It Ic status-right-bg Ar colour
2145 Set the background colour of the right part of the status line.
2146 .It Ic status-right-fg Ar colour
2147 Set the foreground colour of the right part of the status line.
2148 .It Ic status-right-length Ar length
2149 Set the maximum
2150 .Ar length
2151 of the right component of the status bar.
2152 The default is 40.
2153 .It Xo Ic status-utf8
2154 .Op Ic on | off
2156 Instruct
2158 to treat top-bit-set characters in the
2159 .Ic status-left
2161 .Ic status-right
2162 strings as UTF-8; notably, this is important for wide characters.
2163 This option defaults to off.
2164 .It Ic terminal-overrides Ar string
2165 Contains a list of entries which override terminal descriptions read using
2166 .Xr terminfo 5 .
2167 .Ar string
2168 is a comma-separated list of items each a colon-separated string made up of a
2169 terminal type pattern (matched using
2170 .Xr fnmatch 3 )
2171 and a set of
2172 .Em name=value
2173 entries.
2175 For example, to set the
2176 .Ql clear
2177 .Xr terminfo 5
2178 entry to
2179 .Ql \ee[H\ee[2J
2180 for all terminal types and the
2181 .Ql dch1
2182 entry to
2183 .Ql \ee[P
2184 for the
2185 .Ql rxvt
2186 terminal type, the option could be set to the string:
2187 .Bd -literal -offset indent
2188 "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
2191 The terminal entry value is passed through
2192 .Xr strunvis 3
2193 before interpretation.
2194 The default value forcibly corrects the
2195 .Ql colors
2196 entry for terminals which support 88 or 256 colours:
2197 .Bd -literal -offset indent
2198 "*88col*:colors=88,*256col*:colors=256,xterm*:XT"
2200 .It Ic update-environment Ar variables
2201 Set a space-separated string containing a list of environment variables to be
2202 copied into the session environment when a new session is created or an
2203 existing session is attached.
2204 Any variables that do not exist in the source environment are set to be
2205 removed from the session environment (as if
2206 .Fl r
2207 was given to the
2208 .Ic set-environment
2209 command).
2210 The default is
2211 "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
2212 XAUTHORITY".
2213 .It Xo Ic visual-activity
2214 .Op Ic on | off
2216 If on, display a status line message when activity occurs in a window
2217 for which the
2218 .Ic monitor-activity
2219 window option is enabled.
2220 .It Xo Ic visual-bell
2221 .Op Ic on | off
2223 If this option is on, a message is shown on a bell instead of it being passed
2224 through to the terminal (which normally makes a sound).
2225 Also see the
2226 .Ic bell-action
2227 option.
2228 .It Xo Ic visual-content
2229 .Op Ic on | off
2231 Like
2232 .Ic visual-activity ,
2233 display a message when content is present in a window
2234 for which the
2235 .Ic monitor-content
2236 window option is enabled.
2237 .It Xo Ic visual-silence
2238 .Op Ic on | off
2241 .Ic monitor-silence
2242 is enabled, prints a message after the interval has expired on a given window.
2244 .It Xo Ic set-window-option
2245 .Op Fl agu
2246 .Op Fl t Ar target-window
2247 .Ar option Ar value
2249 .D1 (alias: Ic setw )
2250 Set a window option.
2252 .Fl a ,
2253 .Fl g
2255 .Fl u
2256 flags work similarly to the
2257 .Ic set-option
2258 command.
2260 Supported window options are:
2262 .Bl -tag -width Ds -compact
2263 .It Xo Ic aggressive-resize
2264 .Op Ic on | off
2266 Aggressively resize the chosen window.
2267 This means that
2269 will resize the window to the size of the smallest session for which it is the
2270 current window, rather than the smallest session to which it is attached.
2271 The window may resize when the current window is changed on another sessions;
2272 this option is good for full-screen programs which support
2273 .Dv SIGWINCH
2274 and poor for interactive programs such as shells.
2276 .It Xo Ic alternate-screen
2277 .Op Ic on | off
2279 This option configures whether programs running inside
2281 may use the terminal alternate screen feature, which allows the
2282 .Em smcup
2284 .Em rmcup
2285 .Xr terminfo 5
2286 capabilities.
2287 The alternate screen feature preserves the contents of the window when an
2288 interactive application starts and restores it on exit, so that any output
2289 visible before the application starts reappears unchanged after it exits.
2290 The default is on.
2292 .It Xo Ic automatic-rename
2293 .Op Ic on | off
2295 Control automatic window renaming.
2296 When this setting is enabled,
2298 will attempt - on supported platforms - to rename the window to reflect the
2299 command currently running in it.
2300 This flag is automatically disabled for an individual window when a name
2301 is specified at creation with
2302 .Ic new-window
2304 .Ic new-session ,
2305 or later with
2306 .Ic rename-window .
2307 It may be switched off globally with:
2308 .Bd -literal -offset indent
2309 set-window-option -g automatic-rename off
2312 .It Ic clock-mode-colour Ar colour
2313 Set clock colour.
2315 .It Xo Ic clock-mode-style
2316 .Op Ic 12 | 24
2318 Set clock hour format.
2320 .It Ic force-height Ar height
2321 .It Ic force-width Ar width
2322 Prevent
2324 from resizing a window to greater than
2325 .Ar width
2327 .Ar height .
2328 A value of zero restores the default unlimited setting.
2330 .It Ic main-pane-height Ar height
2331 .It Ic main-pane-width Ar width
2332 Set the width or height of the main (left or top) pane in the
2333 .Ic main-horizontal
2335 .Ic main-vertical
2336 layouts.
2338 .It Ic mode-attr Ar attributes
2339 Set window modes attributes.
2341 .It Ic mode-bg Ar colour
2342 Set window modes background colour.
2344 .It Ic mode-fg Ar colour
2345 Set window modes foreground colour.
2347 .It Xo Ic mode-keys
2348 .Op Ic vi | emacs
2350 Use vi or emacs-style key bindings in copy and choice modes.
2351 As with the
2352 .Ic status-keys
2353 option, the default is emacs, unless
2354 .Ev VISUAL
2356 .Ev EDITOR
2357 contains
2358 .Ql vi .
2360 .It Xo Ic mode-mouse
2361 .Op Ic on | off | copy-mode
2363 Mouse state in modes.
2364 If on, the mouse may be used to enter copy mode and copy a selection by
2365 dragging, to enter copy mode and scroll with the mouse wheel, or to select an
2366 option in choice mode.
2367 If set to
2368 .Em copy-mode ,
2369 the mouse behaves as set to on, but cannot be used to enter copy
2370 mode.
2372 .It Xo Ic monitor-activity
2373 .Op Ic on | off
2375 Monitor for activity in the window.
2376 Windows with activity are highlighted in the status line.
2378 .It Ic monitor-content Ar match-string
2379 Monitor content in the window.
2380 When
2381 .Xr fnmatch 3
2382 pattern
2383 .Ar match-string
2384 appears in the window, it is highlighted in the status line.
2386 .It Xo Ic monitor-silence
2387 .Op Ic interval
2389 Monitor for silence (no activity) in the window within
2390 .Ic interval
2391 seconds.
2392 Windows that have been silent for the interval are highlighted in the
2393 status line.
2394 An interval of zero disables the monitoring.
2396 .It Ic other-pane-height Ar height
2397 Set the height of the other panes (not the main pane) in the
2398 .Ic main-horizontal
2399 layout.
2400 If this option is set to 0 (the default), it will have no effect.
2401 If both the
2402 .Ic main-pane-height
2404 .Ic other-pane-height
2405 options are set, the main pane will grow taller to make the other panes the
2406 specified height, but will never shrink to do so.
2408 .It Ic other-pane-width Ar width
2409 Like
2410 .Ic other-pane-height ,
2411 but set the width of other panes in the
2412 .Ic main-vertical
2413 layout.
2415 .It Xo Ic remain-on-exit
2416 .Op Ic on | off
2418 A window with this flag set is not destroyed when the program running in it
2419 exits.
2420 The window may be reactivated with the
2421 .Ic respawn-window
2422 command.
2424 .It Xo Ic synchronize-panes
2425 .Op Ic on | off
2427 Duplicate input to any pane to all other panes in the same window (only
2428 for panes that are not in any special mode).
2430 .It Xo Ic utf8
2431 .Op Ic on | off
2433 Instructs
2435 to expect UTF-8 sequences to appear in this window.
2437 .It Ic window-status-alert-attr Ar attributes
2438 Set status line attributes for windows which have an alert (bell, activity
2439 or content).
2441 .It Ic window-status-alert-bg Ar colour
2442 Set status line background colour for windows with an alert.
2444 .It Ic window-status-alert-fg Ar colour
2445 Set status line foreground colour for windows with an alert.
2447 .It Ic window-status-attr Ar attributes
2448 Set status line attributes for a single window.
2450 .It Ic window-status-bg Ar colour
2451 Set status line background colour for a single window.
2453 .It Ic window-status-current-attr Ar attributes
2454 Set status line attributes for the currently active window.
2456 .It Ic window-status-current-bg Ar colour
2457 Set status line background colour for the currently active window.
2459 .It Ic window-status-current-fg Ar colour
2460 Set status line foreground colour for the currently active window.
2462 .It Ic window-status-current-format Ar string
2463 Like
2464 .Ar window-status-format ,
2465 but is the format used when the window is the current window.
2467 .It Ic window-status-fg Ar colour
2468 Set status line foreground colour for a single window.
2470 .It Ic window-status-format Ar string
2471 Set the format in which the window is displayed in the status line window list.
2472 See the
2473 .Ar status-left
2474 option for details of special character sequences available.
2475 The default is
2476 .Ql #I:#W#F .
2478 .It Ic word-separators Ar string
2479 Sets the window's conception of what characters are considered word
2480 separators, for the purposes of the next and previous word commands in
2481 copy mode.
2482 The default is
2483 .Ql \ -_@ .
2485 .It Xo Ic xterm-keys
2486 .Op Ic on | off
2488 If this option is set,
2490 will generate
2491 .Xr xterm 1 -style
2492 function key sequences; these have a number included to indicate modifiers such
2493 as Shift, Alt or Ctrl.
2494 The default is off.
2496 .It Xo Ic show-options
2497 .Op Fl gsw
2498 .Op Fl t Ar target-session | Ar target-window
2500 .D1 (alias: Ic show )
2501 Show the window options with
2502 .Fl w
2503 (equivalent to
2504 .Ic show-window-options ) ,
2505 the server options with
2506 .Fl s ,
2507 otherwise the session options for
2508 .Ar target session .
2509 Global session or window options are listed if
2510 .Fl g
2511 is used.
2512 .It Xo Ic show-window-options
2513 .Op Fl g
2514 .Op Fl t Ar target-window
2516 .D1 (alias: Ic showw )
2517 List the window options for
2518 .Ar target-window ,
2519 or the global window options if
2520 .Fl g
2521 is used.
2523 .Sh ENVIRONMENT
2524 When the server is started,
2526 copies the environment into the
2527 .Em global environment ;
2528 in addition, each session has a
2529 .Em session environment .
2530 When a window is created, the session and global environments are merged.
2531 If a variable exists in both, the value from the session environment is used.
2532 The result is the initial environment passed to the new process.
2535 .Ic update-environment
2536 session option may be used to update the session environment from the client
2537 when a new session is created or an old reattached.
2539 also initialises the
2540 .Ev TMUX
2541 variable with some internal information to allow commands to be executed
2542 from inside, and the
2543 .Ev TERM
2544 variable with the correct terminal setting of
2545 .Ql screen .
2547 Commands to alter and view the environment are:
2548 .Bl -tag -width Ds
2549 .It Xo Ic set-environment
2550 .Op Fl gru
2551 .Op Fl t Ar target-session
2552 .Ar name Op Ar value
2554 .D1 (alias: Ic setenv )
2555 Set or unset an environment variable.
2557 .Fl g
2558 is used, the change is made in the global environment; otherwise, it is applied
2559 to the session environment for
2560 .Ar target-session .
2562 .Fl u
2563 flag unsets a variable.
2564 .Fl r
2565 indicates the variable is to be removed from the environment before starting a
2566 new process.
2567 .It Xo Ic show-environment
2568 .Op Fl g
2569 .Op Fl t Ar target-session
2571 .D1 (alias: Ic showenv )
2572 Display the environment for
2573 .Ar target-session
2574 or the global environment with
2575 .Fl g .
2576 Variables removed from the environment are prefixed with
2577 .Ql - .
2579 .Sh STATUS LINE
2581 includes an optional status line which is displayed in the bottom line of each
2582 terminal.
2583 By default, the status line is enabled (it may be disabled with the
2584 .Ic status
2585 session option) and contains, from left-to-right: the name of the current
2586 session in square brackets; the window list; the current window title in double
2587 quotes; and the time and date.
2589 The status line is made of three parts: configurable left and right sections
2590 (which may contain dynamic content such as the time or output from a shell
2591 command, see the
2592 .Ic status-left ,
2593 .Ic status-left-length ,
2594 .Ic status-right ,
2596 .Ic status-right-length
2597 options below), and a central window list.
2598 By default, the window list shows the index, name and (if any) flag of the
2599 windows present in the current session in ascending numerical order.
2600 It may be customised with the
2601 .Ar window-status-format
2603 .Ar window-status-current-format
2604 options.
2605 The flag is one of the following symbols appended to the window name:
2606 .Bl -column "Symbol" "Meaning" -offset indent
2607 .It Sy "Symbol" Ta Sy "Meaning"
2608 .It Li "*" Ta "Denotes the current window."
2609 .It Li "-" Ta "Marks the last window (previously selected)."
2610 .It Li "#" Ta "Window is monitored and activity has been detected."
2611 .It Li "!" Ta "A bell has occurred in the window."
2612 .It Li "+" Ta "Window is monitored for content and it has appeared."
2613 .It Li "~" Ta "The window has been silent for the monitor-silence interval."
2616 The # symbol relates to the
2617 .Ic monitor-activity
2618 and + to the
2619 .Ic monitor-content
2620 window options.
2621 The window name is printed in inverted colours if an alert (bell, activity or
2622 content) is present.
2624 The colour and attributes of the status line may be configured, the entire
2625 status line using the
2626 .Ic status-attr ,
2627 .Ic status-fg
2629 .Ic status-bg
2630 session options and individual windows using the
2631 .Ic window-status-attr ,
2632 .Ic window-status-fg
2634 .Ic window-status-bg
2635 window options.
2637 The status line is automatically refreshed at interval if it has changed, the
2638 interval may be controlled with the
2639 .Ic status-interval
2640 session option.
2642 Commands related to the status line are as follows:
2643 .Bl -tag -width Ds
2644 .It Xo Ic command-prompt
2645 .Op Fl I Ar inputs
2646 .Op Fl p Ar prompts
2647 .Op Fl t Ar target-client
2648 .Op Ar template
2650 Open the command prompt in a client.
2651 This may be used from inside
2653 to execute commands interactively.
2656 .Ar template
2657 is specified, it is used as the command.
2658 If present,
2659 .Fl I
2660 is a comma-separated list of the initial text for each prompt.
2662 .Fl p
2663 is given,
2664 .Ar prompts
2665 is a comma-separated list of prompts which are displayed in order; otherwise
2666 a single prompt is displayed, constructed from
2667 .Ar template
2668 if it is present, or
2669 .Ql \&:
2670 if not.
2672 Both
2673 .Ar inputs
2675 .Ar prompts
2676 may contain the special character sequences supported by the
2677 .Ic status-left
2678 option.
2680 Before the command is executed, the first occurrence of the string
2681 .Ql %%
2682 and all occurrences of
2683 .Ql %1
2684 are replaced by the response to the first prompt, the second
2685 .Ql %%
2686 and all
2687 .Ql %2
2688 are replaced with the response to the second prompt, and so on for further
2689 prompts.
2690 Up to nine prompt responses may be replaced
2692 .Ql %1
2694 .Ql %9
2695 .Pc .
2696 .It Xo Ic confirm-before
2697 .Op Fl p Ar prompt
2698 .Op Fl t Ar target-client
2699 .Ar command
2701 .D1 (alias: Ic confirm )
2702 Ask for confirmation before executing
2703 .Ar command .
2705 .Fl p
2706 is given,
2707 .Ar prompt
2708 is the prompt to display; otherwise a prompt is constructed from
2709 .Ar command .
2710 It may contain the special character sequences supported by the
2711 .Ic status-left
2712 option.
2714 This command works only from inside
2715 .Nm .
2716 .It Xo Ic display-message
2717 .Op Fl p
2718 .Op Fl c Ar target-client
2719 .Op Fl t Ar target-pane
2720 .Op Ar message
2722 .D1 (alias: Ic display )
2723 Display a message.
2725 .Fl p
2726 is given, the output is printed to stdout, otherwise it is displayed in the
2727 .Ar target-client
2728 status line.
2729 The format of
2730 .Ar message
2731 is as for
2732 .Ic status-left ,
2733 with the exception that #() are not handled; information is taken from
2734 .Ar target-pane
2736 .Fl t
2737 is given, otherwise the active pane for the session attached to
2738 .Ar target-client .
2740 .Sh BUFFERS
2742 maintains a stack of
2743 .Em paste buffers .
2744 Up to the value of the
2745 .Ic buffer-limit
2746 option are kept; when a new buffer is added, the buffer at the bottom of the
2747 stack is removed.
2748 Buffers may be added using
2749 .Ic copy-mode
2750 or the
2751 .Ic set-buffer
2752 command, and pasted into a window using the
2753 .Ic paste-buffer
2754 command.
2756 A configurable history buffer is also maintained for each window.
2757 By default, up to 2000 lines are kept; this can be altered with the
2758 .Ic history-limit
2759 option (see the
2760 .Ic set-option
2761 command above).
2763 The buffer commands are as follows:
2764 .Bl -tag -width Ds
2765 .It Xo
2766 .Ic choose-buffer
2767 .Op Fl t Ar target-window
2768 .Op Ar template
2770 Put a window into buffer choice mode, where a buffer may be chosen
2771 interactively from a list.
2772 After a buffer is selected,
2773 .Ql %%
2774 is replaced by the buffer index in
2775 .Ar template
2776 and the result executed as a command.
2778 .Ar template
2779 is not given, "paste-buffer -b '%%'" is used.
2780 This command works only from inside
2781 .Nm .
2782 .It Ic clear-history Op Fl t Ar target-pane
2783 .D1 (alias: Ic clearhist )
2784 Remove and free the history for the specified pane.
2785 .It Ic delete-buffer Op Fl b Ar buffer-index
2786 .D1 (alias: Ic deleteb )
2787 Delete the buffer at
2788 .Ar buffer-index ,
2789 or the top buffer if not specified.
2790 .It Ic list-buffers
2791 .D1 (alias: Ic lsb )
2792 List the global buffers.
2793 .It Xo Ic load-buffer
2794 .Op Fl b Ar buffer-index
2795 .Ar path
2797 .D1 (alias: Ic loadb )
2798 Load the contents of the specified paste buffer from
2799 .Ar path .
2800 .It Xo Ic paste-buffer
2801 .Op Fl dr
2802 .Op Fl b Ar buffer-index
2803 .Op Fl s Ar separator
2804 .Op Fl t Ar target-pane
2806 .D1 (alias: Ic pasteb )
2807 Insert the contents of a paste buffer into the specified pane.
2808 If not specified, paste into the current one.
2809 With
2810 .Fl d ,
2811 also delete the paste buffer from the stack.
2812 When output, any linefeed (LF) characters in the paste buffer are replaced with
2813 a separator, by default carriage return (CR).
2814 A custom separator may be specified using the
2815 .Fl s
2816 flag.
2818 .Fl r
2819 flag means to do no replacement (equivalent to a separator of LF).
2820 .It Xo Ic save-buffer
2821 .Op Fl a
2822 .Op Fl b Ar buffer-index
2823 .Ar path
2825 .D1 (alias: Ic saveb )
2826 Save the contents of the specified paste buffer to
2827 .Ar path .
2829 .Fl a
2830 option appends to rather than overwriting the file.
2831 .It Xo Ic set-buffer
2832 .Op Fl b Ar buffer-index
2833 .Ar data
2835 .D1 (alias: Ic setb )
2836 Set the contents of the specified buffer to
2837 .Ar data .
2838 .It Xo Ic show-buffer
2839 .Op Fl b Ar buffer-index
2841 .D1 (alias: Ic showb )
2842 Display the contents of the specified buffer.
2844 .Sh MISCELLANEOUS
2845 Miscellaneous commands are as follows:
2846 .Bl -tag -width Ds
2847 .It Ic clock-mode Op Fl t Ar target-pane
2848 Display a large clock.
2849 .It Ic if-shell Ar shell-command command
2850 .D1 (alias: Ic if )
2851 Execute
2852 .Ar command
2854 .Ar shell-command
2855 returns success.
2856 .It Ic lock-server
2857 .D1 (alias: Ic lock )
2858 Lock each client individually by running the command specified by the
2859 .Ic lock-command
2860 option.
2861 .It Ic run-shell Ar shell-command
2862 .D1 (alias: Ic run )
2863 Execute
2864 .Ar shell-command
2865 in the background without creating a window.
2866 After it finishes, any output to stdout is displayed in copy mode.
2867 If the command doesn't return success, the exit status is also displayed.
2868 .It Ic server-info
2869 .D1 (alias: Ic info )
2870 Show server information and terminal details.
2872 .Sh TERMINFO EXTENSIONS
2874 understands some extensions to
2875 .Xr terminfo 5 :
2876 .Bl -tag -width Ds
2877 .It Em Cc , Cr
2878 Set the cursor colour.
2879 The first takes a single string argument and is used to set the colour;
2880 the second takes no arguments and restores the default cursor colour.
2881 If set, a sequence such as this may be used
2882 to change the cursor colour from inside
2883 .Nm :
2884 .Bd -literal -offset indent
2885 $ printf '\e033]12;red\e033\e\e'
2887 .It Em Cs , Csr
2888 Change the cursor style.
2889 If set, a sequence such as this may be used
2890 to change the cursor to an underline:
2891 .Bd -literal -offset indent
2892 $ printf '\e033[4 q'
2896 .Em Csr
2897 is set, it will be used to reset the cursor style instead
2899 .Em Cs .
2900 .It Em \&Ms
2901 This sequence can be used by
2903 to store the current buffer in the host terminal's selection (clipboard).
2904 See the
2905 .Em set-clipboard
2906 option above and the
2907 .Xr xterm 1
2908 man page.
2910 .Sh FILES
2911 .Bl -tag -width "/etc/tmux.confXXX" -compact
2912 .It Pa ~/.tmux.conf
2913 Default
2915 configuration file.
2916 .It Pa /etc/tmux.conf
2917 System-wide configuration file.
2919 .Sh EXAMPLES
2920 To create a new
2922 session running
2923 .Xr vi 1 :
2925 .Dl $ tmux new-session vi
2927 Most commands have a shorter form, known as an alias.
2928 For new-session, this is
2929 .Ic new :
2931 .Dl $ tmux new vi
2933 Alternatively, the shortest unambiguous form of a command is accepted.
2934 If there are several options, they are listed:
2935 .Bd -literal -offset indent
2936 $ tmux n
2937 ambiguous command: n, could be: new-session, new-window, next-window
2940 Within an active session, a new window may be created by typing
2941 .Ql C-b c
2942 (Ctrl
2943 followed by the
2944 .Ql b
2946 followed by the
2947 .Ql c
2948 key).
2950 Windows may be navigated with:
2951 .Ql C-b 0
2952 (to select window 0),
2953 .Ql C-b 1
2954 (to select window 1), and so on;
2955 .Ql C-b n
2956 to select the next window; and
2957 .Ql C-b p
2958 to select the previous window.
2960 A session may be detached using
2961 .Ql C-b d
2962 (or by an external event such as
2963 .Xr ssh 1
2964 disconnection) and reattached with:
2966 .Dl $ tmux attach-session
2968 Typing
2969 .Ql C-b \&?
2970 lists the current key bindings in the current window; up and down may be used
2971 to navigate the list or
2972 .Ql q
2973 to exit from it.
2975 Commands to be run when the
2977 server is started may be placed in the
2978 .Pa ~/.tmux.conf
2979 configuration file.
2980 Common examples include:
2982 Changing the default prefix key:
2983 .Bd -literal -offset indent
2984 set-option -g prefix C-a
2985 unbind-key C-b
2986 bind-key C-a send-prefix
2989 Turning the status line off, or changing its colour:
2990 .Bd -literal -offset indent
2991 set-option -g status off
2992 set-option -g status-bg blue
2995 Setting other options, such as the default command,
2996 or locking after 30 minutes of inactivity:
2997 .Bd -literal -offset indent
2998 set-option -g default-command "exec /bin/ksh"
2999 set-option -g lock-after-time 1800
3002 Creating new key bindings:
3003 .Bd -literal -offset indent
3004 bind-key b set-option status
3005 bind-key / command-prompt "split-window 'exec man %%'"
3006 bind-key S command-prompt "new-window -n %1 'ssh %1'"
3008 .Sh SEE ALSO
3009 .Xr pty 4
3010 .Sh AUTHORS
3011 .An Nicholas Marriott Aq nicm@users.sourceforge.net