tmux — Terminal Multiplexer for Sessions, Windows, Panes
tmux is a terminal multiplexer that lets you switch between several programs in one terminal, detach them, and reattach them to a different terminal. Essential for SSH workflows, long-running processes, and pair programming.
Instalación lista para agent
Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.
npx -y tokrepo@latest install 6ed07802-35cb-11f1-9bc6-00163e2b0d79 --target codexEjecutar después de confirmar el plan con dry-run.
What it is
tmux is a terminal multiplexer that lets you create multiple terminal sessions within a single terminal window, split the screen into panes, and detach/reattach sessions. When you disconnect from SSH, tmux keeps your programs running. Reattach later and everything is exactly where you left it.
This tool is essential for developers working over SSH, running long processes, or managing multiple terminal workflows simultaneously. It is installed on most Linux servers and available on macOS.
How it saves time or tokens
tmux eliminates the fear of losing work when an SSH connection drops. Long-running builds, database migrations, and server monitoring continue in detached sessions. The ability to split panes lets you monitor logs while editing code without switching windows. For AI-assisted terminal workflows, tmux sessions provide persistent context that survives disconnections.
How to use
- Install tmux.
- Start a new session.
- Use key bindings to manage panes and windows.
- Detach and reattach as needed.
# Install tmux
brew install tmux # macOS
sudo apt install tmux # Ubuntu/Debian
# Start a new named session
tmux new -s myproject
# Detach from session (inside tmux)
# Press Ctrl+b, then d
# List sessions
tmux ls
# Reattach to session
tmux attach -t myproject
# Kill a session
tmux kill-session -t myproject
Example
Common tmux key bindings (after Ctrl+b prefix):
Ctrl+b % Split pane vertically
Ctrl+b " Split pane horizontally
Ctrl+b o Switch to next pane
Ctrl+b x Close current pane
Ctrl+b c Create new window
Ctrl+b n Next window
Ctrl+b p Previous window
Ctrl+b d Detach from session
Ctrl+b [ Enter scroll/copy mode
Ctrl+b z Zoom current pane (toggle)
A .tmux.conf customization:
# Enable mouse support
set -g mouse on
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Use vi keys in copy mode
setw -g mode-keys vi
# Increase scrollback buffer
set -g history-limit 50000
Related on TokRepo
- Automation tools — Terminal productivity tools
- DevOps tools — Server management tools
Common pitfalls
- The default prefix key (Ctrl+b) is awkward. Many users remap it to Ctrl+a in .tmux.conf.
- Scrolling inside tmux requires entering copy mode (Ctrl+b [). Without this, scrolling affects the outer terminal.
- Nested tmux sessions (tmux inside tmux over SSH) create confusing prefix key conflicts. Use a different prefix for the inner session.
- tmux configuration changes require reloading:
tmux source-file ~/.tmux.confor restarting tmux. - Some terminal emulators have compatibility issues with tmux's terminal capabilities. Use a modern terminal for full feature support.
Preguntas frecuentes
Programs continue running in the background. The tmux server keeps the session alive on the machine. You can reattach later and see output that was generated while you were detached.
tmux is the modern successor to GNU screen. It has a more consistent command interface, better pane management, a scriptable status bar, and active development. Screen still works but tmux is preferred for new setups.
Yes. Add 'set -g mouse on' to your .tmux.conf. This enables mouse-based pane selection, resizing, window switching, and scrolling.
Enter copy mode with Ctrl+b [. Navigate with arrow keys (or vi keys if configured). Press Space to start selection, then Enter to copy. Paste with Ctrl+b ]. Some users configure tmux to sync with the system clipboard.
No. Standard tmux sessions are lost on reboot. Plugins like tmux-resurrect and tmux-continuum can save and restore session layouts, but running processes are still terminated.
Referencias (3)
- tmux GitHub— tmux is a terminal multiplexer
- tmux Wiki— tmux manual and configuration
- tmux Man Page— Terminal multiplexer concepts
Relacionados en TokRepo
Discusión
Activos relacionados
herdr — Terminal Multiplexer for Agents
Terminal-first agent multiplexer with persistent sessions, panes, and workspaces. Track agent state (blocked/working/done) without leaving your terminal.
tmuxinator — Manage Complex tmux Sessions with YAML Configs
A Ruby gem that lets you define tmux sessions, windows, and panes in YAML files and launch them with a single command. Eliminates repetitive manual setup of development environments.
Zellij — Terminal Workspace with Batteries Included
Zellij is a terminal workspace (multiplexer) with batteries included. Written in Rust with sane defaults, discoverable keybindings, a layout system, floating panes, session management, and a WebAssembly plugin system. The modern alternative to tmux.
Claude Squad — Manage Multiple AI Agent Sessions
Terminal multiplexer for AI coding agents. Run multiple Claude Code or Aider sessions in parallel with tmux-based management, status tracking, and git worktrees.