Linux

Master tmux: A Complete Guide to the Terminal Multiplexer Basics

This guide will help you master tmux—a powerful tool for managing terminal sessions. You'll learn to run, switch, and split windows, boosting your productivity in Linux.

Updated at February 17, 2026
15-30 min
Easy
FixPedia Team
Применимо к:Ubuntu 22.04+Debian 11+Fedora 36+tmux 3.0+

Introduction / Why This Is Useful

Tmux (terminal multiplexer) is a terminal multiplexer that allows you to manage multiple sessions, windows, and panes within a single terminal. It is especially useful for server administration via SSH: you can start long-running processes, disconnect, and later return to continue work from the same point. After mastering tmux, you can significantly boost your efficiency on the Linux command line by organizing your workspace for your tasks.

Requirements / Preparation

Before you begin, ensure that:

  • You have access to a Linux terminal (Ubuntu, Debian, Fedora, etc.).
  • You have privileges to install packages (usually via sudo).
  • You have basic command-line familiarity (navigation, executing commands).
  • Tmux version 3.0 or newer (most modern distributions have the latest version).

Step-by-Step Guide

Step 1: Install tmux

Install tmux using your distribution's package manager. For most Debian/Ubuntu-based distributions:

sudo apt update
sudo apt install tmux

For Fedora/RHEL:

sudo dnf install tmux

For Arch Linux:

sudo pacman -S tmux

After installation, check the version:

tmux -V
# Example output: tmux 3.3a

Step 2: Create a New Session

Start tmux by creating a session with a descriptive name:

tmux new -s work

You will see a status line at the bottom of the screen with the session name (work), window number, and time. Now all commands inside tmux are executed with the prefix Ctrl+b (by default), followed by another key.

Step 3: Basic Window Operations

Within a session, you work with windows—similar to tabs.

  • Create a new window: Ctrl+b c
  • Switch between windows: Ctrl+b n (next) or Ctrl+b p (previous). You can also use Ctrl+b 0..9 to jump by number.
  • Rename the current window: Ctrl+b , (type a name, press Enter).
  • Close a window: exit the shell (e.g., exit) or press Ctrl+b & (confirm with y).

Step 4: Splitting Panes

Tmux allows you to split a window into multiple panes for simultaneous viewing.

  • Split vertically (left/right): Ctrl+b %
  • Split horizontally (top/bottom): Ctrl+b "
  • Switch between panes: Ctrl+b arrow (in the direction of the pane).
  • Close a pane: exit the shell in it or press Ctrl+b x (confirm with y).

Step 5: Detach and Reattach

One of tmux's key features is detaching without terminating processes.

  • Detach from a session: Ctrl+b d
  • Reattach to a session: tmux attach -t work
  • Attach to a different session: tmux attach -t other_name

You can also create a new session in another terminal and work in parallel.

Step 6: Manage Sessions from Outside

When outside tmux, it's useful to manage sessions via the CLI.

  • List active sessions: tmux ls
  • Rename a session: tmux rename-session -t old_name new_name
  • Kill a session: tmux kill-session -t work
  • Create a session and immediately run a command: tmux new -d -s backup 'tar -czf /backup.tar.gz /important_folder' (the session will run in the background).

Verification

Ensure tmux is working correctly:

  1. Create a session, open several windows and panes.
  2. Detach (Ctrl+b d), then open another terminal and run tmux attach -t <session_name>—you should return to the same state.
  3. Start a long-running command (e.g., ping 8.8.8.8), detach, reconnect—the ping process should continue.
  4. Verify that windows and panes are preserved.

Potential Issues

⚠️ Prefix Conflict with Other Software
If Ctrl+b is already used (e.g., in Vim), change the prefix. Add set -g prefix C-a to ~/.tmux.conf (replaces with Ctrl+a). Restart tmux.

⚠️ Cannot Copy Text with Mouse
By default, tmux captures the mouse. To copy via the system clipboard, enable mouse support: add set -g mouse on to ~/.tmux.conf. Reload the config: Ctrl+b : source-file ~/.tmux.conf.

⚠️ Session Does Not Persist After Reboot
Tmux stores sessions only in memory. For auto-saving, use plugins (e.g., tmux-resurrect). Install via a plugin manager (TPM) and add it to .tmux.conf.

⚠️ "no server running" Error on Attach
The session has already ended or was killed. Check the list: tmux ls. If no sessions exist, create a new one.

F.A.Q.

How does tmux differ from screen?
How to copy text from tmux?
Are processes preserved when detaching from a session?
How to change the default key binding?

Hints

Install tmux
Create a new session
Manage windows
Split panes
Detach and attach
View and manage sessions
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community