-
Notifications
You must be signed in to change notification settings - Fork 2
/
tmux_manPage.r
2178 lines (1764 loc) · 97.8 KB
/
tmux_manPage.r
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
TMUX(1) BSD General Commands Manual TMUX(1)
NAME
tmux — terminal multiplexer
SYNOPSIS
tmux [-28lCquvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
DESCRIPTION
tmux is a terminal multiplexer: it enables a number of terminals to be
created, accessed, and controlled from a single screen. tmux may be
detached from a screen and continue running in the background, then later
reattached.
When tmux is started it creates a new session with a single 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 com‐
mands.
A session is a single collection of pseudo terminals under the management
of tmux. 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 pty(4) manual page documents
the technical details of pseudo terminals). Any number of tmux instances
may connect to the same session, and any number of windows may be present
in the same session. Once all sessions are killed, tmux exits.
Each session is persistent and will survive accidental disconnection
(such as ssh(1) connection timeout) or intentional detaching (with the
‘C-b d’ key strokes). tmux may be reattached using:
$ tmux attach
In tmux, a session is displayed on screen by a client and all sessions
are managed by a single server. The server and each client are separate
processes which communicate through a socket in /tmp.
The options are as follows:
-2 Force tmux to assume the terminal supports 256 colours.
-8 Like -2, but indicates that the terminal supports 88
colours.
-C Start in control mode. Given twice (-CC) disables echo.
-c shell-command
Execute shell-command using the default shell. If neces‐
sary, the tmux server will be started to retrieve the
default-shell option. This option is for compatibility
with sh(1) when tmux is used as a login shell.
-f file Specify an alternative configuration file. By default,
tmux loads the system configuration file from
/etc/tmux.conf, if present, then looks for a user configu‐
ration file at ~/.tmux.conf.
The configuration file is a set of tmux commands which are
executed in sequence when the server is first started.
tmux loads configuration files once when the server process
has started. The source-file command may be used to load a
file later.
tmux shows any error messages from commands in configura‐
tion files in the first session created, and continues to
process the rest of the configuration file.
-L socket-name
tmux stores the server socket in a directory under /tmp (or
TMPDIR if set); the default socket is named default. This
option allows a different socket name to be specified,
allowing several independent tmux servers to be run.
Unlike -S a full path is not necessary: the sockets are all
created in the same directory.
If the socket is accidentally removed, the SIGUSR1 signal
may be sent to the tmux server process to recreate it.
-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.
-q Set the quiet server option to prevent the server sending
various informational messages.
-S socket-path
Specify a full alternative path to the server socket. If
-S is specified, the default socket directory is not used
and any -L flag is ignored.
-u tmux attempts to guess if the terminal is likely to support
UTF-8 by checking the first of the LC_ALL, LC_CTYPE and
LANG environment variables to be set for the string
"UTF-8". This is not always correct: the -u flag explic‐
itly informs tmux that UTF-8 is supported.
If the server is started from a client passed -u or where
UTF-8 is detected, the utf8 and status-utf8 options are
enabled in the global window and session options respec‐
tively.
-v Request verbose logging. This option may be specified mul‐
tiple times for increasing verbosity. Log messages will be
saved into tmux-client-PID.log and tmux-server-PID.log
files in the current directory, where PID is the PID of the
server or client process.
-V Report the tmux version.
command [flags]
This specifies one of a set of commands used to control
tmux, as described in the following sections. If no com‐
mands are specified, the new-session command is assumed.
KEY BINDINGS
tmux may be controlled from an attached client by using a key combination
of a prefix key, ‘C-b’ (Ctrl-b) by default, followed by a command key.
The default command key bindings are:
C-b Send the prefix key (C-b) through to the application.
C-o Rotate the panes in the current window forwards.
C-z Suspend the tmux client.
! Break the current pane out of the window.
" Split the current pane into two, top and bottom."
# List all paste buffers.
$ Rename the current session.
% Split the current pane into two, left and right.
& Kill the current window.'
' Prompt for a window index to select.
, Rename the current window.
- Delete the most recently copied buffer of text.
. Prompt for an index to move the current window.
0 to 9 Select windows 0 to 9.
: Enter the tmux command prompt.
; Move to the previously active pane.
= Choose which buffer to paste interactively from a list.
? List all key bindings.
D Choose a client to detach.
[ Enter copy mode to copy text or view the history.
] Paste the most recently copied buffer of text.
c Create a new window.
d Detach the current client.
f Prompt to search for text in open windows.
i Display some information about the current window.
l Move to the previously selected window.
n Change to the next window.
o Select the next pane in the current window.
p Change to the previous window.
q Briefly display pane indexes.
r Force redraw of the attached client.
s Select a new session for the attached client interac‐
tively.
L Switch the attached client back to the last session.
t Show the time.
w Choose the current window interactively.
x Kill the current pane.
{ Swap the current pane with the previous pane.
} Swap the current pane with the next pane.
~ Show previous messages from tmux, if any.
Page Up Enter copy mode and scroll one page up.
Up, Down
Left, Right
Change to the pane above, below, to the left, or to the
right of the current pane.
M-1 to M-5 Arrange panes in one of the five preset layouts: even-
horizontal, even-vertical, main-horizontal, main-verti‐
cal, or tiled.
M-n Move to the next window with a bell or activity marker.
M-o Rotate the panes in the current window backwards.
M-p Move to the previous window with a bell or activity
marker.
C-Up, C-Down
C-Left, C-Right
Resize the current pane in steps of one cell.
M-Up, M-Down
M-Left, M-Right
Resize the current pane in steps of five cells.
Key bindings may be changed with the bind-key and unbind-key commands.
COMMANDS
This section contains a list of the commands supported by tmux. Most
commands accept the optional -t argument with one of target-client,
target-session target-window, or target-pane. These specify the client,
session, window or pane which a command should affect. target-client is
the name of the pty(4) file to which the client is connected, for example
either of /dev/ttyp1 or ttyp1 for the client attached to /dev/ttyp1. If
no client is specified, the current client is chosen, if possible, or an
error is reported. Clients may be listed with the list-clients command.
target-session is the session id prefixed with a $, the name of a session
(as listed by the list-sessions command), or the name of a client with
the same syntax as target-client, in which case the session attached to
the client is used. When looking for the session name, tmux initially
searches for an exact match; if none is found, the session names are
checked for any for which target-session is a prefix or for which it
matches as an fnmatch(3) pattern. If a single match 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 ses‐
sion is available, the most recently used is chosen.
target-window specifies a window in the form session:window. session
follows the same rules as for target-session, and window is looked for in
order: as a window index, for example mysession:1; as a window ID, such
as @1; as an exact window name, such as mysession:mywindow; then as an
fnmatch(3) pattern or the start of a window name, such as myses‐
sion:mywin* or mysession:mywin. An empty window name specifies the next
unused index if appropriate (for example the new-window and link-window
commands) otherwise the current window in session is chosen. The special
character ‘!’ uses the last (previously current) window, ‘^’ selects the
highest numbered window, ‘$’ selects the lowest numbered window, and ‘+’
and ‘-’ select the next window or the previous window by number. When
the argument does not contain a colon, tmux first attempts to parse it as
window; if that fails, an attempt is made to match a session.
target-pane takes a similar form to target-window but with the optional
addition of a period followed by a pane index, for example: myses‐
sion:mywindow.1. If the pane index is omitted, the currently active pane
in the specified window is used. If neither a colon nor period appears,
tmux first attempts to use the argument as a pane index; if that fails,
it is looked up as for target-window. A ‘+’ or ‘-’ indicate the next or
previous pane index, respectively. One of the strings top, bottom, left,
right, top-left, top-right, bottom-left or bottom-right may be used
instead of a pane index.
The special characters ‘+’ and ‘-’ may be followed by an offset, for
example:
select-window -t:+2
When dealing with a session that doesn't contain sequential window
indexes, they will be correctly skipped.
tmux also gives each pane created in a server an identifier consisting of
a ‘%’ and a number, starting from zero. A pane's identifier is unique
for the life of the tmux server and is passed to the child process of the
pane in the TMUX_PANE environment variable. It may be used alone to tar‐
get a pane or the window containing it.
shell-command arguments are sh(1) commands. These must be passed as a
single item, which typically means quoting them, for example:
new-window 'vi /etc/passwd'
command [arguments] refers to a tmux command, passed with the command and
arguments separately, for example:
bind-key F1 set-window-option force-width 81
Or if using sh(1):
$ tmux bind-key F1 set-window-option force-width 81
Multiple commands may be specified together as part of a command
sequence. Each command should be separated by spaces and a semicolon;
commands are executed sequentially from left to right and lines ending
with a backslash continue on to the next line, except when escaped by
another backslash. A literal semicolon may be included by escaping it
with a backslash (for example, when specifying a command sequence to
bind-key).
Example tmux commands include:
refresh-client -t/dev/ttyp2
rename-session -tfirst newname
set-window-option -t:0 monitor-activity on
new-window ; split-window -d
bind-key R source-file ~/.tmux.conf \; \
display-message "source-file done"
Or from sh(1):
$ tmux kill-window -t :1
$ tmux new-window \; split-window -d
$ tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach
CLIENTS AND SESSIONS
The tmux server manages clients, sessions, windows and panes. Clients
are attached to sessions to interact with them, either when they are cre‐
ated with the new-session command, or later with the attach-session com‐
mand. Each session has one or more windows linked into it. Windows may
be linked to multiple sessions and are made up of one or more panes, each
of which contains a pseudo terminal. Commands for creating, linking and
otherwise manipulating windows are covered in the WINDOWS AND PANES sec‐
tion.
The following commands are available to manage clients and sessions:
attach-session [-dr] [-t target-session]
(alias: attach)
If run from outside tmux, create a new client in the current ter‐
minal and attach it to target-session. If used from inside,
switch the current client. If -d is specified, any other clients
attached to the session are detached. -r signifies the client is
read-only (only keys bound to the detach-client or switch-client
commands have any effect)
If no server is started, attach-session will attempt to start it;
this will fail unless sessions are created in the configuration
file.
The target-session rules for attach-session are slightly
adjusted: if tmux needs to select the most recently used session,
it will prefer the most recently used unattached session.
detach-client [-P] [-a] [-s target-session] [-t target-client]
(alias: detach)
Detach the current client if bound to a key, the client specified
with -t, or all clients currently attached to the session speci‐
fied by -s. The -a option kills all but the client given with
-t. If -P is given, send SIGHUP to the parent process of the
client, typically causing it to exit.
has-session [-t target-session]
(alias: has)
Report an error and exit with 1 if the specified session does not
exist. If it does exist, exit with 0.
kill-server
Kill the tmux server and clients and destroy all sessions.
kill-session
[-a] [-t target-session] Destroy the given session, closing any
windows linked to it and no other sessions, and detaching all
clients attached to it. If -a is given, all sessions but the
specified one is killed.
list-clients [-F format] [-t target-session]
(alias: lsc)
List all clients attached to the server. For the meaning of the
-F flag, see the FORMATS section. If target-session is speci‐
fied, list only clients connected to that session.
list-commands
(alias: lscm)
List the syntax of all commands supported by tmux.
list-sessions [-F format]
(alias: ls)
List all sessions managed by the server. For the meaning of the
-F flag, see the FORMATS section.
lock-client [-t target-client]
(alias: lockc)
Lock target-client, see the lock-server command.
lock-session [-t target-session]
(alias: locks)
Lock all clients attached to target-session.
new-session [-AdDP] [-F format] [-n window-name] [-s session-name] [-t
target-session] [-x width] [-y height] [shell-command]
(alias: new)
Create a new session with name session-name.
The new session is attached to the current terminal unless -d is
given. window-name and shell-command are the name of and shell
command to execute in the initial window. If -d is used, -x and
-y specify the size of the initial window (80 by 24 if not
given).
If run from a terminal, any termios(4) special characters are
saved and used for new windows in the new session.
The -A flag makes new-session behave like attach-session if
session-name already exists; in the case, -D behaves like -d to
attach-session.
If -t is given, the new session is grouped with target-session.
This means they share the same set of windows - all windows from
target-session are linked to the new session and any subsequent
new windows or windows being closed are applied to both sessions.
The current and previous window and any session options remain
independent and either session may be killed without affecting
the other. Giving -n or shell-command are invalid if -t is used.
The -P option prints information about the new session after it
has been created. By default, it uses the format
‘#{session_name}:’ but a different format may be specified with
-F.
refresh-client [-S] [-t target-client]
(alias: refresh)
Refresh the current client if bound to a key, or a single client
if one is given with -t. If -S is specified, only update the
client's status bar.'
rename-session [-t target-session] new-name
(alias: rename)
Rename the session to new-name.
show-messages [-t target-client]
(alias: showmsgs)
Any messages displayed on the status line are saved in a per-
client message log, up to a maximum of the limit set by the
message-limit session option for the session attached to that
client. This command displays the log for target-client.
source-file path
(alias: source)
Execute commands from path.
start-server
(alias: start)
Start the tmux server, if not already running, without creating
any sessions.
suspend-client [-t target-client]
(alias: suspendc)
Suspend a client by sending SIGTSTP (tty stop).
switch-client [-lnpr] [-c target-client] [-t target-session]
(alias: switchc)
Switch the current session for client target-client to
target-session. If -l, -n or -p is used, the client is moved to
the last, next or previous session respectively. -r toggles
whether a client is read-only (see the attach-session command).
WINDOWS AND PANES
A tmux window may be in one of several modes. The default permits direct
access to the terminal attached to the window. The other is copy mode,
which permits a section of a window or its history to be copied to a
paste buffer for later insertion into another window. This mode is
entered with the copy-mode command, bound to ‘[’ by default. It is also
entered when a command that produces output, such as list-keys, is exe‐
cuted from a key binding.
The keys available depend on whether emacs or vi mode is selected (see
the mode-keys option). The following keys are supported as appropriate
for the mode:
Function vi emacs
Back to indentation ^ M-m
Bottom of history G M-<
Clear selection Escape C-g
Copy selection Enter M-w
Cursor down j Down
Cursor left h Left
Cursor right l Right
Cursor to bottom line L
Cursor to middle line M M-r
Cursor to top line H M-R
Cursor up k Up
Delete entire line d C-u
Delete/Copy to end of line D C-k
End of line $ C-e
Go to line : g
Half page down C-d M-Down
Half page up C-u M-Up
Jump forward f f
Jump to forward t
Jump backward F F
Jump to backward T
Jump again ; ;
Jump again in reverse , ,
Next page C-f Page down
Next space W
Next space, end of word E
Next word w
Next word end e M-f
Paste buffer p C-y
Previous page C-b Page up
Previous word b M-b
Previous space B
Quit mode q Escape
Rectangle toggle v R
Scroll down C-Down or C-e C-Down
Scroll up C-Up or C-y C-Up
Search again n n
Search again in reverse N N
Search backward ? C-r
Search forward / C-s
Start of line 0 C-a
Start selection Space C-Space
Top of history g M->
Transpose characters C-t
The next and previous word keys use space and the ‘-’, ‘_’ and ‘@’ char‐
acters as word delimiters by default, but this can be adjusted by setting
the word-separators session option. Next word moves to the start of the
next word, next word end to the end of the next word and previous word to
the start of the previous word. The three next and previous space keys
work similarly but use a space alone as the word separator.
The jump commands enable quick movement within a line. For instance,
typing ‘f’ followed by ‘/’ will move the cursor to the next ‘/’ character
on the current line. A ‘;’ will then jump to the next occurrence.
Commands in copy mode may be prefaced by an optional repeat count. With
vi key bindings, a prefix is entered using the number keys; with emacs,
the Alt (meta) key and a number begins prefix entry. For example, to
move the cursor forward by ten words, use ‘M-1 0 M-f’ in emacs mode, and
‘10w’ in vi.
When copying the selection, the repeat count indicates the buffer index
to replace, if used.
Mode key bindings are defined in a set of named tables: vi-edit and
emacs-edit for keys used when line editing at the command prompt;
vi-choice and emacs-choice for keys used when choosing from lists (such
as produced by the choose-window command); and vi-copy and emacs-copy
used in copy mode. The tables may be viewed with the list-keys command
and keys modified or removed with bind-key and unbind-key. One command
accepts an argument, copy-pipe, which copies the selection and pipes it
to a command. For example the following will bind ‘C-q’ to copy the
selection into /tmp as well as the paste buffer:
bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
The paste buffer key pastes the first line from the top paste buffer on
the stack.
The synopsis for the copy-mode command is:
copy-mode [-u] [-t target-pane]
Enter copy mode. The -u option scrolls one page up.
Each window displayed by tmux may be split into one or more panes; each
pane takes up a certain area of the display and is a separate terminal.
A window may be split into panes using the split-window command. Windows
may be split horizontally (with the -h flag) or vertically. Panes may be
resized with the resize-pane command (bound to ‘C-up’, ‘C-down’ ‘C-left’
and ‘C-right’ by default), the current pane may be changed with the
select-pane command and the rotate-window and swap-pane commands may be
used to swap panes without changing their position. Panes are numbered
beginning from zero in the order they are created.
A number of preset layouts are available. These may be selected with the
select-layout command or cycled with next-layout (bound to ‘Space’ by
default); once a layout is chosen, panes within it may be moved and
resized as normal.
The following layouts are supported:
even-horizontal
Panes are spread out evenly from left to right across the window.
even-vertical
Panes are spread evenly from top to bottom.
main-horizontal
A large (main) pane is shown at the top of the window and the
remaining panes are spread from left to right in the leftover
space at the bottom. Use the main-pane-height window option to
specify the height of the top pane.
main-vertical
Similar to main-horizontal but the large pane is placed on the
left and the others spread from top to bottom along the right.
See the main-pane-width window option.
tiled Panes are spread out as evenly as possible over the window in
both rows and columns.
In addition, select-layout may be used to apply a previously used layout
- the list-windows command displays the layout of each window in a form
suitable for use with select-layout. For example:
$ tmux list-windows
0: ksh [159x48]
layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
tmux automatically adjusts the size of the layout for the current window
size. Note that a layout cannot be applied to a window with more panes
than that from which the layout was originally defined.
Commands related to windows and panes are as follows:
break-pane [-dP] [-F format] [-t target-pane]
(alias: breakp)
Break target-pane off from its containing window to make it the
only pane in a new window. If -d is given, the new window does
not become the current window. The -P option prints information
about the new window after it has been created. By default, it
uses the format ‘#{session_name}:#{window_index}’ but a different
format may be specified with -F.
capture-pane [-aepPq] [-b buffer-index] [-E end-line] [-S start-line] [-t
target-pane]
(alias: capturep)
Capture the contents of a pane. If -p is given, the output goes
to stdout, otherwise to the buffer specified with -b or a new
buffer if omitted. If -a is given, the alternate screen is used,
and the history is not accessible. If no alternate screen
exists, an error will be returned unless -q is given. If -e is
given, the output includes escape sequences for text and back‐
ground attributes. -C also escapes non-printable characters as
octal \xxx. -J joins wrapped lines and preserves trailing spaces
at each line's end. -P captures only any output that the pane
has received that is the beginning of an as-yet incomplete escape
sequence.'
-S and -E specify the starting and ending line numbers, zero is
the first line of the visible pane and negative numbers are lines
in the history. The default is to capture only the visible con‐
tents of the pane.
choose-client [-F format] [-t target-window] [template]
Put a window into client choice mode, allowing a client to be
selected interactively from a list. After a client is chosen,
‘%%’ is replaced by the client pty(4) path in template and the
result executed as a command. If template is not given, "detach-
client -t '%%'" is used. For the meaning of the -F flag, see the
FORMATS section. This command works only if at least one client
is attached.
choose-list [-l items] [-t target-window] [template]
Put a window into list choice mode, allowing items to be
selected. items can be a comma-separated list to display more
than one item. If an item has spaces, that entry must be quoted.
After an item is chosen, ‘%%’ is replaced by the chosen item in
the template and the result is executed as a command. If
template is not given, "run-shell '%%'" is used. items also
accepts format specifiers. For the meaning of this see the
FORMATS section. This command works only if at least one client
is attached.
choose-session [-F format] [-t target-window] [template]
Put a window into session choice mode, where a session may be
selected interactively from a list. When one is chosen, ‘%%’ is
replaced by the session name in template and the result executed
as a command. If template is not given, "switch-client -t '%%'"
is used. For the meaning of the -F flag, see the FORMATS sec‐
tion. This command works only if at least one client is
attached.
choose-tree [-suw] [-b session-template] [-c window-template] [-S format]
[-W format] [-t target-window]
Put a window into tree choice mode, where either sessions or win‐
dows may be selected interactively from a list. By default, win‐
dows belonging to a session are indented to show their relation‐
ship to a session.
Note that the choose-window and choose-session commands are wrap‐
pers around choose-tree.
If -s is given, will show sessions. If -w is given, will show
windows.
By default, the tree is collapsed and sessions must be expanded
to windows with the right arrow key. The -u option will start
with all sessions expanded instead.
If -b is given, will override the default session command. Note
that ‘%%’ can be used and will be replaced with the session name.
The default option if not specified is "switch-client -t '%%'".
If -c is given, will override the default window command. Like
-b, ‘%%’ can be used and will be replaced with the session name
and window index. When a window is chosen from the list, the
session command is run before the window command.
If -S is given will display the specified format instead of the
default session format. If -W is given will display the speci‐
fied format instead of the default window format. For the mean‐
ing of the -s and -w options, see the FORMATS section.
This command works only if at least one client is attached.
choose-window [-F format] [-t target-window] [template]
Put a window into window choice mode, where a window may be cho‐
sen interactively from a list. After a window is selected, ‘%%’
is replaced by the session name and window index in template and
the result executed as a command. If template is not given,
"select-window -t '%%'" is used. For the meaning of the -F flag,
see the FORMATS section. This command works only if at least one
client is attached.
display-panes [-t target-client]
(alias: displayp)
Display a visible indicator of each pane shown by target-client.
See the display-panes-time, display-panes-colour, and
display-panes-active-colour session options. While the indicator
is on screen, a pane may be selected with the ‘0’ to ‘9’ keys.
find-window [-CNT] [-F format] [-t target-window] match-string
(alias: findw)
Search for the fnmatch(3) pattern match-string in window names,
titles, and visible content (but not history). The flags control
matching behavior: -C matches only visible window contents, -N
matches only the window name and -T matches only the window
title. The default is -CNT. If only one window is matched,
it'll be automatically selected, otherwise a choice list is
shown.' For the meaning of the -F flag, see the FORMATS section.
This command works only if at least one client is attached.
join-pane [-bdhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane]
(alias: joinp)
Like split-window, but instead of splitting dst-pane and creating
a new pane, split it and move src-pane into the space. This can
be used to reverse break-pane. The -b option causes src-pane to
be joined to left of or above dst-pane.
kill-pane [-a] [-t target-pane]
(alias: killp)
Destroy the given pane. If no panes remain in the containing
window, it is also destroyed. The -a option kills all but the
pane given with -t.
kill-window [-a] [-t target-window]
(alias: killw)
Kill the current window or the window at target-window, removing
it from any sessions to which it is linked. The -a option kills
all but the window given with -t.
last-pane [-t target-window]
(alias: lastp)
Select the last (previously selected) pane.
last-window [-t target-session]
(alias: last)
Select the last (previously selected) window. If no
target-session is specified, select the last window of the cur‐
rent session.
link-window [-dk] [-s src-window] [-t dst-window]
(alias: linkw)
Link the window at src-window to the specified dst-window. If
dst-window is specified and no such window exists, the src-window
is linked there. If -k is given and dst-window exists, it is
killed, otherwise an error is generated. If -d is given, the
newly linked window is not selected.
list-panes [-as] [-F format] [-t target]
(alias: lsp)
If -a is given, target is ignored and all panes on the server are
listed. If -s is given, target is a session (or the current ses‐
sion). If neither is given, target is a window (or the current
window). For the meaning of the -F flag, see the FORMATS sec‐
tion.
list-windows [-a] [-F format] [-t target-session]
(alias: lsw)
If -a is given, list all windows on the server. Otherwise, list
windows in the current session or in target-session. For the
meaning of the -F flag, see the FORMATS section.
move-pane [-bdhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane]
(alias: movep)
Like join-pane, but src-pane and dst-pane may belong to the same
window.
move-window [-rdk] [-s src-window] [-t dst-window]
(alias: movew)
This is similar to link-window, except the window at src-window
is moved to dst-window. With -r, all windows in the session are
renumbered in sequential order, respecting the base-index option.
new-window [-adkP] [-c start-directory] [-F format] [-n window-name] [-t
target-window] [shell-command]
(alias: neww)
Create a new window. With -a, the new window is inserted at the
next index up from the specified target-window, moving windows up
if necessary, otherwise target-window is the new window location.
If -d is given, the session does not make the new window the cur‐
rent window. target-window represents the window to be created;
if the target already exists an error is shown, unless the -k
flag is used, in which case it is destroyed. shell-command is
the command to execute. If shell-command is not specified, the
value of the default-command option is used. -c specifies the
working directory in which the new window is created. It may
have an absolute path or one of the following values (or a subdi‐
rectory):
Empty string Current pane's directory
~ User's home directory
- Where session was started
. Where server was started
When the shell command completes, the window closes. See the
remain-on-exit option to change this behaviour.
The TERM environment variable must be set to “screen” for all
programs running inside tmux. New windows will automatically
have “TERM=screen” added to their environment, but care must be
taken not to reset this in shell start-up files.
The -P option prints information about the new window after it
has been created. By default, it uses the format
‘#{session_name}:#{window_index}’ but a different format may be
specified with -F.
next-layout [-t target-window]
(alias: nextl)
Move a window to the next layout and rearrange the panes to fit.
next-window [-a] [-t target-session]
(alias: next)
Move to the next window in the session. If -a is used, move to
the next window with an alert.
pipe-pane [-o] [-t target-pane] [shell-command]
(alias: pipep)
Pipe any output sent by the program in target-pane to a shell
command. A pane may only be piped to one command at a time, any
existing pipe is closed before shell-command is executed. The
shell-command string may contain the special character sequences
supported by the status-left option. If no shell-command is
given, the current pipe (if any) is closed.
The -o option only opens a new pipe if no previous pipe exists,
allowing a pipe to be toggled with a single key, for example:
bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
previous-layout [-t target-window]
(alias: prevl)
Move to the previous layout in the session.
previous-window [-a] [-t target-session]
(alias: prev)
Move to the previous window in the session. With -a, move to the
previous window with an alert.
rename-window [-t target-window] new-name
(alias: renamew)
Rename the current window, or the window at target-window if
specified, to new-name.
resize-pane [-DLRUZ] [-t target-pane] [-x width] [-y height] [adjustment]
(alias: resizep)
Resize a pane, up, down, left or right by adjustment with -U, -D,
-L or -R, or to an absolute size with -x or -y. The adjustment
is given in lines or cells (the default is 1).
With -Z, the active pane is toggled between zoomed (occupying the
whole of the window) and unzoomed (its normal position in the
layout).
respawn-pane [-k] [-t target-pane] [shell-command]
(alias: respawnp)
Reactivate a pane in which the command has exited (see the
remain-on-exit window option). If shell-command is not given,
the command used when the pane was created is executed. The pane
must be already inactive, unless -k is given, in which case any
existing command is killed.
respawn-window [-k] [-t target-window] [shell-command]
(alias: respawnw)
Reactivate a window in which the command has exited (see the
remain-on-exit window option). If shell-command is not given,
the command used when the window was created is executed. The
window must be already inactive, unless -k is given, in which
case any existing command is killed.
rotate-window [-DU] [-t target-window]
(alias: rotatew)
Rotate the positions of the panes within a window, either upward
(numerically lower) with -U or downward (numerically higher).
select-layout [-np] [-t target-window] [layout-name]
(alias: selectl)
Choose a specific layout for a window. If layout-name is not
given, the last preset layout used (if any) is reapplied. -n and
-p are equivalent to the next-layout and previous-layout com‐
mands.
select-pane [-lDLRU] [-t target-pane]
(alias: selectp)
Make pane target-pane the active pane in window target-window.
If one of -D, -L, -R, or -U is used, respectively the pane below,
to the left, to the right, or above the target pane is used. -l
is the same as using the last-pane command.
select-window [-lnpT] [-t target-window]
(alias: selectw)
Select the window at target-window. -l, -n and -p are equivalent
to the last-window, next-window and previous-window commands. If
-T is given and the selected window is already the current win‐
dow, the command behaves like last-window.
split-window [-dhvP] [-c start-directory] [-l size | -p percentage] [-t
target-pane] [shell-command] [-F format]
(alias: splitw)
Create a new pane by splitting target-pane: -h does a horizontal
split and -v a vertical split; if neither is specified, -v is
assumed. The -l and -p options specify the size of the new pane
in lines (for vertical split) or in cells (for horizontal split),
or as a percentage, respectively. All other options have the
same meaning as for the new-window command.
swap-pane [-dDU] [-s src-pane] [-t dst-pane]
(alias: swapp)
Swap two panes. If -U is used and no source pane is specified
with -s, dst-pane is swapped with the previous pane (before it
numerically); -D swaps with the next pane (after it numerically).
-d instructs tmux not to change the active pane.
swap-window [-d] [-s src-window] [-t dst-window]
(alias: swapw)
This is similar to link-window, except the source and destination
windows are swapped. It is an error if no window exists at
src-window.
unlink-window [-k] [-t target-window]
(alias: unlinkw)
Unlink target-window. Unless -k is given, a window may be
unlinked only if it is linked to multiple sessions - windows may
not be linked to no sessions; if -k is specified and the window
is linked to only one session, it is unlinked and destroyed.
KEY BINDINGS
tmux allows a command to be bound to most keys, with or without a prefix
key. When specifying keys, most represent themselves (for example ‘A’ to
‘Z’). Ctrl keys may be prefixed with ‘C-’ or ‘^’, and Alt (meta) with
‘M-’. In addition, the following special key names are accepted: Up,
Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to
F20, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space,
and Tab. Note that to bind the ‘"’ or ‘'’ keys, quotation marks are nec‐
essary, for example:"
bind-key '"' split-window
bind-key "'" new-window
Commands related to key bindings are as follows:
bind-key [-cnr] [-t key-table] key command [arguments]
(alias: bind)
Bind key key to command. By default (without -t) the primary key
bindings are modified (those normally activated with the prefix
key); in this case, if -n is specified, it is not necessary to
use the prefix key, command is bound to key alone. The -r flag
indicates this key may repeat, see the repeat-time option.
If -t is present, key is bound in key-table: the binding for com‐
mand mode with -c or for normal mode without. To view the
default bindings and possible commands, see the list-keys com‐
mand.
list-keys [-t key-table]
(alias: lsk)
List all key bindings. Without -t the primary key bindings -
those executed when preceded by the prefix key - are printed.
With -t, the key bindings in key-table are listed; this may be
one of: vi-edit, emacs-edit, vi-choice, emacs-choice, vi-copy or
emacs-copy.
send-keys [-lR] [-t target-pane] key ...
(alias: send)
Send a key or keys to a window. Each argument key is the name of
the key (such as ‘C-a’ or ‘npage’ ) to send; if the string is not
recognised as a key, it is sent as a series of characters. The
-l flag disables key name lookup and sends the keys literally.
All arguments are sent sequentially from first to last. The -R
flag causes the terminal state to be reset.
send-prefix [-2] [-t target-pane]
Send the prefix key, or with -2 the secondary prefix key, to a
window as if it was pressed.
unbind-key [-acn] [-t key-table] key
(alias: unbind)
Unbind the command bound to key. Without -t the primary key
bindings are modified; in this case, if -n is specified, the com‐
mand bound to key without a prefix (if any) is removed. If -a is
present, all key bindings are removed.
If -t is present, key in key-table is unbound: the binding for
command mode with -c or for normal mode without.
OPTIONS
The appearance and behaviour of tmux may be modified by changing the
value of various options. There are three types of option: server
options, session options and window options.
The tmux server has a set of global options which do not apply to any
particular window or session. These are altered with the set-option -s
command, or displayed with the show-options -s command.
In addition, each individual session may have a set of session options,
and there is a separate set of global session options. Sessions which do
not have a particular option configured inherit the value from the global
session options. Session options are set or unset with the set-option
command and may be listed with the show-options command. The available
server and session options are listed under the set-option command.
Similarly, a set of window options is attached to each window, and there
is a set of global window options from which any unset options are inher‐
ited. Window options are altered with the set-window-option command and
can be listed with the show-window-options command. All window options
are documented with the set-window-option command.
tmux also supports user options which are prefixed with a ‘@’. User
options may have any name, so long as they are prefixed with ‘@’, and be
set to any string. For example
$ tmux setw -q @foo "abc123"
$ tmux showw -v @foo
abc123