tmux
-
Upload
jason-lotito -
Category
Software
-
view
280 -
download
1
Transcript of tmux
![Page 1: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/1.jpg)
tmuxReal Ultimate Terminal Power
Everything is Awesome Edition
tmux.sf.net
Go ahead and install it and follow along!For Windows users: tmux can be installed under cygwin
![Page 2: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/2.jpg)
quick demo
![Page 3: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/3.jpg)
Jason LotitoSenior Architect @ MeetMe.com
Slides available at joind.in/13251
![Page 4: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/4.jpg)
$ tmux
![Page 5: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/5.jpg)
$ tmux new -s confoo
![Page 6: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/6.jpg)
prefix = CTRL + bThis is the default prefix
It’s run before every command
prefix dThis means type ‘CTRL + b’ and then type ‘d’.
![Page 7: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/7.jpg)
prefix dDetaches from the current tmux session
In other words, it exits tmux
![Page 8: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/8.jpg)
$ tmux lsSee sessions running
![Page 9: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/9.jpg)
$ tmux attachreattaches to the last tmux session
you were attached to
![Page 10: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/10.jpg)
$ tmux attach -t confooreattaches to session named confoo
![Page 11: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/11.jpg)
prefix ccreate a new window (or tab)
![Page 12: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/12.jpg)
prefix ,Name the window
![Page 13: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/13.jpg)
prefix &Close window, with prompt
![Page 14: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/14.jpg)
demo 1
![Page 15: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/15.jpg)
set renumber-windowsAutomatically renumber windows on closing
Will get to commands later
![Page 16: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/16.jpg)
prefix #‘prefix 1’ takes you to window/tab #1
![Page 17: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/17.jpg)
prefix wprovides a list of windows available
‘j’ and ‘k’ to scroll the selections
![Page 18: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/18.jpg)
prefix %That’s not 5, but ‘%’, which means
prefix SHIFT+5
This splits the pane in half
![Page 19: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/19.jpg)
prefix xkills the active pane
In the lower portion of tmux, you’ll see it ask you:kill pane 2? (y/n)
type ‘y’
![Page 20: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/20.jpg)
prefix “split horizontally
![Page 21: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/21.jpg)
prefix oswitch between panes
![Page 22: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/22.jpg)
prefix SPACEchange layout of panes
![Page 23: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/23.jpg)
demo 2
![Page 24: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/24.jpg)
Try scrolling in a panehaha
![Page 25: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/25.jpg)
prefix [CTRL u: scroll up
CTRL d: scroll down
j: up a lined: down a lineq: quit mode
![Page 26: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/26.jpg)
prefix ?Help, with also reflects your config
![Page 27: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/27.jpg)
prefix zzoom in on a panecheap copy/paste
![Page 28: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/28.jpg)
prefix :Open up the tmux command prompt
Autocomplete enabled
![Page 29: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/29.jpg)
prefix :set synchronize-panes
set sy<TAB>Toggles synchronization on and off
![Page 30: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/30.jpg)
demo 3
![Page 31: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/31.jpg)
Configuration$ touch ~/.tmux.conf
![Page 32: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/32.jpg)
CTRL + B is awkward# Prefix Configset -g prefix C-aunbind C-b
# C-a x2 to send C-a to bashbind C-a send-prefix
![Page 33: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/33.jpg)
prefix = CTRL + aRemap CAPS LOCK to CTRL.
![Page 34: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/34.jpg)
Make it responsive# Changing the default delayset -sg escape-time 1
![Page 35: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/35.jpg)
Easy config changes# Easy config changesbind r source-file ~/.tmux.conf \; display "Reloaded!"
![Page 36: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/36.jpg)
Easy Pane Spitting# Splitting Panesbind \ split-window -hbind - split-window -v
![Page 37: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/37.jpg)
Easy Pane Movement# Movement keys, vim stylebind h select-pane -Lbind j select-pane -Dbind k select-pane -Ubind l select-pane -R
![Page 38: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/38.jpg)
move one pane leftprefix h
![Page 39: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/39.jpg)
Pane Resizing# Pane resizing, vim stylebind H resize-pane -L 5bind J resize-pane -D 5bind K resize-pane -U 5bind L resize-pane -R 5
![Page 40: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/40.jpg)
Let’s make resizing easier by repeating
# Pane resizing, vim stylebind -r H resize-pane -L 5bind -r J resize-pane -D 5bind -r K resize-pane -U 5bind -r L resize-pane -R 5
![Page 41: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/41.jpg)
resizeprefix L
-r Means you can hit it repeatedly without the prefix
![Page 42: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/42.jpg)
Start at 1# Windows and panes index renumberingset -g base-index 1setw -g pane-base-index 1
![Page 43: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/43.jpg)
Basic UI# Colorsset -g status-fg whiteset -g status-bg black
![Page 44: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/44.jpg)
Window movement# Window Movementbind -r C-h select-window -t :-bind -r C-l select-window -t :+
![Page 45: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/45.jpg)
or...prefix w
![Page 46: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/46.jpg)
or...prefix ##: 0-9
![Page 47: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/47.jpg)
My Confighttps://gist.github.com/11405471.git
Or, if you download these slides…
![Page 48: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/48.jpg)
# Mac Terminal Supportset -g default-terminal "xterm-256color"
# Prefixset -g prefix C-aunbind C-b
# Start number at 1set -g base-index 1setw -g pane-base-index 1
# Faster command sequences by removing escape timeset -s escape-time 0
# Rebindset -g prefix C-abind C-a send-prefixunbind C-b
# Move around panesbind h select-pane -Lbind j select-pane -Dbind k select-pane -Ubind l select-pane -R
# Splitting Panesbind \ split-window -hbind - split-window -v
bind -r C-h select-window -t :-bind -r C-l select-window -t :+
# Allow us to resize panesbind -r H resize-pane -L 5bind -r J resize-pane -D 5bind -r K resize-pane -U 5bind -r L resize-pane -R 5
![Page 49: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/49.jpg)
teamocila tmux “addon”
![Page 50: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/50.jpg)
teamocil 0.4.51.0 was a rewrite, removing features I loved
tmuxinator also exists
![Page 51: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/51.jpg)
$ gem install teamocil -v 0.4.5The version I recommend
![Page 52: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/52.jpg)
$ teamocil -e <name>edit the config
![Page 53: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/53.jpg)
1 session: 2 name: "confoo" 3 clear: true 4 windows: 5 - name: "confoo" 6 layout: even-horizontal 7 options: 8 synchronize-panes: true 9 panes: 10 - cmd: "" 11 - cmd: "top" 12 - name: "redis" 13 panes: 14 - cmd: "redis-server"
![Page 54: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/54.jpg)
let’s see it
![Page 55: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/55.jpg)
Another sample file
![Page 56: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/56.jpg)
0 session: 1 name: "consumers" 2 clear: true 3 windows: 4 - name: "consumers" 5 options: 6 synchronize-panes: true 7 layout: tiled 8 panes: 9 - cmd: “ssh consumer1 -t 'sudo su - jenkins'" 10 - cmd: "ssh consumer2 -t 'sudo su - jenkins'" 11 - cmd: "ssh consumer3 -t 'sudo su - jenkins'" 12 - cmd: "ssh consumer4 -t 'sudo su - jenkins'" 13 - cmd: "ssh consumer5 -t 'sudo su - jenkins'" 14 - cmd: "ssh consumer6 -t 'sudo su - jenkins'" 15 - cmd: "ssh consumer7 -t 'sudo su - jenkins'" 16 - cmd: "ssh consumer8 -t 'sudo su - jenkins'" 17 - cmd: "ssh consumer9 -t 'sudo su - jenkins'" 18 - cmd: "ssh consumer10 -t 'sudo su - jenkins'" 19 - cmd: "ssh consumer11 -t 'sudo su - jenkins'" 20 - cmd: "ssh consumer12 -t 'sudo su - jenkins'" 21 - cmd: "ssh consumer13 -t 'sudo su - jenkins'" 22 - cmd: "ssh consumer14 -t 'sudo su - jenkins'" 23 - cmd: "ssh consumer15 -t 'sudo su - jenkins'" 24 - cmd: "ssh consumer16 -t 'sudo su - jenkins'"
![Page 57: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/57.jpg)
tmux & screen noteshttp://www.mechanicalkeys.com/files/os/notes/tm.html
![Page 58: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/58.jpg)
![Page 59: tmux](https://reader034.fdocuments.net/reader034/viewer/2022042817/55a849e01a28ab98108b48df/html5/thumbnails/59.jpg)
Thanks!
Please review at joind.in/13251
Slides at the same URL