Back to terminal directory

Multiplexers · Multiplexers

tmux

Persistent terminal sessions for remote servers and long-running agents.

Open sourceC
Official site
Short answer

tmux is a free, open-source terminal multiplexer. It lets one terminal window hold many sessions, windows and split panes, and it keeps those sessions running on the machine after you close the window or lose an SSH connection. You start a named session with tmux new -s work, detach with Ctrl-b then d, and reattach later with tmux attach -t work. That makes tmux the standard way to keep long builds, servers and AI coding agents running on a remote machine. Install it with your package manager, such as brew install tmux or apt install tmux.

License
ISC
GitHub, tmux/tmux
Written in
C
GitHub, tmux/tmux
Version 3.6 released
November 26, 2025
tmux releases
Default prefix key
Ctrl-b
tmux manual

Updated October 21, 2026How we evaluate tools

tmux guide: sessions, panes, config and running AI agents that keep going

tmux has been the standard terminal multiplexer on Unix systems since its first release in 2007, when Nicholas Marriott wrote it as a modern replacement for GNU Screen. It is written in C, released under the permissive ISC license, and part of OpenBSD's base system. Releases come roughly every six months. Version 3.6, released on November 26, 2025, added scrollbars for panes and support for terminals that report light or dark themes, and later releases have continued that pace.

The rise of AI coding agents has given tmux a new audience. Agents can run for an hour on a large task, and tmux is the simplest way to start one on a remote machine, disconnect and check back later.

The three building blocks

  • A session is a collection of windows that keeps running on the machine where tmux runs. You can detach from it and attach again later, from the same or a different terminal.
  • A window is like a tab inside a session.
  • A pane is a split inside a window. Each pane runs its own shell.

A tmux server process holds all of this. It starts automatically with your first session and keeps running until the last session ends.

Installing tmux

SystemCommand
macOSbrew install tmux
Debian, Ubuntusudo apt install tmux
Fedorasudo dnf install tmux
Archsudo pacman -S tmux
WindowsInstall inside WSL with the Linux command

Commands you need on day one

Every key binding starts with the prefix, Ctrl-b by default. Press the prefix, release it, then press the next key.

