65
tmux or how I learned to just compile it locally and not wait for it to get installed on sandbox - TERMINAL MULTIPLEXER Wednesday, December 5, 12

Tmux

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Tmux

tmuxor how I learned to just compile it locally and not wait

for it to get installed on sandbox-

TERMINAL MULTIPLEXER

Wednesday, December 5, 12

Page 2: Tmux

what is tmux?

Wednesday, December 5, 12

Page 3: Tmux

what is tmux?tmux is a terminal multiplexer: it enables a number of

terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single

screen. tmux may be detached from a screen and continue running in the background, then later reattached.

Wednesday, December 5, 12

Page 4: Tmux

screenshots

Wednesday, December 5, 12

Page 5: Tmux

AWESOME!Wednesday, December 5, 12

Page 6: Tmux

event better...

Wednesday, December 5, 12

Page 7: Tmux

our goal: doing thisWednesday, December 5, 12

Page 8: Tmux

tmux vs. screen

Wednesday, December 5, 12

Page 9: Tmux

a consistent, well-documented command interface, with the same

syntax whether used interactively, as a key binding, or from the

shellWednesday, December 5, 12

Page 10: Tmux

in other wordssane configuration

Wednesday, December 5, 12

Page 11: Tmux

easily scriptable from the shell

Wednesday, December 5, 12

Page 12: Tmux

tmux can split verticallyscreen requires a patch

Wednesday, December 5, 12

Page 13: Tmux

tmux bibleWednesday, December 5, 12

Page 14: Tmux

So, how did I install tmux?

Wednesday, December 5, 12

Page 15: Tmux

libevent

$ wget http://sourceforge.net/projects/levent/files/latest/download

$ tar xfz libevent-2.0.17-stable.tar.gz

$ cd libevent-2.0.17-stable/

$ /configure—prefix=/home/jlotito

$ make

$ make install

Wednesday, December 5, 12

Page 16: Tmux

tmux

$ wget http://sourceforge.net/projects/tmux/files/latest/download

$ tar xfz tmux-1.6.tar.gz

$ cd tmux-1.6

$ ./configure—prefix=/home/jlotito

Wednesday, December 5, 12

Page 17: Tmux

tmux cont.

$ ./configure—prefix=/home/jlotito CPPFLAGS=”-I$HOME/include” LDFLAGS=”-static -L$HOME/include -L$HOME/lib”

$ make

$ make install

$ export PATH=~/bin:$PATH

$ tmux -V

tmux 1.6

Wednesday, December 5, 12

Page 18: Tmux

If you have permissions,you can do it.

Wednesday, December 5, 12

Page 19: Tmux

sandbox vim: 7.0my vim: 7.3

Wednesday, December 5, 12

Page 20: Tmux

:set rnu

Wednesday, December 5, 12

Page 21: Tmux

Wednesday, December 5, 12

Page 22: Tmux

but you shouldn’t have to set things up

Wednesday, December 5, 12

Page 23: Tmux

$ cd$ mkdir bin$ cp ~/../jlotito/bin/tmux ~/bin$ export PATH=~/bin:$PATH

Wednesday, December 5, 12

Page 24: Tmux

$ tmux

Wednesday, December 5, 12

Page 25: Tmux

prefix = CTRL + bThis is the default prefix

It’s run before every command

prefix dThis means type ‘CTRL + b’ and then type ‘d’.

Wednesday, December 5, 12

Page 26: Tmux

prefix dDetaches from the current tmux session

In other words, it exits tmux

Wednesday, December 5, 12

Page 27: Tmux

detachdo it

Wednesday, December 5, 12

Page 28: Tmux

$ tmux attachreattaches to the tmux session

Wednesday, December 5, 12

Page 29: Tmux

do itnow

Wednesday, December 5, 12

Page 30: Tmux

Multiple sessionsYou can have them

We won’t discuss them today

Wednesday, December 5, 12

Page 31: Tmux

prefix ccreate a new window (or tab)

Wednesday, December 5, 12

Page 32: Tmux

prefix #‘prefix 1’ takes you to tab #1

Wednesday, December 5, 12

Page 33: Tmux

prefix wprovides a list of windows available

‘j’ and ‘k’ to scroll the selections

Wednesday, December 5, 12

Page 34: Tmux

prefix %That’s not 5, but ‘%’, which means

prefix SHIFT+5

This splits the pane in half

Wednesday, December 5, 12

Page 35: Tmux

prefix xIn the lower portion of tmux, you’ll see it ask you:

kill pane 2? (y/n)

type ‘y’

Wednesday, December 5, 12

Page 36: Tmux

prefix “split horizontally

Wednesday, December 5, 12

Page 37: Tmux

prefix oswitch between panes

Wednesday, December 5, 12

Page 38: Tmux

prefix CTRL + omove panes around layout

Wednesday, December 5, 12

Page 39: Tmux

PREFIX SPACEchange layout of panes

Wednesday, December 5, 12

Page 40: Tmux

Try scrolling in a panehaha

Wednesday, December 5, 12

Page 41: Tmux

