-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.1
7783 lines (7774 loc) · 181 KB
/
tmux.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" $OpenBSD$
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt TMUX 1
.Os
.Sh NAME
.Nm tmux
.Nd terminal multiplexer
.Sh SYNOPSIS
.Nm tmux
.Bk -words
.Op Fl 2CDlNuVv
.Op Fl c Ar shell-command
.Op Fl f Ar file
.Op Fl L Ar socket-name
.Op Fl S Ar socket-path
.Op Fl T Ar features
.Op Ar command Op Ar flags
.Ek
.Sh DESCRIPTION
.Nm
is a terminal multiplexer:
it enables a number of terminals to be created, accessed, and
controlled from a single screen.
.Nm
may be detached from a screen
and continue running in the background,
then later reattached.
.Pp
When
.Nm
is started, it creates a new
.Em session
with a single
.Em window
and displays it on screen.
A status line at the bottom of the screen
shows information on the current session
and is used to enter interactive commands.
.Pp
A session is a single collection of
.Em pseudo terminals
under the management of
.Nm .
Each session has one or more
windows linked to it.
A window occupies the entire screen
and may be split into rectangular panes,
each of which is a separate pseudo terminal
(the
.Xr pty 4
manual page documents the technical details of pseudo terminals).
Any number of
.Nm
instances may connect to the same session,
and any number of windows may be present in the same session.
Once all sessions are killed,
.Nm
exits.
.Pp
Each session is persistent and will survive accidental disconnection
(such as
.Xr ssh 1
connection timeout) or intentional detaching (with the
.Ql C-b d
key strokes).
.Nm
may be reattached using:
.Pp
.Dl $ tmux attach
.Pp
In
.Nm ,
a session is displayed on screen by a
.Em client
and all sessions are managed by a single
.Em server .
The server and each client are separate processes which communicate through a
socket in
.Pa /tmp .
.Pp
The options are as follows:
.Bl -tag -width "XXXXXXXXXXXX"
.It Fl 2
Force
.Nm
to assume the terminal supports 256 colours.
This is equivalent to
.Fl T Ar 256 .
.It Fl C
Start in control mode (see the
.Sx CONTROL MODE
section).
Given twice
.Xo ( Fl CC ) Xc
disables echo.
.It Fl c Ar shell-command
Execute
.Ar shell-command
using the default shell.
If necessary, the
.Nm
server will be started to retrieve the
.Ic default-shell
option.
This option is for compatibility with
.Xr sh 1
when
.Nm
is used as a login shell.
.It Fl D
Do not start the
.Nm
server as a daemon.
This also turns the
.Ic exit-empty
option off.
With
.Fl D ,
.Ar command
may not be specified.
.It Fl f Ar file
Specify an alternative configuration file.
By default,
.Nm
loads the system configuration file from
.Pa @SYSCONFDIR@/tmux.conf ,
if present, then looks for a user configuration file at
.Pa \[ti]/.tmux.conf
or
.Pa $XDG_CONFIG_HOME/tmux/tmux.conf .
.Pp
The configuration file is a set of
.Nm
commands which are executed in sequence when the server is first started.
.Nm
loads configuration files once when the server process has started.
The
.Ic source-file
command may be used to load a file later.
.Pp
.Nm
shows any error messages from commands in configuration files in the first
session created, and continues to process the rest of the configuration file.
.It Fl L Ar socket-name
.Nm
stores the server socket in a directory under
.Ev TMUX_TMPDIR
or
.Pa /tmp
if it is unset.
The default socket is named
.Em default .
This option allows a different socket name to be specified, allowing several
independent
.Nm
servers to be run.
Unlike
.Fl S
a full path is not necessary: the sockets are all created in a directory
.Pa tmux-UID
under the directory given by
.Ev TMUX_TMPDIR
or in
.Pa /tmp .
The
.Pa tmux-UID
directory is created by
.Nm
and must not be world readable, writable or executable.
.Pp
If the socket is accidentally removed, the
.Dv SIGUSR1
signal may be sent to the
.Nm
server process to recreate it (note that this will fail if any parent
directories are missing).
.It Fl l
Behave as a login shell.
This flag currently has no effect and is for compatibility with other shells
when using tmux as a login shell.
.It Fl N
Do not start the server even if the command would normally do so (for example
.Ic new-session
or
.Ic start-server ) .
.It Fl S Ar socket-path
Specify a full alternative path to the server socket.
If
.Fl S
is specified, the default socket directory is not used and any
.Fl L
flag is ignored.
.It Fl T Ar features
Set terminal features for the client.
This is a comma-separated list of features.
See the
.Ic terminal-features
option.
.It Fl u
Write UTF-8 output to the terminal even if the first environment
variable of
.Ev LC_ALL ,
.Ev LC_CTYPE ,
or
.Ev LANG
that is set does not contain
.Qq UTF-8
or
.Qq UTF8 .
.It Fl V
Report the
.Nm
version.
.It Fl v
Request verbose logging.
Log messages will be saved into
.Pa tmux-client-PID.log
and
.Pa tmux-server-PID.log
files in the current directory, where
.Em PID
is the PID of the server or client process.
If
.Fl v
is specified twice, an additional
.Pa tmux-out-PID.log
file is generated with a copy of everything
.Nm
writes to the terminal.
.Pp
The
.Dv SIGUSR2
signal may be sent to the
.Nm
server process to toggle logging between on (as if
.Fl v
was given) and off.
.It Ar command Op Ar flags
This specifies one of a set of commands used to control
.Nm ,
as described in the following sections.
If no commands are specified, the
.Ic new-session
command is assumed.
.El
.Sh DEFAULT KEY BINDINGS
.Nm
may be controlled from an attached client by using a key combination of a
prefix key,
.Ql C-b
(Ctrl-b) by default, followed by a command key.
.Pp
The default command key bindings are:
.Pp
.Bl -tag -width "XXXXXXXXXX" -offset indent -compact
.It C-b
Send the prefix key (C-b) through to the application.
.It C-o
Rotate the panes in the current window forwards.
.It C-z
Suspend the
.Nm
client.
.It !
Break the current pane out of the window.
.It \&"
.\" "
Split the current pane into two, top and bottom.
.It #
List all paste buffers.
.It $
Rename the current session.
.It %
Split the current pane into two, left and right.
.It &
Kill the current window.
.It \[aq]
Prompt for a window index to select.
.It \&(
Switch the attached client to the previous session.
.It \&)
Switch the attached client to the next session.
.It ,
Rename the current window.
.It -
Delete the most recently copied buffer of text.
.It .
Prompt for an index to move the current window.
.It 0 to 9
Select windows 0 to 9.
.It :
Enter the
.Nm
command prompt.
.It ;
Move to the previously active pane.
.It =
Choose which buffer to paste interactively from a list.
.It \&?
List all key bindings.
.It D
Choose a client to detach.
.It L
Switch the attached client back to the last session.
.It \&[
Enter copy mode to copy text or view the history.
.It \&]
Paste the most recently copied buffer of text.
.It c
Create a new window.
.It d
Detach the current client.
.It f
Prompt to search for text in open windows.
.It i
Display some information about the current window.
.It l
Move to the previously selected window.
.It m
Mark the current pane (see
.Ic select-pane
.Fl m ) .
.It M
Clear the marked pane.
.It n
Change to the next window.
.It o
Select the next pane in the current window.
.It p
Change to the previous window.
.It q
Briefly display pane indexes.
.It r
Force redraw of the attached client.
.It s
Select a new session for the attached client interactively.
.It t
Show the time.
.It w
Choose the current window interactively.
.It x
Kill the current pane.
.It z
Toggle zoom state of the current pane.
.It {
Swap the current pane with the previous pane.
.It }
Swap the current pane with the next pane.
.It \[ti]
Show previous messages from
.Nm ,
if any.
.It Page Up
Enter copy mode and scroll one page up.
.It Up, Down
.It Left, Right
Change to the pane above, below, to the left, or to the right of the current
pane.
.It M-1 to M-7
Arrange panes in one of the seven preset layouts:
even-horizontal, even-vertical,
main-horizontal, main-horizontal-mirrored,
main-vertical, main-vertical-mirrored,
or tiled.
.It Space
Arrange the current window in the next preset layout.
.It M-n
Move to the next window with a bell or activity marker.
.It M-o
Rotate the panes in the current window backwards.
.It M-p
Move to the previous window with a bell or activity marker.
.It C-Up, C-Down
.It C-Left, C-Right
Resize the current pane in steps of one cell.
.It M-Up, M-Down
.It M-Left, M-Right
Resize the current pane in steps of five cells.
.El
.Pp
Key bindings may be changed with the
.Ic bind-key
and
.Ic unbind-key
commands.
.Sh COMMAND PARSING AND EXECUTION
.Nm
supports a large number of commands which can be used to control its
behaviour.
Each command is named and can accept zero or more flags and arguments.
They may be bound to a key with the
.Ic bind-key
command or run from the shell prompt, a shell script, a configuration file or
the command prompt.
For example, the same
.Ic set-option
command run from the shell prompt, from
.Pa \[ti]/.tmux.conf
and bound to a key may look like:
.Bd -literal -offset indent
$ tmux set-option -g status-style bg=cyan
set-option -g status-style bg=cyan
bind-key C set-option -g status-style bg=cyan
.Ed
.Pp
Here, the command name is
.Ql set-option ,
.Ql Fl g
is a flag and
.Ql status-style
and
.Ql bg=cyan
are arguments.
.Pp
.Nm
distinguishes between command parsing and execution.
In order to execute a command,
.Nm
needs it to be split up into its name and arguments.
This is command parsing.
If a command is run from the shell, the shell parses it; from inside
.Nm
or from a configuration file,
.Nm
does.
Examples of when
.Nm
parses commands are:
.Bl -dash -offset indent
.It
in a configuration file;
.It
typed at the command prompt (see
.Ic command-prompt ) ;
.It
given to
.Ic bind-key ;
.It
passed as arguments to
.Ic if-shell
or
.Ic confirm-before .
.El
.Pp
To execute commands, each client has a
.Ql command queue .
A global command queue not attached to any client is used on startup
for configuration files like
.Pa \[ti]/.tmux.conf .
Parsed commands added to the queue are executed in order.
Some commands, like
.Ic if-shell
and
.Ic confirm-before ,
parse their argument to create a new command which is inserted immediately
after themselves.
This means that arguments can be parsed twice or more - once when the parent
command (such as
.Ic if-shell )
is parsed and again when it parses and executes its command.
Commands like
.Ic if-shell ,
.Ic run-shell
and
.Ic display-panes
stop execution of subsequent commands on the queue until something happens -
.Ic if-shell
and
.Ic run-shell
until a shell command finishes and
.Ic display-panes
until a key is pressed.
For example, the following commands:
.Bd -literal -offset indent
new-session; new-window
if-shell "true" "split-window"
kill-session
.Ed
.Pp
Will execute
.Ic new-session ,
.Ic new-window ,
.Ic if-shell ,
the shell command
.Xr true 1 ,
.Ic split-window
and
.Ic kill-session
in that order.
.Pp
The
.Sx COMMANDS
section lists the
.Nm
commands and their arguments.
.Sh PARSING SYNTAX
This section describes the syntax of commands parsed by
.Nm ,
for example in a configuration file or at the command prompt.
Note that when commands are entered into the shell, they are parsed by the shell
- see for example
.Xr ksh 1
or
.Xr csh 1 .
.Pp
Each command is terminated by a newline or a semicolon (;).
Commands separated by semicolons together form a
.Ql command sequence
- if a command in the sequence encounters an error, no subsequent commands are
executed.
.Pp
It is recommended that a semicolon used as a command separator should be
written as an individual token, for example from
.Xr sh 1 :
.Bd -literal -offset indent
$ tmux neww \\; splitw
.Ed
.Pp
Or:
.Bd -literal -offset indent
$ tmux neww \[aq];\[aq] splitw
.Ed
.Pp
Or from the tmux command prompt:
.Bd -literal -offset indent
neww ; splitw
.Ed
.Pp
However, a trailing semicolon is also interpreted as a command separator,
for example in these
.Xr sh 1
commands:
.Bd -literal -offset indent
$ tmux neww\e; splitw
.Ed
.Pp
Or:
.Bd -literal -offset indent
$ tmux \[aq]neww;\[aq] splitw
.Ed
.Pp
As in these examples, when running tmux from the shell extra care must be taken
to properly quote semicolons:
.Bl -enum -offset Ds
.It
Semicolons that should be interpreted as a command separator
should be escaped according to the shell conventions.
For
.Xr sh 1
this typically means quoted (such as
.Ql neww \[aq];\[aq] splitw )
or escaped (such as
.Ql neww \e\e\e\e; splitw ) .
.It
Individual semicolons or trailing semicolons that should be interpreted as
arguments should be escaped twice: once according to the shell conventions and
a second time for
.Nm ;
for example:
.Bd -literal -offset indent
$ tmux neww \[aq]foo\e\e;\[aq] bar
$ tmux neww foo\e\e\e\e; bar
.Ed
.It
Semicolons that are not individual tokens or trailing another token should only
be escaped once according to shell conventions; for example:
.Bd -literal -offset indent
$ tmux neww \[aq]foo-;-bar\[aq]
$ tmux neww foo-\e\e;-bar
.Ed
.El
.Pp
Comments are marked by the unquoted # character - any remaining text after a
comment is ignored until the end of the line.
.Pp
If the last character of a line is \e, the line is joined with the following
line (the \e and the newline are completely removed).
This is called line continuation and applies both inside and outside quoted
strings and in comments, but not inside braces.
.Pp
Command arguments may be specified as strings surrounded by single (\[aq])
quotes, double quotes (\[dq]) or braces ({}).
.\" "
This is required when the argument contains any special character.
Single and double quoted strings cannot span multiple lines except with line
continuation.
Braces can span multiple lines.
.Pp
Outside of quotes and inside double quotes, these replacements are performed:
.Bl -dash -offset indent
.It
Environment variables preceded by $ are replaced with their value from the
global environment (see the
.Sx GLOBAL AND SESSION ENVIRONMENT
section).
.It
A leading \[ti] or \[ti]user is expanded to the home directory of the current or
specified user.
.It
\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to
the given four or eight digit hexadecimal number.
.It
When preceded (escaped) by a \e, the following characters are replaced: \ee by
the escape character; \er by a carriage return; \en by a newline; and \et by a
tab.
.It
\eooo is replaced by a character of the octal value ooo.
Three octal digits are required, for example \e001.
The largest valid character is \e377.
.It
Any other characters preceded by \e are replaced by themselves (that is, the \e
is removed) and are not treated as having any special meaning - so for example
\e; will not mark a command sequence and \e$ will not expand an environment
variable.
.El
.Pp
Braces are parsed as a configuration file (so conditions such as
.Ql %if
are processed) and then converted into a string.
They are designed to avoid the need for additional escaping when passing a
group of
.Nm
commands as an argument (for example to
.Ic if-shell ) .
These two examples produce an identical command - note that no escaping is
needed when using {}:
.Bd -literal -offset indent
if-shell true {
display -p \[aq]brace-dollar-foo: }$foo\[aq]
}
if-shell true "display -p \[aq]brace-dollar-foo: }\e$foo\[aq]"
.Ed
.Pp
Braces may be enclosed inside braces, for example:
.Bd -literal -offset indent
bind x if-shell "true" {
if-shell "true" {
display "true!"
}
}
.Ed
.Pp
Environment variables may be set by using the syntax
.Ql name=value ,
for example
.Ql HOME=/home/user .
Variables set during parsing are added to the global environment.
A hidden variable may be set with
.Ql %hidden ,
for example:
.Bd -literal -offset indent
%hidden MYVAR=42
.Ed
.Pp
Hidden variables are not passed to the environment of processes created
by tmux.
See the
.Sx GLOBAL AND SESSION ENVIRONMENT
section.
.Pp
Commands may be parsed conditionally by surrounding them with
.Ql %if ,
.Ql %elif ,
.Ql %else
and
.Ql %endif .
The argument to
.Ql %if
and
.Ql %elif
is expanded as a format (see
.Sx FORMATS )
and if it evaluates to false (zero or empty), subsequent text is ignored until
the closing
.Ql %elif ,
.Ql %else
or
.Ql %endif .
For example:
.Bd -literal -offset indent
%if "#{==:#{host},myhost}"
set -g status-style bg=red
%elif "#{==:#{host},myotherhost}"
set -g status-style bg=green
%else
set -g status-style bg=blue
%endif
.Ed
.Pp
Will change the status line to red if running on
.Ql myhost ,
green if running on
.Ql myotherhost ,
or blue if running on another host.
Conditionals may be given on one line, for example:
.Bd -literal -offset indent
%if #{==:#{host},myhost} set -g status-style bg=red %endif
.Ed
.Sh COMMANDS
This section describes the commands supported by
.Nm .
Most commands accept the optional
.Fl t
(and sometimes
.Fl s )
argument with one of
.Ar target-client ,
.Ar target-session ,
.Ar target-window ,
or
.Ar target-pane .
These specify the client, session, window or pane which a command should affect.
.Pp
.Ar target-client
should be the name of the client,
typically the
.Xr pty 4
file to which the client is connected, for example either of
.Pa /dev/ttyp1
or
.Pa ttyp1
for the client attached to
.Pa /dev/ttyp1 .
If no client is specified,
.Nm
attempts to work out the client currently in use; if that fails, an error is
reported.
Clients may be listed with the
.Ic list-clients
command.
.Pp
.Ar target-session
is tried as, in order:
.Bl -enum -offset Ds
.It
A session ID prefixed with a $.
.It
An exact name of a session (as listed by the
.Ic list-sessions
command).
.It
The start of a session name, for example
.Ql mysess
would match a session named
.Ql mysession .
.It
A
.Xr glob 7
pattern which is matched against the session name.
.El
.Pp
If the session name is prefixed with an
.Ql = ,
only an exact match is accepted (so
.Ql =mysess
will only match exactly
.Ql mysess ,
not
.Ql mysession ) .
.Pp
If a single session is found, it is used as the target session; multiple matches
produce an error.
If a session is omitted, the current session is used if available; if no
current session is available, the most recently used is chosen.
.Pp
.Ar target-window
(or
.Ar src-window
or
.Ar dst-window )
specifies a window in the form
.Em session Ns \&: Ns Em window .
.Em session
follows the same rules as for
.Ar target-session ,
and
.Em window
is looked for in order as:
.Bl -enum -offset Ds
.It
A special token, listed below.
.It
A window index, for example
.Ql mysession:1
is window 1 in session
.Ql mysession .
.It
A window ID, such as @1.
.It
An exact window name, such as
.Ql mysession:mywindow .
.It
The start of a window name, such as
.Ql mysession:mywin .
.It
As a
.Xr glob 7
pattern matched against the window name.
.El
.Pp
Like sessions, a
.Ql =
prefix will do an exact match only.
An empty window name specifies the next unused index if appropriate (for
example the
.Ic new-window
and
.Ic link-window
commands)
otherwise the current window in
.Em session
is chosen.
.Pp
The following special tokens are available to indicate particular windows.
Each has a single-character alternative form.
.Bl -column "XXXXXXXXXX" "X"
.It Sy "Token" Ta Sy "" Ta Sy "Meaning"
.It Li "{start}" Ta "^" Ta "The lowest-numbered window"
.It Li "{end}" Ta "$" Ta "The highest-numbered window"
.It Li "{last}" Ta "!" Ta "The last (previously current) window"
.It Li "{next}" Ta "+" Ta "The next window by number"
.It Li "{previous}" Ta "-" Ta "The previous window by number"
.El
.Pp
.Ar target-pane
(or
.Ar src-pane
or
.Ar dst-pane )
may be a pane ID or takes a similar form to
.Ar target-window
but with the optional addition of a period followed by a pane index or pane ID,
for example:
.Ql mysession:mywindow.1 .
If the pane index is omitted, the currently active pane in the specified
window is used.
The following special tokens are available for the pane index:
.Bl -column "XXXXXXXXXXXXXX" "X"
.It Sy "Token" Ta Sy "" Ta Sy "Meaning"
.It Li "{last}" Ta "!" Ta "The last (previously active) pane"
.It Li "{next}" Ta "+" Ta "The next pane by number"
.It Li "{previous}" Ta "-" Ta "The previous pane by number"
.It Li "{top}" Ta "" Ta "The top pane"
.It Li "{bottom}" Ta "" Ta "The bottom pane"
.It Li "{left}" Ta "" Ta "The leftmost pane"
.It Li "{right}" Ta "" Ta "The rightmost pane"
.It Li "{top-left}" Ta "" Ta "The top-left pane"
.It Li "{top-right}" Ta "" Ta "The top-right pane"
.It Li "{bottom-left}" Ta "" Ta "The bottom-left pane"
.It Li "{bottom-right}" Ta "" Ta "The bottom-right pane"
.It Li "{up-of}" Ta "" Ta "The pane above the active pane"
.It Li "{down-of}" Ta "" Ta "The pane below the active pane"
.It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane"
.It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane"
.El
.Pp
The tokens
.Ql +
and
.Ql -
may be followed by an offset, for example:
.Bd -literal -offset indent
select-window -t:+2
.Ed
.Pp
In addition,
.Em target-session ,
.Em target-window
or
.Em target-pane
may consist entirely of the token
.Ql {mouse}
(alternative form
.Ql = )
to specify the session, window or pane where the most recent mouse event
occurred (see the
.Sx MOUSE SUPPORT
section)
or
.Ql {marked}
(alternative form
.Ql \[ti] )
to specify the marked pane (see
.Ic select-pane
.Fl m ) .
.Pp
Sessions, window and panes are each numbered with a unique ID; session IDs are
prefixed with a
.Ql $ ,
windows with a
.Ql @ ,
and panes with a
.Ql % .
These are unique and are unchanged for the life of the session, window or pane
in the
.Nm
server.
The pane ID is passed to the child process of the pane in the
.Ev TMUX_PANE
environment variable.
IDs may be displayed using the
.Ql session_id ,
.Ql window_id ,
or
.Ql pane_id
formats (see the
.Sx FORMATS
section) and the
.Ic display-message ,
.Ic list-sessions ,
.Ic list-windows
or
.Ic list-panes
commands.
.Pp
.Ar shell-command
arguments are
.Xr sh 1
commands.
This may be a single argument passed to the shell, for example:
.Bd -literal -offset indent
new-window \[aq]vi \[ti]/.tmux.conf\[aq]
.Ed
.Pp
Will run:
.Bd -literal -offset indent
/bin/sh -c \[aq]vi \[ti]/.tmux.conf\[aq]
.Ed
.Pp
Additionally, the
.Ic new-window ,
.Ic new-session ,
.Ic split-window ,
.Ic respawn-window
and
.Ic respawn-pane
commands allow
.Ar shell-command
to be given as multiple arguments and executed directly (without
.Ql sh -c ) .
This can avoid issues with shell quoting.
For example:
.Bd -literal -offset indent
$ tmux new-window vi \[ti]/.tmux.conf
.Ed
.Pp
Will run
.Xr vi 1
directly without invoking the shell.
.Pp
.Ar command
.Op Ar argument ...
refers to a
.Nm
command, either passed with the command and arguments separately, for example:
.Bd -literal -offset indent
bind-key F1 set-option status off
.Ed
.Pp
Or passed as a single string argument in
.Pa .tmux.conf ,
for example:
.Bd -literal -offset indent
bind-key F1 { set-option status off }
.Ed
.Pp
Example
.Nm
commands include:
.Bd -literal -offset indent
refresh-client -t/dev/ttyp2
rename-session -tfirst newname
set-option -wt:0 monitor-activity on
new-window ; split-window -d
bind-key R source-file \[ti]/.tmux.conf \e; \e
display-message "source-file done"
.Ed
.Pp