Terminal Multiplexer
A program that runs many terminal sessions inside one window, splits it into panes, and keeps the sessions alive on a server after the connection drops, so long jobs and remote work survive disconnection.
A terminal multiplexer runs several terminal sessions inside one terminal window and keeps them alive independently of it. It can split the window into panes, switch between full-screen windows, and, most usefully, detach: the sessions keep running on the machine after the user disconnects, ready to be reattached later from the same or a different terminal.
GNU Screen, released in 1987, established the idea. tmux, started in 2007 by Nicholas Marriott and later included in OpenBSD, became the more popular modern choice, and newer tools such as Zellij, written in Rust, add friendlier defaults.
The architecture explains the persistence. A multiplexer runs as a background server that owns the terminal sessions, creating a Pseudoterminal for each shell inside it. The terminal window the user sees is only a client that connects to that server and draws its contents. Closing the window or losing a network connection ends the client, while the server, and every program running under it, carries on; see Daemon.
That solves a classic problem of remote work. Normally, when an SSH connection drops, the shell receives a hangup signal and its programs die with it. A long build, data migration, or test run started inside a multiplexer survives a closed laptop lid or a flaky hotel connection. Mosh, released in 2012, attacks the same problem at the connection level, keeping sessions alive as the client roams between networks.
Common features:
- Sessions, windows, and panes. A session holds a set of windows; each window can be split into panes, each running its own shell, a tiling layout inside the terminal; see Tiling Window Manager.
- A prefix key. Commands start with a chord, Control-B in tmux and Control-A in Screen, so the multiplexer can intercept keys without stealing them from the programs inside.
- Scrollback and copy mode. History is kept by the multiplexer, searchable and copyable with the keyboard.
- Sharing. Two people attached to one session see and type into the same terminal, a lightweight tool for pair programming and incident response.
The cost is an extra layer of translation. A multiplexer is itself a terminal emulator running inside another one: it interprets the escape codes programs send, keeps its own picture of each screen, and redraws it in the outer terminal; see ANSI Escape Code. Features the inner program expects, such as true color, clipboard access, or new keyboard protocols, work only if the multiplexer understands and passes them through, and it identifies itself through the TERM Environment Variable so programs know what it supports. Some terminal emulators now build in splits, but detaching on a remote machine still needs a multiplexer.
See also2
Command-Line Interface
Operating a computer by typing commands and reading text replies, the interface inherited from teletypes that remains the fastest, most scriptable, and least discoverable way to control software.
Systems & Tooling14 connections
Clipboard
The shared buffer behind cut, copy, and paste, invented at Xerox PARC, which offers data in several formats at once and has become a channel for snooping and for commands that paste differently from how they looked.
Systems & Tooling14 connections
Linked from8
- ANSI Escape CodeSystems & Tooling
The in-band byte sequences, starting with the escape character, that tell a terminal to move the cursor, change color, or clear the screen, inherited from 1970s video terminals and still how every command-line tool draws.
- ClipboardSystems & Tooling
The shared buffer behind cut, copy, and paste, invented at Xerox PARC, which offers data in several formats at once and has become a channel for snooping and for commands that paste differently from how they looked.
- Command-Line InterfaceSystems & Tooling
Operating a computer by typing commands and reading text replies, the interface inherited from teletypes that remains the fastest, most scriptable, and least discoverable way to control software.
- DaemonSystems & Tooling
A long-running background process managed by the operating system's service supervisor.
- PseudoterminalSystems & Tooling
The kernel device pair that lets a terminal window, SSH session, or tmux pane pretend to be a 1970s hardware terminal, and why programs behave differently when they are not attached to one.
- ShellSystems & Tooling
The interactive command interpreter, and a programming language with unusually sharp edges.
- Terminal User InterfaceGraphics & Rendering
An interface rendered as text in a terminal, and the design conventions that make command-line tools humane.
- Tiling Window ManagerDesign & Interface
A window manager that arranges windows automatically into non-overlapping tiles and is driven mainly from the keyboard, trading freeform placement for zero layout effort.