prefix [CTRL u : up a lot

CTRL d: down a lotLove alot.j : up a line

d : down a lineq: quit

Wednesday, December 5, 12

Page 42: Tmux

Configuration$ touch ~/.tmux.conf

Wednesday, December 5, 12

Page 43: Tmux

CTRL + B is awkward# Prefix Configset -g prefix C-aunbind C-bbind C-a send-prefix

Wednesday, December 5, 12

Page 44: Tmux

prefix = CTRL + aRemap CAPS LOCK to CTRL.

Wednesday, December 5, 12

Page 45: Tmux

Make it responsive# Changing the default delayset -sg escape-time 1

Wednesday, December 5, 12

Page 46: Tmux

Easy config changes# Easy config changesbind r source-file ~/.tmux.conf \; display "Reloaded!"

Wednesday, December 5, 12

Page 47: Tmux

Easy Pane Spitting# Splitting Panesbind \ split-window -hbind - split-window -v

Wednesday, December 5, 12

Page 48: Tmux

Easy Pane Movement# Movement keys, vim stylebind h select-pane -Lbind j select-pane -Dbind k select-pane -Ubind l select-pane -R

Wednesday, December 5, 12

Page 49: Tmux

move one pane leftprefix h

Wednesday, December 5, 12

Page 50: Tmux

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

Wednesday, December 5, 12

Page 51: Tmux

Try the pane resizingDon’t forget to run this command

prefix r

Wednesday, December 5, 12

Page 52: Tmux

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

Wednesday, December 5, 12

Page 53: Tmux

resizeprefix L

-r You can hold it down, and it will keep moving

Wednesday, December 5, 12

Page 54: Tmux

Start at 1# Windows and panes index renumberingset -g base-index 1setw -g pane-base-index 1

Wednesday, December 5, 12

Page 55: Tmux

Basic UI# Colorsset -g status-fg whiteset -g status-bg black

Wednesday, December 5, 12

Page 56: Tmux

Window movement# Window Movementbind -r C-h select-window -t :-bind -r C-l select-window -t :+

Wednesday, December 5, 12

Page 57: Tmux

or...prefix w

Wednesday, December 5, 12

Page 58: Tmux

or...prefix ##: 0-9

Wednesday, December 5, 12

Page 59: Tmux

timtowtdi• is

Wednesday, December 5, 12

Page 60: Tmux

tmux & screen noteshttp://www.dayid.org/os/notes/tm.html

Wednesday, December 5, 12

Page 61: Tmux

bookhttp://pragprog.com/book/bhtmux/tmux

Wednesday, December 5, 12

Page 62: Tmux

webhttp://tmux.sourceforge.net/

Wednesday, December 5, 12

Page 63: Tmux

we were using tmux 1.6latest is tmux 1.7

Wednesday, December 5, 12

Page 64: Tmux

new in 1.7

tmux configuration files now support line-continuation with a "\" at the end of a line.* New option status-position to move the status line to the top or bottom of the screen.* Enforce history-limit option when clearing the screen.* Give each window a unique id, like panes but prefixed with @.* Add pane id to each pane in layout description (while still accepting the old form).* Provide defined ways to set the various default-path possibilities: ~ for home directory, . for server start directory, - for session start directory and empty for the pane's working directory (the default). All can also be used as part of a relative path (eg -/foo). Also provide -c flags to neww and splitw to override default-path setting.* Add -l flag to send-keys to send input literally (without translating key names).* Allow a single option to be specified to show-options to show just that option.* New command "move-pane" (like join-pane but allows the same window).* join-pane and move-pane commands learn "-b" option to place the pane to the left or above.* Support for bracketed-paste mode.* Allow send-keys command to accept hex values.* Add locking around "start-server" to avoid race-conditions.* break-pane learns -P/-F arguments for display formatting.* set-option learns "-q" to make it quiet, and not print out anything.* copy mode learns "wrap-search" option.* Add a simple form of output rate limiting by counting the number of certain C0 sequences (linefeeds, backspaces, carriage returns) and if it exceeds a threshold (current default 250/millisecond), start to redraw the pane every 100 milliseconds instead of making each change as it comes. Two configuration options - c0-change-trigger and c0-change-interval.* find-window learns new flags: "-C", "-N", "-T" to match against either or all of a window's content, name, or title. Defaults to all three options if none specified.* find-window automatically selects the appropriate pane for the found matches.* show-environment can now accept one option to show that environment value.* Exit mouse mode when end-of-screen reached when scrolling with the mouse wheel.* select-layout learns -u and -U for layout history stacks.* kill-window, detach-client, kill-session all learn "-a" option for killing all but the current thing specified.* move-window learns "-r" option to renumber window sequentially in a session.* New session option "renumber-windows" to automatically renumber windows in a session when a window is closed. (see "move-window -r").* Only enter copy-mode on scroll up.* choose-* and list-* commands all use "-F" for format specifiers.* When spawning external commands, the value from the "default-shell" option is now used, rather than assuming /bin/sh.* New choose-tree command to render window/sessions as a tree for selection.* display-message learns new format options.* For linked-windows across sessions, all flags for that window are now cleared across sessions.* Lots and lots of bug fixes, fixing memory-leaks, etc.* Various manpage improvements.

Wednesday, December 5, 12

Page 65: Tmux

fin.

Wednesday, December 5, 12