Frequently Asked Questions
Find answers to the most common questions about tmux. Search or browse by category.
Getting Started
Essential questions for beginners learning tmux
tmux (terminal multiplexer) is a powerful tool that lets you create, access, and control multiple terminal sessions from a single window. Key benefits include: persistent sessions that survive disconnections (perfect for SSH), efficient window and pane management to organize your work, the ability to detach and reattach to sessions from anywhere, and scriptable automation for repeatable workflows. It's essential for developers, sysadmins, and anyone who works extensively in the terminal.
Both tmux and screen are terminal multiplexers, but tmux is more modern and feature-rich. Key differences: tmux has better documentation and more active development, a cleaner configuration syntax, superior window/pane management, better scripting support, and more intuitive default key bindings. Screen is older but still reliable for basic use. Most new users choose tmux for its modern features and active community.
tmux uses a hierarchy of containers: Sessions are the top level - think of them as projects or workspaces that persist across connections. Windows are like tabs within a session - each window has a name and can contain the full terminal. Panes are splits within a window - you can divide a window horizontally or vertically to show multiple terminals simultaneously. Example: You might have a 'development' session with windows for 'editor', 'server', and 'logs', where the 'editor' window has panes for code, tests, and git.
Detach with Ctrl+b then d (or type 'tmux detach'). Your session keeps running in the background. Reattach with 'tmux attach' for the most recent session, or 'tmux attach -t session-name' for a specific session. List all sessions with 'tmux list-sessions' or 'tmux ls'. This is one of tmux's most powerful features - your work persists even if your terminal closes or SSH connection drops.
Installation
How to install tmux on various platforms
Install with Homebrew using 'brew install tmux', or MacPorts using 'sudo port install tmux'. Both support Intel and Apple Silicon Macs and handle dependencies for you. Verify the installed version with 'tmux -V'. The latest upstream stable release is 3.7c, but the version installed depends on your package manager's available package. If you don't have Homebrew, install it first from brew.sh.
Run 'sudo apt update' followed by 'sudo apt install tmux'. This installs the version available in your configured repositories, which may be older than the upstream stable release, 3.7c. If you need 3.7c, follow the installation guide to build the official stable release tarball. Verify with 'tmux -V'. These commands also apply to Ubuntu inside WSL.
Yes, through WSL (Windows Subsystem for Linux). Install WSL2 with Ubuntu, then run 'sudo apt update' and 'sudo apt install tmux' inside Ubuntu. Other WSL distributions use their own package manager. Check the installed version with 'tmux -V'; your distribution may package an older version than the upstream stable release, 3.7c. Windows Terminal can host your WSL and tmux sessions.
Use the package manager that installed it: 'brew update' then 'brew upgrade tmux' for Homebrew, 'sudo port selfupdate' then 'sudo port upgrade tmux' for MacPorts, 'sudo apt update' then 'sudo apt install --only-upgrade tmux' for Ubuntu/Debian, 'sudo dnf upgrade --refresh tmux' for Fedora/RHEL, or 'sudo pacman -Syu tmux' for Arch (a full system upgrade). Packages may lag the latest stable release, 3.7c; use the official 3.7c release tarball if needed. 3.8-rc is a prerelease. 'tmux -V' checks the installed binary, but existing servers keep running the old version. Save files and finish jobs in every session, close the old sessions normally, then start tmux from a terminal outside tmux. 'tmux kill-server' terminates all sessions on that server and their running programs, so do not use it before saving or finishing all work.
Commands & Key Bindings
Understanding tmux keyboard shortcuts and commands
The prefix key is Ctrl+b by default. You press it before any tmux command. For example, to create a new window, press Ctrl+b, release, then press c. Many users change the prefix to Ctrl+a (which was screen's prefix) for easier reaching. Add 'set -g prefix C-a' and 'unbind C-b' to your .tmux.conf to change it.
Split horizontally (side-by-side panes) with Ctrl+b then %. Split vertically (stacked panes) with Ctrl+b then ". Navigate between panes with Ctrl+b then arrow keys. Close a pane with Ctrl+b then x (or just type 'exit'). Many users remap these to more intuitive keys like | for horizontal and - for vertical splits.
Create a new window with Ctrl+b then c. Switch to next window with Ctrl+b then n, previous with Ctrl+b then p, or specific window by number with Ctrl+b then 0-9. Rename the current window with Ctrl+b then ,. Close a window with Ctrl+b then &. List all windows with Ctrl+b then w for an interactive chooser.
Enter copy mode with Ctrl+b then [. Navigate with arrow keys or Page Up/Down. Start selection with Space (or v in vi-mode), copy with Enter (or y in vi-mode). Paste with Ctrl+b then ]. For system clipboard integration, enable 'set -g set-clipboard on' or use plugins like tmux-yank. On macOS, you may need to install reattach-to-user-namespace.
Enter copy mode with Ctrl+b then [ to enable scrolling. Use Page Up/Page Down, arrow keys, or mouse wheel (if mouse mode is enabled). Press q or Escape to exit copy mode. Increase scrollback buffer with 'set -g history-limit 10000' in your config. You can also search within copy mode with / (forward) or ? (backward).
Configuration
Customizing your tmux environment
Your tmux configuration should be in ~/.tmux.conf (in your home directory). tmux automatically loads this file when starting. You can also specify a custom config with 'tmux -f /path/to/config'. The file is plain text with one command per line. Lines starting with # are comments.
Run 'tmux source-file ~/.tmux.conf' from within tmux, or add a keybinding for quick reloading: 'bind r source-file ~/.tmux.conf \; display "Config reloaded!"'. Then use Ctrl+b then r to reload. Some changes require killing and restarting tmux server for full effect.
Add 'set -g mouse on' to your ~/.tmux.conf. This enables mouse for pane selection, window switching, resizing panes by dragging borders, and scrolling. Reload config to apply. Note: this may interfere with terminal's native text selection - hold Shift while selecting to use terminal selection instead of tmux's.
Use TPM (Tmux Plugin Manager). Install: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm. Add to .tmux.conf: 'set -g @plugin 'tmux-plugins/tpm'' and 'run ~/.tmux/plugins/tpm/tpm'. Add plugins with 'set -g @plugin 'plugin-name''. Press Ctrl+b then I (capital i) to install, U to update. Popular plugins: tmux-sensible, tmux-resurrect, tmux-continuum.
Troubleshooting
Solutions to common problems and errors
Add 'set -g default-terminal "tmux-256color"' (or "screen-256color") to ~/.tmux.conf. For true color (24-bit), also add 'set -ag terminal-overrides ",*256col*:Tc"'. Make sure your terminal emulator supports the color mode. Reload config and restart tmux. If issues persist, check that TERM is set correctly outside tmux.
tmux waits to see if Escape is part of a key sequence. Add 'set -sg escape-time 0' (or a small value like 10) to eliminate or reduce this delay. This is especially important for Vim/Neovim users where Escape is frequently used. Reload your config after adding this setting.
Sessions end if you exit (type 'exit') instead of detaching (Ctrl+b d), or if the tmux server crashes/restarts (rare). If closing the terminal killed your session, you weren't detached. For persistence across reboots, use tmux-resurrect plugin. Check if session exists with 'tmux list-sessions'. Consider 'set -g destroy-unattached off' to keep sessions alive.
Common issues: 1) Forgot to press prefix key first (default Ctrl+b). 2) Changed prefix in config but still using old one. 3) Config has syntax errors - check with 'tmux source-file ~/.tmux.conf'. 4) Conflicting bindings from plugins or shell. 5) Terminal intercepting keys. Try 'tmux list-keys' to see all bindings.
This warning appears when running tmux inside an existing tmux session (nested sessions). This is rarely needed and causes confusion with key bindings (which session receives the command?). If intentional, use 'TMUX= tmux new' to bypass. Usually, you want to create a new window or pane in your existing session instead.
Advanced Usage
Power user features and techniques
Use tmux commands in shell scripts: 'tmux new-session -d -s work', 'tmux split-window -h', 'tmux send-keys "npm start" Enter'. Or use tmuxinator/tmuxp for YAML-based session configs. You can script complex layouts with 'tmux new-window', 'split-window', 'select-pane', and 'send-keys' commands. Scripts can create entire development environments in seconds.
Yes! Create a shared socket: 'tmux -S /tmp/shared new -s pair'. Other users attach: 'tmux -S /tmp/shared attach -t pair'. Set permissions: 'chmod 777 /tmp/shared' (be cautious with security). Great for pair programming. For read-only viewing, use 'tmux attach -t session -r'. Consider tools like tmate for easier sharing over internet.
Use tmux-resurrect plugin to save and restore sessions: Ctrl+b Ctrl+s to save, Ctrl+b Ctrl+r to restore. For automatic saving, add tmux-continuum which saves periodically and can auto-restore on tmux start. These plugins save window layouts, pane positions, and working directories. Running processes aren't saved by default but can be configured.
Hooks run commands on specific events. Examples: 'set-hook -g after-new-window 'run-shell "notify-send New Window"'' runs on new window creation. Common hooks: after-new-session, after-new-window, pane-focus-in, client-attached. List hooks with 'show-hooks'. Use for notifications, auto-layout, logging, or custom automation.
Integration
Using tmux with other tools and editors
Use vim-tmux-navigator plugin for seamless pane navigation with Ctrl+h/j/k/l across both vim splits and tmux panes. Add matching config to both .vimrc and .tmux.conf. Enable 'set -g focus-events on' for proper autoread. Set 'escape-time' to 0 for instant mode switching. Many developers use Vim in one pane with terminal tools in others.
Start tmux immediately after SSH connection: 'ssh user@server -t 'tmux attach || tmux new''. This attaches to existing session or creates new one. Your session persists if SSH drops - just reconnect and reattach. For better experience, use mosh instead of SSH for mobile connections. Consider ssh-agent forwarding if using git over SSH.
Yes, but they serve different purposes. You can run tmux in VS Code's integrated terminal. For remote development, use VS Code Remote-SSH to connect to a server where tmux runs your processes. Many developers use both: VS Code for editing, tmux for running servers, logs, and terminal tasks. VS Code's built-in terminal splitting may reduce need for tmux locally.
Usually unnecessary since containers are already isolated. Better approach: run tmux on your host, use container exec commands in panes. If needed inside container, add tmux to Dockerfile and allocate TTY with 'docker run -it'. For development, docker-compose with multiple services is often cleaner than container-internal tmux.
Performance
Optimizing tmux for speed and efficiency
tmux is very lightweight - typically uses less than 10MB RAM even with many sessions. CPU usage is negligible. Any perceived slowness is usually due to: escape-time delay (set to 0), slow shell prompts, or network latency over SSH. Modern terminals and tmux are highly optimized. Large scrollback buffers (history-limit) use more memory but minimal impact.
Key optimizations: 1) 'set -sg escape-time 0' - eliminates escape delay. 2) 'set -g history-limit 10000' - reasonable scrollback. 3) Minimal status bar - complex formats slow rendering. 4) Avoid heavy plugins - each adds overhead. 5) Use a fast terminal emulator (alacritty, kitty, wezterm). 6) For SSH, use mosh for better latency handling.
tmux can handle hundreds of sessions, windows, and panes - limited mainly by system memory. A typical setup with 10 sessions, 50 windows, and 100 panes uses minimal resources. The client-server architecture means all sessions share one server process. Practical limits depend on your workflow, not tmux capabilities.
Still Have Questions?
Can't find the answer you're looking for? Here are more resources:
This FAQ covers common questions about tmux installation, configuration, commands, troubleshooting, and advanced usage. Last updated: September 2026.