ActionCommand or keys
New named sessiontmux new -s work
List sessionstmux ls
Attach to a sessiontmux attach -t work
DetachCtrl-b d
Split left and rightCtrl-b %
Split top and bottomCtrl-b "
Move between panesCtrl-b then an arrow key
Zoom a pane to full windowCtrl-b z (again to unzoom)
New windowCtrl-b c
Switch windowCtrl-b 0 to 9, or Ctrl-b n and p
Scroll back (copy mode)Ctrl-b [, then arrows or Page Up, q to exit
List key bindingsCtrl-b ?
Kill a sessiontmux kill-session -t work

A starter config

tmux reads ~/.tmux.conf (or ~/.config/tmux/tmux.conf). A short config that many people start from:

# Use Ctrl-a as prefix, like GNU Screen
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# Mouse support: click panes, drag borders, scroll
set -g mouse on

# Start window and pane numbers at 1
set -g base-index 1
setw -g pane-base-index 1

# Easier splits that open in the current folder
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# More scrollback and true color
set -g history-limit 50000
set -g default-terminal "tmux-256color"

# Reload config
bind r source-file ~/.tmux.conf \; display "Reloaded"

Reload with tmux source-file ~/.tmux.conf or the r binding above.

What changed in tmux 3.6

The 3.6 release added options that users had asked for over years:

  • Pane scrollbars. pane-scrollbars turns on a scrollbar at the side of each pane, with options for position and style.
  • Theme reporting. tmux can tell programs whether the terminal uses a light or dark theme, so editors and tools inside tmux can switch colors to match.
  • Copy mode improvements, including new styles for the cursor position and selection, and new scroll commands.
  • Other options, such as no-detach-on-destroy for clients and a limit on nested source-file calls.

Later releases have built on this. Check tmux -V and the CHANGES file for what your version supports.

Running AI agents with tmux

A typical setup for running an agent on a remote server:

  1. SSH into the server and start a session: tmux new -s agent.
  2. Split the window: the agent in the left pane, git diff --stat or your test watcher on the right.
  3. Start the agent, such as Claude Code or Codex CLI, and give it a task.
  4. Detach with Ctrl-b d and close your laptop.
  5. Later, SSH in and tmux attach -t agent to see progress or answer a prompt.

Because tmux can be scripted, you can also drive agents from outside. tmux send-keys -t agent "run the tests" Enter types into a pane, and tmux capture-pane -p -t agent prints what is on screen. Some orchestration tools use these commands to run several agents in parallel panes and collect their output.

Set the agent's permissions with care before you detach. An agent waiting for approval will sit idle until you return, and an agent with full permissions will act without anyone watching. A container or a separate user account on the server limits the damage if something goes wrong.

Plugins

The tmux plugin manager (TPM) installs plugins listed in your config. Popular ones include:

  • tmux-resurrect and tmux-continuum, which save and restore sessions across server reboots.
  • tmux-sensible, a set of agreed-upon defaults.
  • tmux-yank, which copies to the system clipboard.

Limits

Learning curve. The prefix-key model takes a few days to feel natural.

Sessions do not survive a reboot of the server without a plugin such as tmux-resurrect, and even then running programs restart from scratch.

Clipboard and colors need setup. Copying to your local clipboard over SSH depends on your terminal supporting OSC 52. True color needs the right default-terminal setting and a terminal that supports it.

No native Windows version. Use WSL.

tmux compared with alternatives

ToolWhat it isBest for
tmuxTerminal multiplexerRemote sessions, scripting, the same setup everywhere
GNU ScreenOlder multiplexerSystems where only Screen is installed
ZellijRust multiplexer with on-screen hintsPeople who want an easier start and built-in layouts
Terminal tabs and splitsBuilt into emulatorsLocal work that does not need to outlive the window

For a fuzzy picker that works in tmux popups, see fzf. For a fast terminal to run tmux in, see Alacritty. The full list is in the terminal tools guide.

Frequently asked questions

What is tmux used for?

tmux keeps terminal sessions alive and organizes them. Its two main uses are persistence, where a session keeps running on a server after you disconnect so you can reattach later, and layout, where you split one window into panes to watch an editor, a test runner and logs side by side. Developers also use it to run AI coding agents for hours on a remote machine without keeping a laptop connected.

How do I install tmux?

On macOS, run brew install tmux. On Debian and Ubuntu, run sudo apt install tmux. On Fedora, sudo dnf install tmux, and on Arch, sudo pacman -S tmux. tmux does not run natively on Windows, so use it inside WSL. Check the version with tmux -V. Distribution packages can be a few releases behind the latest.

What are the most important tmux commands?

tmux new -s name starts a named session. Ctrl-b d detaches. tmux ls lists sessions. tmux attach -t name reattaches. Inside tmux, Ctrl-b % splits the pane left and right, Ctrl-b " splits it top and bottom, Ctrl-b and an arrow key moves between panes, Ctrl-b c creates a window and Ctrl-b followed by a number switches to that window. Ctrl-b [ enters copy mode to scroll back.

How do I keep an AI agent running after I disconnect?

SSH into the server, run tmux new -s agent, start the agent inside that session, then press Ctrl-b d to detach. The agent keeps running on the server. Later, SSH back in and run tmux attach -t agent to see where it is. Pair this with the agent's own permission settings, since nobody is watching while you are detached.

Should I use tmux or my terminal's built-in tabs and splits?

Use your terminal's tabs and splits if you only work on your own computer and do not need sessions to outlive the window. Use tmux when you work over SSH, need sessions that survive disconnects and reboots of your laptop, want the same layout on every machine, or want to script and automate terminal sessions with commands such as send-keys and capture-pane.

Sources

  1. tmux on GitHub
  2. tmux wiki, Getting Started
  3. tmux 3.6 CHANGES file
  4. tmux manual page
  5. tmux plugin manager (TPM)