3. Today's subjects...
What is tmux?
How to control tmux
Demo of significant features
Questions from you
4. Random bits about me
I'm a long time Unix consultant
I spend alot of time in terminals
I enjoy using good tools
I like to share good ideas
5. What is tmux?
tmux is a terminal multiplexer
"it enables a number of terminals to be created,
accessed, and controlled from a single screen."
Indeed... like GNU screen.
7. Why use it?
Session persistence
One connection, multiple sessions
Power... more on that in a minute
8. What makes it special?
easily and extensively configurable
powerful tiling
scripted control
good documentation
actively maintained
clean code --> easy to contribute
can be found by Google et al
9. How does it work?
client --> server --> sessions --> windows --> panes
10. Time for action
Controlling tmux
and
Basic window management
11. Controling tmux - 1/5
Using the shell
tmux (=tmux new‐session)
tmux new‐window
tmux neww
tmux list‐windows
tmux detach‐client
tmux attach
(Notice: Tab completion)
As you can see... very scriptable indeed.
12. Controling tmux - 2/5
Using the built in command-prompt
neww
split ‐h
rename‐window
previous‐window
(Notice: Command history and tab completion)
13. Controling tmux - 3/5
Using shortcuts
Prefix Key + Commandkey
C‐a c (create new window)
C‐a C‐a (goto last window)
C‐a C‐n (goto next window)
C‐a C‐p (goto previous window)
C‐a 2 (jump to window number)
C‐a ‐ (new horizontal split)
C‐a , (rename window)
C‐a d (detach)
14. Controling tmux - 4/5
Using the mouse
Window selection
Pane selection
Pane resizing
Text selection
Cute? Yes.
Practical? You decide.
15. Controling tmux - 5/5
Using the config files, lots can be customized.
/etc/tmux.conf
$HOME/.tmux.conf
Session intialization
Layout and colors of all status bar items
Extending status bar with shell scripts
Keyboard shortcuts / macros
General behaviour of tmux
Too much to mention here
16. An example config file
# This is a very simplified tmux config example
unbind C‐b
set ‐g prefix C‐a
bind C‐a last‐window
bind C‐c new‐window
bind ‐ split‐window ‐v
bind split‐window ‐h
set ‐g status‐right "#[fg=#44ff44]@#H %d‐%b‐%y %H:%M"
set ‐g mode‐keys vi
neww ‐n jodeli
17. Tiling
Create / Split
Navigate
Custom layouts
Standard layouts
Rearrange
Zoom
Break / Join
Delete / Kill
And last but not least...
19. Buffer manipulation
vi or emacs control mode
navigate (always in copy mode)
search
select and copy text (line or block)
past buffer (last or selected)
save selected buffer
realtime logging to file
20. Scripting
An example: Opening a window with multiple ssh connections
Open a new window
Create 4 panes
Start ssh in each pane
Log the output of each tile to disk
Enable synchronized input
Can also be done on startup to initialize new sessions.
21. Session sharing
1. Start a tmux session with a given socket path
tmux ‐S /tmp/tmux‐shared new
2. Allow rw access to socket for group/users
chown 777 /tmp/tmux‐shared
3. Other user starts 'tmux attach' using the shared socket
tmux ‐S /tmp/tmux‐shared attach
23. Showing tmux state
There are several commands to show the state of tmux
info : show server status (clients,sessions,windows,panes)
show‐options ‐g : show tmux server settings
show‐options ‐wg : show window settings
list‐commands : show available tmux commands
list‐keys : show bound keys
list‐sessions (ls)
Start tmux ‐v and get a very detailed client log in the startup dir.
and much more...
24. Cygwin
tmux is nowadays packaged with Cygwin
and works like a charm.