What is tmux?
tmux is a terminal multiplexer: it enables a number of terminals 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. When tmux is started, it creates a new session with a single window and displays it on screen. A status line at the bottom of the screen shows information on the current session and is used to enter interactive commands.How tmux Works
In tmux, a session is displayed on screen by a client and all sessions are managed by a single server. The server and each client are separate processes which communicate through a socket in/tmp.
Sessions
A session is a single collection of pseudo terminals under tmux management. Each session has one or more windows linked to it.
Windows
A window occupies the entire screen and may be split into rectangular panes. Any number of windows may be present in the same session.
Panes
Each pane is a separate pseudo terminal. Windows can be split horizontally or vertically into multiple panes.
Key Features
Session Persistence
Sessions survive accidental disconnection (such as SSH connection timeout) or intentional detaching. Simply reattach when you’re ready to continue.
Multiple Sessions
Any number of tmux instances may connect to the same session. Share your terminal with others or access the same session from multiple locations.
Window Management
Split windows into multiple panes, create unlimited windows per session, and switch between them with keyboard shortcuts.
Cross-Platform
Runs on OpenBSD, FreeBSD, NetBSD, Linux, macOS, and Solaris. Available through package managers on all major platforms.
Use Cases
Remote Development
Remote Development
Keep your development environment running on a remote server. Disconnect from SSH without losing your work, and reconnect from anywhere to pick up exactly where you left off.
Multi-Process Monitoring
Multi-Process Monitoring
Run multiple processes in separate panes within a single window. Monitor logs, run tests, and edit code simultaneously without switching terminal windows.
Pair Programming
Pair Programming
Multiple users can attach to the same session, seeing the same content and working collaboratively in real-time.
Long-Running Tasks
Long-Running Tasks
Start long-running tasks, detach from the session, and reattach later to check progress. Your tasks continue running even when you’re disconnected.
Architecture
The tmux architecture consists of three main components:- Server: A single background process that manages all sessions
- Sessions: Collections of windows that persist independently
- Clients: Terminal connections that attach to and display sessions
Each session is persistent and will survive accidental disconnection. You can reattach using
tmux attach.Control with Key Bindings
tmux is controlled from an attached client using a key combination of a prefix key,C-b (Ctrl-b) by default, followed by a command key.
For example:
C-b ccreates a new windowC-b %splits the current pane verticallyC-b "splits the current pane horizontallyC-b ddetaches from the current session
bind-key and unbind-key commands in your configuration file.
Getting Started
Installation
Install tmux on your platform using package managers or build from source.
Quick Start
Get up and running with tmux in 5 minutes. Learn the essential commands and workflow.
System Requirements
tmux depends on:- libevent 2.x: Event notification library
- ncurses: Terminal handling library
- C compiler: gcc or clang for building from source
- make and pkg-config: Build tools
- yacc or bison: Parser generator