Presentation is loading. Please wait.

Presentation is loading. Please wait.

tmux Nicholas Marriott 2011

Similar presentations


Presentation on theme: "tmux Nicholas Marriott 2011"— Presentation transcript:

1 tmux Nicholas Marriott 2011

2 What is tmux? Terminal multiplexer...
Text program with three main features: Run multiple programs inside tmux and swap between them interactively Detach from the terminal and reattach later Move between terminals without affecting programs inside tmux Lots of other stuff but those are the biggest

3 Some background tmux started in 2007 Entirely in C, about 30K LOC now
Imported into OpenBSD base system in 2009 Portable version on SF Runs on *BSD, Linux, Solaris, AIX, HP-UX Currently version 1.4, probably 1.5 soon I'm the main developer but there are several other regular/significant contributors

4 So it's like GNU screen then?
Yes, similar ideas Similar abilities too now but different design tmux rarely based on how screen does things - I don't use it much

5 But what's different? I haven't used GNU screen for a while but:
tmux is BSD licensed tmux has a much more modern code style tmux is actively developed and released tmux is client-server and uses libevent Pane management is significantly different Fewer limits, better for emacs users (like me!) A lot of other stuff too

6 tmux terminology One server process - socket in /tmp
Server contains sessions which contain windows which can be split into panes which contain running programs Clients attach to server and display a session Clients are dumb - server does pretty much everything Windows have indexes (0, 1, 9999) and names (ksh, mutt, my_name, whatever)

7 What can tmux do? Some of the things I use a lot:
Client-server, session management Window panes and layouts Copy and paste Big, flexible command set Automatic window renaming

8 Client-server (Normally) one tmux server controls all terminals, child programs and so on Good: Move windows between sessions Change client session w/o reattach Global configuration and copy buffers Bad: If server dies, all is lost (but rare!)

9 Session management Attach one client and switch it between sessions w/o attach and detach Sessions can be like workspaces for different tasks Move windows between sessions or link them into multiple sessions Interactive menu to move between sessions At work I can get to >50 sessions over a few months

10 Window panes Split a window into arbitrary horizontal and vertical panes Arguments about which is horizontal and which vertical notwithstanding Preset window layouts (tiled, horizontal and more) Can set up and apply user layouts synchronize-panes option sends input to all panes (very useful with many servers!)

11 Copy and paste Copy mode can copy text from visible pane or scrolled history vi and emacs key bindings! Copy mode very usable - search, mouse support, try to match editors Global stack of paste buffers (in 1.5) across sessions Save and load buffers to file, stdout

12 Command set tmux has about 80 commands now
Commands have long forms and aliases Almost all can be used the same inside tmux, config or shell Great for scripting: for i in `jot 10`; do tmux splitw "ssh host$i"; tmux selectl tiled done

13 Command set (more) Command sequences (lsk; lsk; lsk)
Command prompt: enter command interactively Or prompt and substitute: bind ',' command-prompt "rename-window '%%'" confirm-before command prompts for y/n: bind 'x' confirm-before kill-pane

14 Command targets Almost all commands accept a target argument
Unified way to address clients, windows, panes tmux will make best guess for pretty much anything omitted Example to swap pane 0 in window 1 in session A with pane 2 in the current window: tmux swap-pane -s A:1.0 -t :.2

15 Automatic rename Only platform-specific code in tmux proper
Automatically figure out what is running in window and rename it Uses sysctl on *BSD, /proc on Linux Not as hacky as scraping stuff from the shell prompt and easier to configure (on by default) But doesn't follow over ssh Also can be a little slow on older boxes (best to turn off on your vax)

16 What else is sort of cool?
pipe-pane command - send all output to a pipe Mouse support - improved a lot for 1.5 thanks to a contributor, drag pane borders to resize etc Search for window containing text Very customisable, status line, messages log 256 colour and UTF-8 support Bell/activity monitoring Visual pane identification (shows numbers) ASCII art clock!

17 What can't tmux do? Big problems right now:
Panes can only be in one window - simpler to get panes working at first, hard to change now Windows cannot be bigger than smallest client (no panning) UTF-8 support needs improvement Huge todo list!

18 What's coming up? Diff CVS to tmux 1.4 is already 18000 lines
I have mails in my inbox now for more mouse improvements and handling of cursor colour/style changes Author of iterm has been investigating integrating it and tmux (really cool) I'm working on more flexible ways to format list output (such as custom ways to list sessions) Suggestions welcome

19 How does it work? Pseudoterminals (ptys)
Applications inside output to pty slave in TERM=screen format tmux reads from pty master and updates internal representation of terminal Also translates into client TERM and outputs Lots of other jazz to handle key bindings, commands, mouse and so on

20 Where can I get it? SourceForge http://tmux.sf.net
Highly recommended to use CVS and report bugs - early testing means better releases OpenBSD base system Packages or ports for most other platforms For help: tmux-users mailing list IRC channel #tmux on Freenode

21 Questions?


Download ppt "tmux Nicholas Marriott 2011"

Similar presentations


Ads by Google