tmux - an overview of the features of this powerful terminal multiplexer

29
tmux v1.9a Terminal Awsomeness

Upload: jhalfmoon

Post on 13-Jul-2015

107 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: tmux - An overview of the features of this powerful terminal multiplexer

tmuxv1.9a

Terminal Awsomeness

Page 2: tmux - An overview of the features of this powerful terminal multiplexer

Before we beginPhones quiet please

Thank you

Page 3: tmux - An overview of the features of this powerful terminal multiplexer

Today's subjects...

What is tmux?How to control tmuxDemo of significant featuresQuestions from you

Page 4: tmux - An overview of the features of this powerful terminal multiplexer

Random bits about me

I'm a long time Unix consultantI spend alot of time in terminalsI enjoy using good toolsI like to share good ideas

Page 5: tmux - An overview of the features of this powerful terminal multiplexer

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.

Page 6: tmux - An overview of the features of this powerful terminal multiplexer

What it can look like

Page 7: tmux - An overview of the features of this powerful terminal multiplexer

Why use it?

Session persistenceOne connection, multiple sessionsPower... more on that in a minute

Page 8: tmux - An overview of the features of this powerful terminal multiplexer

What makes it special?

easily and extensively configurablepowerful tilingscripted controlgood documentationactively maintainedclean code --> easy to contributecan be found by Google et al

Page 9: tmux - An overview of the features of this powerful terminal multiplexer

How does it work?

client --> server --> sessions --> windows --> panes

Page 10: tmux - An overview of the features of this powerful terminal multiplexer

Time for action

Controlling tmux

and

Basic window management

Page 11: tmux - An overview of the features of this powerful terminal multiplexer

Controling tmux - 1/5Using the shell

(Notice: Tab completion)

tmux (=tmux new‐session)tmux new‐windowtmux newwtmux list‐windowstmux detach‐clienttmux attach

As you can see... very scriptable indeed.

Page 12: tmux - An overview of the features of this powerful terminal multiplexer

Controling tmux - 2/5Using the built in command-prompt

(Notice: Command history and tab completion)

newwsplit ‐hrename‐windowprevious‐window

Page 13: tmux - An overview of the features of this powerful terminal multiplexer

Controling tmux - 3/5Using 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)

Page 14: tmux - An overview of the features of this powerful terminal multiplexer

Controling tmux - 4/5Using the mouse

Window selectionPane selectionPane resizingText selection

Cute? Yes.Practical? You decide.

Page 15: tmux - An overview of the features of this powerful terminal multiplexer

Controling tmux - 5/5Using the config files, lots can be customized.

/etc/tmux.conf$HOME/.tmux.conf

Session intializationLayout and colors of all status bar itemsExtending status bar with shell scriptsKeyboard shortcuts / macrosGeneral behaviour of tmux

Too much to mention here

Page 16: tmux - An overview of the features of this powerful terminal multiplexer

An example config file

# This is a very simplified tmux config exampleunbind C‐bset ‐g prefix C‐abind C‐a last‐windowbind C‐c new‐windowbind ‐ split‐window ‐vbind \ split‐window ‐hset ‐g status‐right "#[fg=#44ff44]@#H  %d‐%b‐%y  %H:%M"set ‐g mode‐keys vineww ‐n jodeli

Page 17: tmux - An overview of the features of this powerful terminal multiplexer

Tiling

Create / SplitNavigateCustom layoutsStandard layoutsRearrangeZoomBreak / JoinDelete / Kill

And last but not least...

Page 18: tmux - An overview of the features of this powerful terminal multiplexer

Synchronous input!

Page 19: tmux - An overview of the features of this powerful terminal multiplexer

Buffer manipulation

vi or emacs control modenavigate (always in copy mode)searchselect and copy text (line or block)past buffer (last or selected)save selected bufferrealtime logging to file

Page 20: tmux - An overview of the features of this powerful terminal multiplexer

ScriptingAn example: Opening a window with multiple ssh connections

Open a new windowCreate 4 panesStart ssh in each paneLog the output of each tile to diskEnable synchronized input

Can also be done on startup to initialize new sessions.

Page 21: tmux - An overview of the features of this powerful terminal multiplexer

Session sharing

1. Start a tmux session with a given socket path

2. Allow rw access to socket for group/users

3. Other user starts 'tmux attach' using the shared socket

tmux ‐S /tmp/tmux‐shared new

chown 777 /tmp/tmux‐shared

tmux ‐S /tmp/tmux‐shared attach

Page 22: tmux - An overview of the features of this powerful terminal multiplexer

Monitoring (in)activity

monitor panes for (in)activitymonitor panes for stringschanges on status bar indicates event

Page 23: tmux - An overview of the features of this powerful terminal multiplexer

Showing tmux stateThere are several commands to show the state of tmux

info                : show server status (clients,sessions,windows,panes)show‐options ‐g     : show tmux server settingsshow‐options ‐wg    : show window settingslist‐commands       : show available tmux commandslist‐keys           : show bound keyslist‐sessions (ls)

Start tmux ‐v and get a very detailed client log in the startup dir.

and much more...

Page 24: tmux - An overview of the features of this powerful terminal multiplexer

Cygwintmux is nowadays packaged with Cygwin

and works like a charm.

Page 25: tmux - An overview of the features of this powerful terminal multiplexer

Documentation

man tmux

tmux.sourceforge.nettmux FAQmany online examples

Page 26: tmux - An overview of the features of this powerful terminal multiplexer

Summarytmux is...

powerfulflexible

well documented

something you really ought to have in your toolkit

Page 27: tmux - An overview of the features of this powerful terminal multiplexer

That's all for now.This slideshow is available on

NOTE: Do check out the embedded note ("asides") in this reveal.js slideshow.slideshare.net

Page 28: tmux - An overview of the features of this powerful terminal multiplexer

Questions?

Page 29: tmux - An overview of the features of this powerful terminal multiplexer

Thank you!