-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplexers.html
More file actions
1018 lines (1006 loc) · 27.1 KB
/
multiplexers.html
File metadata and controls
1018 lines (1006 loc) · 27.1 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<link rel="icon" type="image/gif" href="/favicon.gif"/>
<link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png" />
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png" />
<title>Lorem Ipsum</title>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<style type="text/css" id="internal-style">
@import url(hyperpolyglot.css);
</style>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta http-equiv="content-language" content="en"/>
</head>
<body>
<div id="container-wrap-wrap">
<div id="container-wrap">
<div id="container">
<div id="header">
<h1><a href="/"><span>Hyperpolyglot</span></a></h1>
</div>
<div id="content-wrap">
<div id="main-content">
<div id="page-title">Lorem Ipsum</div>
<div id="page-content">
<p><a href="#cmd-line-opts">command line options</a> | <a href="#key-bindings">key bindings</a> | <a href="#customization">customization</a> | <a href="#terminology">terminology</a> | <a href="#doc">documentation</a></p>
<p><a name="cmd-line-opts"></a></p>
<h2 id="toc0"><span>Command Line Options</span></h2>
<table class="wiki-content-table">
<tr>
<th></th>
<th>screen</th>
<th>tmux</th>
</tr>
<tr>
<td>create session and attach</td>
<td>$ screen</td>
<td>$ tmux</td>
</tr>
<tr>
<td>create session <em>foo</em> and attach</td>
<td>$ screen -S foo</td>
<td>$ tmux new -s foo</td>
</tr>
<tr>
<td>create detached session <em>foo</em></td>
<td>$ screen -S foo -d -m</td>
<td>$ tmux new -s foo -d</td>
</tr>
<tr>
<td>list sessions</td>
<td>$ screen -list</td>
<td>$ tmux ls</td>
</tr>
<tr>
<td>attach</td>
<td>$ screen -r</td>
<td>$ tmux attach</td>
</tr>
<tr>
<td>attach to session <em>foo</em></td>
<td>$ screen -r foo</td>
<td>$ tmux attach -t foo</td>
</tr>
<tr>
<td>attach to session by pid</td>
<td>$ screen -r <span style="color: gray"><em>pid</em></span></td>
<td> </td>
</tr>
<tr>
<td>kill session <em>foo</em></td>
<td>$ screen -r foo -X quit</td>
<td>$ tmux kill-session -t foo</td>
</tr>
<tr>
<td>send multiplexer command to session <em>foo</em></td>
<td>$ screen -r foo -X <span style="color: gray"><em>command</em></span></td>
<td>$ tmux <span style="color: gray"><em>command</em></span> -t foo</td>
</tr>
<tr>
<td>run ls in session <em>foo</em></td>
<td>$ screen -r foo -X stuff "ls $(echo -ne '\015')"</td>
<td>$ tmux send-keys -t foo 'ls' C-m</td>
</tr>
<tr>
<td>run vi in new window</td>
<td>$ screen vi /etc/motd </td>
<td>$ tmux new-window vi /etc/motd</td>
</tr>
</table>
<p><a name="key-bindings"></a></p>
<h2 id="toc1"><span>Key Bindings</span></h2>
<p><a href="#sessions">sessions</a> | <a href="#windows">windows</a> | <a href="#regions">regions</a> | <a href="#panes">panes</a> | <a href="#paste-buffer">paste buffer</a> | <a href="#copy-mode">copy mode</a></p>
<table class="wiki-content-table">
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>help</td>
<td>?</td>
<td>:help</td>
<td>?</td>
<td>:list-keys</td>
</tr>
<tr>
<td>send prefix to app</td>
<td>a</td>
<td>:meta</td>
<td>C-b</td>
<td>:send-prefix</td>
</tr>
<tr>
<td>suspend multiplexer</td>
<td>C-z</td>
<td>:suspend</td>
<td>C-z</td>
<td>:suspend-client</td>
</tr>
<tr>
<td>show previous multiplexer message</td>
<td>m<br />
C-m</td>
<td>:lastmsg</td>
<td>~</td>
<td>:show-messages</td>
</tr>
<tr>
<td>source file</td>
<td> </td>
<td>:source <span style="color: gray"><em>file</em></span></td>
<td> </td>
<td>:source-file <span style="color: gray"><em>file</em></span></td>
</tr>
<tr>
<td>detach</td>
<td>d<br />
C-d</td>
<td>:detach</td>
<td>d</td>
<td>:detach-client</td>
</tr>
<tr>
<th colspan="5"><a name="sessions"></a>sessions</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>new session</td>
<td> </td>
<td> </td>
<td> </td>
<td>:new</td>
</tr>
<tr>
<td>new named session</td>
<td> </td>
<td> </td>
<td> </td>
<td>:new -s foo</td>
</tr>
<tr>
<td>switch session</td>
<td> </td>
<td> </td>
<td>s</td>
<td>:choose-session</td>
</tr>
<tr>
<td>rename session</td>
<td> </td>
<td>:sessionname foo</td>
<td>$</td>
<td>command-prompt -I #S "rename-session '%%'"</td>
</tr>
<tr>
<td>kill session</td>
<td>C-\</td>
<td>:quit</td>
<td> </td>
<td> </td>
</tr>
<tr>
<th colspan="5"><a name="windows"></a>windows</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>create new window</td>
<td>c<br />
C-c</td>
<td>:screen</td>
<td>c</td>
<td>:new-window</td>
</tr>
<tr>
<td>switch to next window</td>
<td>n<br />
C-n<br />
SPACE</td>
<td>:next</td>
<td>n</td>
<td>:next-window</td>
</tr>
<tr>
<td>switch to previous window</td>
<td>BACKSPACE<br />
h<br />
p<br />
C-p</td>
<td>:prev</td>
<td>p</td>
<td>:previous-window</td>
</tr>
<tr>
<td>toggle to last window</td>
<td>C-a</td>
<td>:other</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>select window <span style="color: gray"><em>n</em></span></td>
<td> </td>
<td> </td>
<td><span style="color: gray"><em>n</em></span></td>
<td>:select-window -t :<span style="color: gray"><em>n</em></span></td>
</tr>
<tr>
<td>list windows</td>
<td>w<br />
C-w</td>
<td>:windows</td>
<td> </td>
<td>:list-windows</td>
</tr>
<tr>
<td>show current window number and name</td>
<td>N</td>
<td>:number</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>renumber current window</td>
<td> </td>
<td> </td>
<td>. <span style="color: gray"><em>position</em></span></td>
<td>:move-window</td>
</tr>
<tr>
<td>move current window to another session</td>
<td> </td>
<td> </td>
<td>. <span style="color: gray"><em>sessname</em></span><br />
. <span style="color: gray"><em>sessnum</em></span>:<span style="color: gray"><em>position</em></span></td>
<td> </td>
</tr>
<tr>
<td>redraw current window</td>
<td>l<br />
C-l</td>
<td>:redisplay</td>
<td>r</td>
<td>:refresh-client</td>
</tr>
<tr>
<td>choose window interactively</td>
<td>"</td>
<td>:windowlist -b</td>
<td>w</td>
<td>:choose-window</td>
</tr>
<tr>
<td>rename window</td>
<td>A</td>
<td>:title</td>
<td>,</td>
<td> </td>
</tr>
<tr>
<td>select window <span style="color: gray"><em>foo</em></span></td>
<td>'</td>
<td>:select</td>
<td>f <span style="color: gray"><em>foo</em></span></td>
<td> </td>
</tr>
<tr>
<td>close current window</td>
<td>C-k</td>
<td>:kill</td>
<td>&</td>
<td>:kill-window</td>
</tr>
<tr>
<td>join window 1 to current window</td>
<td> </td>
<td> </td>
<td> </td>
<td>:join-pane -s 1</td>
</tr>
<tr>
<td>join region 0 of window 1 to current window</td>
<td> </td>
<td> </td>
<td> </td>
<td>:join-pane -s 1.0</td>
</tr>
<tr>
<th colspan="5"><a name="regions"></a>regions</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>split into top and bottom regions</td>
<td>S</td>
<td>:split</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>move down to next region</td>
<td>TAB</td>
<td>:focus</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>make regions same height</td>
<td> </td>
<td>:resize =</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>close current region</td>
<td>X</td>
<td>:remove</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>close all but current region</td>
<td>Q</td>
<td>:only</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>clear current region</td>
<td>C</td>
<td>:clear</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>log region to file</td>
<td> </td>
<td><span style="color: gray"><em>file is</em> screenlog.NN</span><br />
:log</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>turn off logging</td>
<td> </td>
<td>:log off</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>make current region <span style="color: gray"><em>n</em></span> rows taller/shorter</td>
<td> </td>
<td>:resize +<span style="color: gray"><em>n</em></span><br />
:resize -<span style="color: gray"><em>n</em></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>make current region <span style="color: gray"><em>n</em></span> rows tall</td>
<td> </td>
<td>:resize <span style="color: gray"><em>n</em></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<th colspan="5"><a name="panes"></a>panes</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>split into left and right panes</td>
<td> </td>
<td> </td>
<td>%</td>
<td>:split-window -h</td>
</tr>
<tr>
<td>split into top and bottom panes</td>
<td> </td>
<td> </td>
<td>"</td>
<td>:split-window</td>
</tr>
<tr>
<td>switch to next panes</td>
<td> </td>
<td> </td>
<td>o</td>
<td>:select-pane</td>
</tr>
<tr>
<td>rotate panes</td>
<td> </td>
<td> </td>
<td>C-o</td>
<td>:rotate-window</td>
</tr>
<tr>
<td>reverse rotate panes</td>
<td> </td>
<td> </td>
<td>M-o</td>
<td>:rotate-window -D</td>
</tr>
<tr>
<td>arrange panes side-by-side and same width</td>
<td> </td>
<td> </td>
<td>M-1</td>
<td> </td>
</tr>
<tr>
<td>arrange panes stacked and same height</td>
<td> </td>
<td> </td>
<td>M-2</td>
<td> </td>
</tr>
<tr>
<td>swap current and previous pane</td>
<td> </td>
<td> </td>
<td>{</td>
<td>:swap-pane -U</td>
</tr>
<tr>
<td>swap current and next pane</td>
<td> </td>
<td> </td>
<td>}</td>
<td>:swap-pane -D</td>
</tr>
<tr>
<td>change arrangement of panes</td>
<td> </td>
<td> </td>
<td>SPACE</td>
<td>:next-layout</td>
</tr>
<tr>
<td>close current pane</td>
<td> </td>
<td> </td>
<td>x</td>
<td>:confirm-before kill-pane</td>
</tr>
<tr>
<td>break current pane into separate window</td>
<td> </td>
<td> </td>
<td>!</td>
<td>:break-pane</td>
</tr>
<tr>
<td>list panes</td>
<td> </td>
<td> </td>
<td> </td>
<td>:list-panes</td>
</tr>
<tr>
<td>display pane numbers</td>
<td> </td>
<td> </td>
<td>q</td>
<td>:display-panes</td>
</tr>
<tr>
<td>clear current pane</td>
<td> </td>
<td> </td>
<td> </td>
<td>:clear-history</td>
</tr>
<tr>
<td>log pane to file</td>
<td> </td>
<td> </td>
<td> </td>
<td>:pipe-pane "cat > /tmp/tmux.log"</td>
</tr>
<tr>
<td>turn off logging</td>
<td> </td>
<td> </td>
<td> </td>
<td>:pipe-pane</td>
</tr>
<tr>
<td>resize pane left/up <span style="color: gray"><em>n</em></span> cells</td>
<td> </td>
<td> </td>
<td> </td>
<td>:resize-pane -L <span style="color: gray"><em>n</em></span><br />
:resize-pane -U <span style="color: gray"><em>n</em></span></td>
</tr>
<tr>
<th colspan="5"><a name="paste-buffer"></a>paste buffer</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th>C-a <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th>C-b <span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>enter copy mode</td>
<td>[<br />
C-[<br />
ESC</td>
<td>:copy</td>
<td>[</td>
<td>:copy-mode</td>
</tr>
<tr>
<td>paste most recent buffer</td>
<td>]</td>
<td> </td>
<td>]</td>
<td>:paste-buffer</td>
</tr>
<tr>
<td>list buffers</td>
<td><span style="color: gray"><em>only one buffer</em></span></td>
<td> </td>
<td>#</td>
<td>:list-buffers</td>
</tr>
<tr>
<td>choose buffer to paste interactively</td>
<td> </td>
<td> </td>
<td>=</td>
<td>:choose-buffer</td>
</tr>
<tr>
<td>write buffer to file</td>
<td><span style="color: gray"><em>writes to</em> /tmp/screen-exchange:</span><br />
<span style="white-space: pre-wrap;">></span></td>
<td>:writebuf <span style="color: gray"><em>path</em></span></td>
<td> </td>
<td>:save-buffer <span style="color: gray"><em>path</em></span></td>
</tr>
<tr>
<td>copy file to buffer</td>
<td><span style="color: gray"><em>copies from</em> /tmp/screen-exchange:</span><br />
<span style="white-space: pre-wrap;"><</span></td>
<td>:readbuf <span style="color: gray"><em>path</em></span></td>
<td> </td>
<td>:load-buffer <span style="color: gray"><em>path</em></span></td>
</tr>
<tr>
<th colspan="5"><a name="copy-mode"></a>copy mode</th>
</tr>
<tr>
<th></th>
<th colspan="2">screen</th>
<th colspan="2">tmux</th>
</tr>
<tr>
<th></th>
<th><span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
<th><span style="color: gray"><em>cmd</em></span></th>
<th>command</th>
</tr>
<tr>
<td>default bindings</td>
<td colspan="2"><span style="color: gray"><em>Vim-style</em></span></td>
<td colspan="2"><span style="color: gray"><em>Emacs-style</em></span></td>
</tr>
<tr>
<td>set mark</td>
<td>SPACE</td>
<td> </td>
<td>C-SPACE</td>
<td> </td>
</tr>
<tr>
<td>copy from mark to point and exit copy mode</td>
<td><span style="color: gray"><em>when mark is set:</em></span><br />
SPACE</td>
<td> </td>
<td>C-w</td>
<td> </td>
</tr>
<tr>
<td>single column movement</td>
<td><span style="color: gray"><em>also left right arrow</em></span><br />
h l</td>
<td> </td>
<td><span style="color: gray"><em>also left right arrow</em></span><br />
C-b C-h</td>
<td> </td>
</tr>
<tr>
<td>single line movement</td>
<td><span style="color: gray"><em>also down up arrow</em></span><br />
j k</td>
<td> </td>
<td><span style="color: gray"><em>also down up arrow</em></span><br />
C-n C-p</td>
<td> </td>
</tr>
<tr>
<td>beginning of line</td>
<td>0</td>
<td> </td>
<td>C-a</td>
<td> </td>
</tr>
<tr>
<td>end of line</td>
<td>$</td>
<td> </td>
<td>C-e</td>
<td> </td>
</tr>
<tr>
<td>forward word</td>
<td>e</td>
<td> </td>
<td>M-f</td>
<td> </td>
</tr>
<tr>
<td>backward word</td>
<td>b</td>
<td> </td>
<td>M-b</td>
<td> </td>
</tr>
<tr>
<td>page up</td>
<td>C-b</td>
<td> </td>
<td>M-v</td>
<td> </td>
</tr>
<tr>
<td>page down</td>
<td>C-f</td>
<td> </td>
<td>C-v</td>
<td> </td>
</tr>
<tr>
<td>beginning of buffer</td>
<td>g</td>
<td> </td>
<td>M-<</td>
<td> </td>
</tr>
<tr>
<td>end of buffer</td>
<td>G</td>
<td> </td>
<td>M-</td>
<td> </td>
</tr>
<tr>
<td>search backwards</td>
<td>? <span style="color: gray"><em>phrase</em></span></td>
<td> </td>
<td>C-r <span style="color: gray"><em>phrase</em></span></td>
<td> </td>
</tr>
<tr>
<td>search forwards</td>
<td>/ <span style="color: gray"><em>phrase</em></span></td>
<td> </td>
<td>C-s <span style="color: gray"><em>phrase</em></span></td>
<td> </td>
</tr>
<tr>
<td>exit copy mode</td>
<td><span style="color: gray"><em>any unbound key also works:</em></span><br />
ESC</td>
<td> </td>
<td>q</td>
<td> </td>
</tr>
</table>
<p><a name="customization"></a></p>
<h2 id="toc2"><span>Customization</span></h2>
<table class="wiki-content-table">
<tr>
<th></th>
<th><a href="#screen">screen</a></th>
<th><a href="#tmux">tmux</a></th>
</tr>
<tr>
<td>startup file</td>
<td>~/.screenrc</td>
<td>~/.tmux.conf</td>
</tr>
<tr>
<td>scrollback length</td>
<td>defscrollback 2000</td>
<td>set-option history-limit 2000</td>
</tr>
<tr>
<td>set prefix</td>
<td><span style="color: gray"><em>how to set prefix to C-b, with a second C-b to send a C-b to the controlling process:</em></span><br />
escape ^B^B</td>
<td>set-option -g prefix C-a</td>
</tr>
<tr>
<td>define key binding</td>
<td>bind</td>
<td>bind-key</td>
</tr>
<tr>
<td>undefine key binding</td>
<td> </td>
<td>unbind-key</td>
</tr>
<tr>
<td>set copy/scrollback key binding style</td>
<td><span style="color: gray"><em>vi bindings by default.<br />
When redefining, use vi<br />
commands on left of equations:</em></span><br />
markkeys h=^B:l=^F:$=^E</td>
<td><span style="color: gray"><em>emacs by default:</em></span><br />
setw -g mode-keys vi</td>
</tr>
<tr>
<td>disable startup message</td>
<td>startup_message off</td>
<td> </td>
</tr>
<tr>
<td>number windows from one</td>
<td> </td>
<td><span style="color: gray"><em>0 by default:</em></span><br />
set -g base-index 1</td>
</tr>
<tr>
<td>always show status bar</td>
<td><span style="color: gray"><em>splitonly by default:</em></span><br />
caption always<br />
caption splitonly</td>
<td><span style="color: gray"><em>on by default:</em></span><br />
set-option status off<br />
set-option status on</td>
</tr>
<tr>
<td>customize caption</td>
<td>caption string "<span style="color: gray"><em>string</em></span>"</td>
<td>set-option status-left "<span style="color: gray"><em>string</em></span>"<br />
set-option status-right <span style="color: gray"><em>string</em></span></td>
</tr>
</table>
<table class="wiki-content-table">
<tr>
<th colspan="3">caption escapes</th>
</tr>
<tr>
<th></th>
<th>screen</th>
<th>tmux</th>
</tr>
<tr>
<td>shell output</td>
<td><span style="color: gray"><em>first arg is an identifier referenced by the caption string;<br />
the second and third argument set the refresh in seconds</em></span><br />
<br />
backtick 1 60 60 <span style="color: gray"><em>cmd</em></span><br />
caption always "%1<span style="white-space: pre-wrap;">`</span>"</td>
<td>#(<span style="color: gray"><em>cmd</em></span>)</td>
</tr>
<tr>
<td>date (YYYYMMDD)</td>
<td>%Y%m%d</td>
<td> </td>
</tr>
<tr>
<td>month name</td>
<td>%M</td>
<td> </td>
</tr>
<tr>
<td>weekday name</td>
<td>%D</td>
<td> </td>
</tr>
<tr>
<td>24 hr time</td>
<td>%C</td>
<td> </td>
</tr>
<tr>
<td>12 hr time</td>
<td>%c%A</td>
<td> </td>
</tr>
<tr>
<td>color</td>
<td>%{ry}<span style="color: gray"><em>red text, yellow background</em></span>%{dd}foo</td>
<td>#[fg=red,bg=yellow]<span style="color: gray"><em>red text, yellow background</em></span>#[default]</td>
</tr>
<tr>
<td>fully qualified hostname</td>
<td> </td>
<td>#H</td>
</tr>
<tr>
<td>hostname</td>
<td>%H</td>
<td>#h</td>
</tr>
<tr>
<td>session name</td>
<td>%S <span style="color: gray"><em>added in 4.1</em></span></td>
<td>#S</td>
</tr>
<tr>
<td>current window flag</td>
<td>%F</td>
<td>#F</td>
</tr>
<tr>
<td>current window index</td>
<td>%n</td>
<td>#I</td>
</tr>
<tr>
<td>current pane index</td>
<td><span style="color: gray"><em>none</em></span></td>
<td>#P|</td>
</tr>
<tr>
<td>current pane title</td>
<td><span style="color: gray"><em>none</em></span></td>
<td>#T</td>
</tr>
<tr>
<td>window name</td>
<td>%t</td>
<td>#W</td>
</tr>
<tr>
<td>literal % or #</td>
<td>%%</td>
<td><span style="white-space: pre-wrap;">##</span></td>
</tr>
</table>
<p><a name="terminology"></a></p>
<h2 id="toc3"><span>Terminology</span></h2>
<p><a href="#def-server">server</a> | <a href="#def-client">client</a> | <a href="#def-session">session</a> | <a href="#def-window">window</a> | <a href="#def-region">region</a> | <a href="#def-pane">pane</a></p>
<p><strong>how ssh works:</strong></p>
<p>When a user logs in to a remote host using <tt>ssh</tt>, the <tt>ssh</tt> process contacts an <tt>sshd</tt> process listening on TCP port 22. The <tt>sshd</tt> process opens up a new TCP port and forks off a copy of itself for communicating with the <tt>ssh</tt> process. The new port and child process are for the exclusive use of the connection being established.</p>
<p>The child <tt>sshd</tt> process authenticates the <tt>ssh</tt> process, and if it passes it creates a pseudo-terminal. It then forks the remote user's shell which becomes the controlling process for the pseudo-terminal.</p>
<p>If the network connection is closed, either explicitly by the <tt>ssh</tt> process or because of a loss of network connectivity, the child <tt>sshd</tt> process closes the pseudo-terminal, and this in turn causes the shell to exit.</p>
<p><strong>the SIGHUP problem:</strong></p>
<p>If the shell had any process groups running when it exits, they are sent a <tt>SIGHUP</tt> signal followed by a <tt>SIGCONT</tt> signal. By default processes exit when they receive <tt>SIGHUP</tt>. This makes it challenging to run long-running jobs on a remote host when the network connection is unreliable.</p>
<p>A simple solution to the <tt>SIGHUP</tt> problem is to run each job with <tt>nohup</tt>. Optionally, shells such as <tt>bash</tt> and <tt>zsh</tt> have a <tt>disown</tt> built-in which can be used on a process that is already running, should the user have neglected to run it with <tt>nohup</tt>.</p>
<p>The <tt>fish</tt> shell when invoking a process in the background with <tt>&</tt> sets the signal handling state of the process to ignore <tt>SIGHUP</tt>. It will do the same if the process is suspended with <tt>^Z</tt> and then put in the background with <tt>bg</tt>.</p>
<p>Multiplexers offer a solution which protects the shell instead of the job. The user doesn't need to remember to run each job with <tt>nohup</tt>. As an added benefit any state kept by the shell is preserved.</p>
<p><a name="def-server"></a><strong>server:</strong></p>
<p>The multiplexer server creates pseudo-terminals which are used for running and interacting with programs.</p>
<p><em>Screen</em> and <em>Tmux</em> servers can create multiple pseudo-terminals. The controlling process for each pseudo-terminal is the user's shell.</p>
<p><a name="def-client"></a><strong>client:</strong></p>
<p>To see the output of a shell the user must connect to the multiplexer server with a multiplexer client process.</p>
<p>If the multiplexer is being run on a remote machine and the user's connection is lost, the server and its terminals and controlling processes persist, but the client process exits.</p>
<p>When multiple client processes connect to the same server they see the same output. This is a way to share a display across computers.</p>
<p><a name="def-session"></a><strong>session:</strong></p>
<p>Multiplexers support multiple sessions. Each multiplexer session has its own set of terminals and controlling processes which it is running. The client must choose a session to attach to, and will only be able to see the output of the controlling processes in that session. Sessions can be given names to make it easy for the client to choose the correct session.</p>
<p><em>Screen</em> launches a separate server process for each session. <em>Screen</em> servers and clients communicate via named pipes.</p>
<p><em>Tmux</em> by default will only run one server process per user, and this server process can have multiple sessions. A <em>Tmux</em> client and the server communicate via a Unix domain socket in the /tmp directory. The <tt>-L</tt> option can be used to specify a different socket; a new server is created for each socket.</p>
<p><a name="def-window"></a><strong>window:</strong></p>
<p>Both <em>Screen</em> and <em>Tmux</em> have entities which they call windows.</p>
<p>A <em>Screen</em> window has a single pseudo-terminal and shell. A <em>Tmux</em> window can have multiple pseudo-terminals and shells.</p>
<p><em>Screen</em> windows can share the viewport. The <em>Tmux</em> viewport can only display one window at a time.</p>
<p>Both <em>Screen</em> and <em>Tmux</em> windows are numbered starting from zero.</p>
<p><a name="def-region"></a><strong>region:</strong></p>
<p><em>Screen</em> can divide the viewport into multiple regions.</p>
<p><em>Screen</em> regions can be empty or they can contain a window. The same window can be displayed in more than one region. When regions share a window their content is identical.</p>
<p><em>Screen</em> regions are stacked on top of each other and extend the full width of the window.</p>
<p><a name="def-pane"></a><strong>pane:</strong></p>
<p><em>Tmux</em> can divide windows into multiple panes.</p>
<p><em>Tmux</em> panes contain a single pseudo-terminal with a shell, and each pseudo-terminal and shell belongs to only one pane.</p>
<p><em>Tmux</em> windows can be divided both horizontally and vertically into panes. Each division can be subdivided further.</p>
<p><em>Tmux</em> panes are numbered.</p>
<p><em>Tmux</em> panes can be moved between windows.</p>
<p><strong>command character (prefix):</strong></p>
<p>Multiplexers pass most input on to the shell in the region with focus, but a special command character is used to send commands to the multiplexer.</p>
<p>The default command character in <em>Screen</em> is <tt>C-a</tt>. The keystrokes which follow <tt>C-a</tt> are interpreted by <em>Screen</em> instead of being passed to the shell.</p>
<p><em>Tmux</em> calls the command character the <em>prefix</em> and the default value is <tt>C-b</tt>. The keystrokes following the prefix are interpreted by <em>Tmux</em> instead of being passed to shell.</p>
<p><strong>scrollback buffer (history):</strong></p>
<p><em>Screen</em> and <em>Tmux</em> keep a history of the output of each shell. The maximum length of the output in lines is configurable.</p>
<p><em>Screen</em> calls the history the scrollback buffer.</p>
<p><strong>copy/scrollback mode (copy mode):</strong></p>
<p><em>Screen</em> and <em>Tmux</em> support two modes for each region. In default mode, input which is not intercepted by the multiplexer is passed to the shell.</p>
<p>When the region is in copy mode the region behaves like a read-only buffer of an editor. The contents are the output of the shell including output that may have scrolled off the top of the region.</p>
<p>The keybindings used by <em>Screen</em> in copy/scrollback mode are Vim-style. It is possible to customize them to be Emacs-style.</p>
<p>The <em>Tmux</em> calls copy/scrollback mode simply copy mode. The keybindings are by default Emacs-style.</p>
<p><strong>paste buffer:</strong></p>
<p><em>Screen</em> has a single paste buffer.</p>
<p><em>Tmux</em> has multiple paste buffers. The <em>Tmux</em> paste buffers are numbered; the most recent is number zero. Sessions share a common paste buffer history.</p>
<p><strong>caption (status line):</strong></p>
<p>When a <em>Screen</em> window is split into multiple regions, a caption line is placed at the bottom of each region. When a window contains a single region, <em>Screen</em> by default does not display a caption. The caption, when present, contains information from <em>Screen</em>. The information that is displayed can be customized.</p>
<p><em>Tmux</em> calls the line at the bottom of a window the status line. By default it is always displayed, though it can be turned off. The status line contains information from <em>Tmux</em> which can be customized.</p>
</div>
</div>
</div>
<div id="license-area" class="license-area">
<a href="https://github.com/clarkgrubb/hyperpolyglot/issues">issue tracker</a> |
content of this page licensed under
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
creative commons attribution-sharealike 3.0</a>
<br>
</div>
</div>