Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TMUX: A Screen Redux

coley
October 09, 2014

TMUX: A Screen Redux

This presentation explains the importance and benefits of using TMUX, a terminal multiplexer.

coley

October 09, 2014
Tweet

Other Decks in Technology

Transcript

  1. What is TMUX? “A terminal multiplexer is a software application

    that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.” - Wikipedia
  2. Why? Useful for dealing with multiple programs from a command

    line interface, and for separating programs from the shell that started them
  3. MOBI Development Worth Noting • Context switching - Features, Bugs,

    Tasks • Development, Demo, Production Console Programs • Terminal for Git • IRB/PRY Console • Tailing a Log • Resque Workers, Solr, Mailcatcher • Text Editor (optional, ya wuss)
  4. Vocabulary Sessions - Persistent, detachable workspaces Windows - “Tabs” that

    occupy the entire Session window Panes - Partitions within Windows Prefix - Keystroke that precedes TMUX commands * Default is Ctrl-b. This presentation uses Ctrl-a Command Line TMUX Keystrokes
  5. Sessions Create a new session: tmux new -s <session_name> *

    Immediately attaches to the new Session Detach from current session: Ctrl-a + d or tmux detach * Does not destroy the session List sessions: tmux list-sessions * This will display the name or id of the sessions and # of windows Attach to session: tmux attach -t <session_id/session_name> * If you only have one session: tmux attach Invoke session switcher: Ctrl-a + s * This lets you cycles through open sessions Command Line TMUX Keystrokes
  6. Windows Create a new window: Ctrl-a + c Rename current

    window: Ctrl-a + , * Window names default to currently running process Switch to window: Ctrl-a + <window number> * Window numbers start with 0 by default Kill current window: Ctrl-a + & Invoke window switcher: Ctrl-a + w TMUX Keystrokes Command Line
  7. Panes Split horizontally: Ctrl-a + “ == Remap ==> Ctrl-a

    + h Split vertically: Ctrl-a + % == Remap ==> Ctrl-a + v (ahem..Natively) Switch to another pane: Ctrl-a + o Swap pane locations: Ctrl-a + Ctrl-o Kill current pane: Ctrl-a + x Kill all except current pane: Ctrl-a + ! Command Line TMUX Keystrokes
  8. ...but Screen? Screen is considered a dead project • Not

    actively maintained • Heavy resource consumption • S'ghetti code ◦ Discourages bugfixes and improvements • Config is notoriously obtuse • No vertical splits, whaaaa? ◦ There's a patch to make this work, but it has not been added to the official codebase ◦ 4.1 discussed in Feb 07
  9. ...but TMUX! “The most impressive thing about tmux, in my

    view, is how frustrating the code audit was. In 2 hours, I found only one or two that had very minor security consequences. It was not accepted into the tree based on license alone. It is high quality code” - Theo de Raadt, founder and project lead for OpenBSD
  10. TMUX’s Case vs Screen • Client-Server Model: Windows are independent

    entities which may be attached simultaneously to multiple sessions and viewed from multiple clients, as well as moved freely between sessions within the same tmux server • Consistent, well-documented command interface, with the same syntax for interactivity, key binding, and from the shell • Multiple paste buffers • Emacs or vi key layout. AKA Developer Heaven • Nice status line syntax - with dynamic output • A cleaner, modern, easily extended, BSD-licensed codebase. • Status bar on by default • Native vertical splits!