tmux - terminal multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux overview...
TRANSCRIPT
![Page 2: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/2.jpg)
tmux
Overview
Dramatically expands what can be donewith terminal windowsAlternative to older program named “screen”Often used for interactive server sessions
that can survive network disconnections
2
![Page 3: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/3.jpg)
tmux
Book
tmux: Productive Mouse-Free DevelopmentBrian P. Hogan
Pragmatic Programmers
3
![Page 4: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/4.jpg)
tmux
For You?
Do you work in a Unixey environment?Do you frequently use terminal windows?Do you value using keyboard shortcuts?
4
![Page 5: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/5.jpg)
tmux
tmux Commands
Large number of themMany ways to execute
command-line
shell script
command mode in tmux client
keyboard shortcut in tmux client
tmux configuration file
5
![Page 6: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/6.jpg)
tmux
Key Bindings
Prefix keyC-b by default; many change to C-a
Meta keyabbreviated as M; cmd-option on Mac
Commandslist-keys or prefix ?
bind-key [-r] {key} {command}
-r allows repeated used without prefix
unbind-key {key}
6
![Page 7: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/7.jpg)
tmux
Terminology
serverclientsessionwindowpanestatus bar
7
![Page 8: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/8.jpg)
tmux
Sample Session
Demo time!
8
![Page 9: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/9.jpg)
tmux
Session Actions
newdetachattachlistrenameswitch - one being displayedkill
9
![Page 10: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/10.jpg)
tmux
Window Actions
newrenameswitch - one being viewedlistmove - to a different sessionkill
10
![Page 11: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/11.jpg)
tmux
Pane Actions
new - via splitswitch - one that is activechange layoutresizerotate - to change position of allswap - to change position of twomove - to different windowexecute command - from a script into a specific panekill
11
![Page 12: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/12.jpg)
tmux
Predefined Pane Layouts ...
even-horizontal
12
even-vertical
![Page 13: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/13.jpg)
tmux
... Predefined Pane Layouts
main-horizontalmain-verticaltiled
13
![Page 14: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/14.jpg)
tmux
Buffers
Each pane has a buffer that storescommands entered and their output
has a limited size that defaults to 2000 lines
Enter “copy mode” toscroll through and copy linesEach copy adds a “paste buffer” to a stack
has a limited size that defaults to 20
14
![Page 15: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/15.jpg)
tmux
Copy Mode Actions
enter copy modeexit copy modemove cursorcopy selected textcopy all visible textlist paste buffersview paste buffer contents
save paste buffercontent to a filepaste text froma paste bufferchange paste bufferstack sizedelete one paste bufferdelete all paste buffers
15
![Page 16: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/16.jpg)
tmux
Configuration Options
Three kindsserver
session
window
Option scopeglobal
specific session
specific window
Actionsset option
show option
16
![Page 17: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/17.jpg)
tmux
Configuration Files
Looks for ~/.tmux.conf firstThen looks for /etc/tmux.confLet’s examine mine!
17
![Page 18: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/18.jpg)
tmux
Scripting
Consider creating one setup script for each projectCreates a new project session if it doesn’t exist
creates windows
splits them into panes
starts commands in some windowsex. editor, file watching apps, ssh, ...
Otherwise, attaches to existing sessionLet’s examine one of mine!
18
![Page 19: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/19.jpg)
tmux
Collaboration
ssh to a remote serverStart a tmux session thereAsk others to
ssh to same remote server
attach to same tmux session
Collaborate!
19
![Page 20: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/20.jpg)
tmux
Multiple Monitors
Run client in first monitor attached to main sessionRun client in other monitors attached to a new session that is “grouped” with main sessionAllows each client to viewa different window in main sessionSet window option “aggressive-resize” to “on”
allows each client window to be a different size
20
![Page 21: tmux - Terminal Multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux Overview Dramatically expands what can be done with terminal windows Alternative to older program](https://reader031.vdocuments.site/reader031/viewer/2022022003/5aa1d70e7f8b9ac67a8c4f6a/html5/thumbnails/21.jpg)
tmux
Mac Specific Advice
Use iTerm2Change some System PreferencesChange some iTerm2 PreferencesFor details, see my OCI SETT article
http://sett.ociweb.com/sett/settJan2013.html
21