Close Menu
DPC Virtual Tips
    Read More

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    September 11, 2026

    Creating Your First Ansible Playbook: A Practical Lab Guide

    September 10, 2026

    Linux Commands to Investigate High Disk Partition Usage

    September 9, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    Monday, September 14
    DPC Virtual Tips
    • Home
    • Linux & Automation
    • HPC & Slurm
    • VMware & Virtualization
    • About Us
    • Contact
    DPC Virtual Tips
    Home » How to Install, Configure, and Use tmux on Linux
    Linux & Automation

    How to Install, Configure, and Use tmux on Linux

    By Danilo ChiacchioAugust 16, 20268 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    install tmux on linux
    Share
    Facebook Twitter LinkedIn Pinterest Email

    tmux on Linux is one of the tools I rely on most when working on remote servers and managing multiple terminal tasks simultaneously. Instead of opening several terminal windows, I use tmux to organize sessions, split the screen into panes, and keep long-running processes active even after disconnecting from an SSH session.

    In day-to-day Linux administration, tmux makes it much easier to monitor logs, edit configuration files, execute maintenance tasks, and work with multiple remote systems from a single terminal window. Its lightweight design and wide availability across Linux distributions make it an essential utility for system administrators and developers alike.

    In this guide, I demonstrate how to install, configure, and use tmux on Linux with practical examples. You’ll learn how to create and manage sessions, organize windows and panes, customize the basic configuration, and take advantage of features that improve productivity when working from the command line.

    What Is tmux?

    tmux (Terminal Multiplexer) allows multiple terminal sessions to exist inside a single terminal window. Instead of opening several terminal applications, you can organize everything into sessions, windows, and panes.

    Some of its most useful features include:

    • Persistent terminal sessions;
    • Horizontal and vertical pane splitting;
    • Multiple windows inside one session;
    • Session sharing between users;
    • Easy navigation using keyboard shortcuts;
    • Low resource consumption.

    One of the biggest advantages is that processes continue running even if your SSH connection drops. This protects the process from an SSH disconnection, but not from a server reboot, a tmux server termination, or the underlying process itself failing.

    Install tmux on Linux

    Most Linux distributions include tmux in their official repositories:

    Ubuntu and Debian

    sudo apt update
    sudo apt install tmux

    Fedora

    sudo dnf install tmux

    RHEL, Rocky Linux, AlmaLinux, and CentOS Stream

    sudo dnf install tmux

    For older CentOS versions:

    sudo yum install tmux

    Arch Linux

    sudo pacman -S tmux

    After installation, verify the installed version:

    tmux -V

    Example output:

    tmux 3.5a

    Starting Your First Session

    Launch tmux by running:

    tmux

    A new session starts immediately. You’ll notice a status bar at the bottom of the terminal showing information about the current session.

    To create a named session:

    tmux new -s development

    Naming sessions makes them easier to identify when multiple sessions are active.

    Understanding tmux Concepts

    tmux is organized into three main components. Let’s talk about them:

    Sessions

    A session is the top-level container. You can have separate sessions for different projects.

    Examples:

    tmux new -s webserver
    tmux new -s database
    tmux new -s monitoring

    Windows

    Each session contains one or more windows. Think of windows as tabs in a browser.

    Create a new window:

    Ctrl+b c

    Switch between windows:

    Ctrl+b n

    Go to the previous window:

    Ctrl+b p

    List all windows:

    Ctrl+b w

    Panes

    Windows can be divided or split into multiple panes.

    Split into left and right panes:

    Ctrl+b %

    Split into top and bottom panes:

    Ctrl+b "

    Move between panes:

    Ctrl+b Arrow Key

    Resize a pane:

    Ctrl+b Ctrl+Arrow Key

    This layout allows you to monitor logs, edit files, and execute commands simultaneously without leaving the current session.

    Detaching and Reattaching Sessions

    One of tmux’s strongest features is session persistence.

    To detach from a running session:

    Ctrl+b d

    The session continues running in the background.

    List available sessions:

    tmux ls

    Example:

    development: 2 windows
    monitoring: 1 window

    Reconnect to a session:

    tmux attach -t development

    Or simply:

    tmux a

    if only one session exists.

    Closing Sessions

    To terminate the current session:

    exit

    Repeat until every pane is closed.

    Alternatively:

    tmux kill-session -t development

    To terminate all running sessions:

    tmux kill-server

    ⚠️ Use this carefully because it closes every tmux session currently running.

    Basic Configuration

    tmux reads its configuration from:

    ~/.tmux.conf

    If the file does not exist, create it:

    touch ~/.tmux.conf

    Here is a practical starting configuration:

    set -g mouse on
    
    setw -g mode-keys vi
    
    set -g history-limit 10000
    
    set -g base-index 1
    
    setw -g pane-base-index 1
    
    bind r source-file ~/.tmux.conf \; display-message "Configuration reloaded"

    This configuration provides several improvements:

    • Enables mouse support (you can use your mouse inside the tmux session);
    • Uses Vim-style navigation in copy mode;
    • Increases scrollback history;
    • Starts numbering both windows and panes at 1 instead of 0;
    • Allows configuration reloading without restarting tmux.

    Reload the configuration after saving:

    Ctrl+b r

    or

    tmux source-file ~/.tmux.conf

    Useful Keyboard Shortcuts

    Most tmux commands begin with the default prefix:

    Ctrl+b

    Some shortcuts worth memorizing (or you can use this table as your reference):

    ShortcutAction
    Ctrl+b cCreate new window
    Ctrl+b nNext window
    Ctrl+b pPrevious window
    Ctrl+b %Split vertically
    Ctrl+b “Split horizontally
    Ctrl+b ArrowMove between panes
    Ctrl+b xClose current pane
    Ctrl+b dDetach session
    Ctrl+b zToggle pane zoom
    Ctrl+b ,Rename window
    Ctrl+b $Rename session

    Learning just these shortcuts covers most day-to-day workflows.

    Running Long Processes Safely

    One common use case is running commands that take several hours.

    For example:

    rsync -av /backup remote:/storage

    or

    tar -czf archive.tar.gz large_directory/

    Important: tmux protects a process from terminal or SSH disconnection. It does not provide application-level recovery, checkpointing, or persistence across a server reboot.

    If your SSH connection drops, these commands continue running inside tmux.

    After reconnecting:

    ssh server

    Then:

    tmux attach

    Your session returns exactly where you left it.

    Working Efficiently with Multiple Panes

    A practical layout for system administration might look like this, for example:

    • Pane 1: SSH session
    • Pane 2: htop
    • Pane 3: tail -f /var/log/syslog
    • Pane 4: Text editor

    This arrangement allows you to monitor system activity while making configuration changes without switching applications.

    Copy Mode

    Each tmux pane maintains its own history buffer, which can be inspected using copy mode.

    Enter copy mode:

    Ctrl+b [

    Navigation becomes similar to Vim when mode-keys vi is enabled.

    Useful keys:

    • k — Move up
    • j — Move down
    • / — Search
    • Space — Start selection
    • Enter — Copy selection
    • q — Exit copy mode

    This is especially useful when reviewing lengthy command output.

    Common Troubleshooting

    “command not found”

    tmux is probably not installed.

    Verify:

    which tmux

    If nothing is returned, install it using your distribution’s package manager.

    Cannot reconnect to a session

    Check existing sessions:

    tmux ls
    

    If no sessions appear, the previous session was likely closed.

    Mouse does not work

    Ensure your configuration includes:

    set -g mouse on

    Reload the configuration afterward.

    Cannot Copy Text from tmux to the System Clipboard

    tmux maintains its own paste buffers, which are separate from the operating system clipboard.

    When you copy text using tmux copy mode:

    Ctrl+b [

    the selected text is normally stored in a tmux paste buffer.

    To inspect the current clipboard behavior:

    tmux show -s set-clipboard

    Modern tmux versions commonly return:

    set-clipboard external

    tmux can synchronize copied text with the outside terminal using the OSC 52 terminal escape sequence.

    For this to work, the terminal must support clipboard integration and tmux must detect the appropriate terminal capability.

    You can check it with:

    tmux info | grep 'Ms:'

    If the terminal supports clipboard integration correctly, tmux can copy text to the clipboard of the terminal outside the session — including in some SSH workflows.

    This does not require installing xclip on every remote server.

    Another method is to pipe copied text to an external clipboard utility such as xclip, xsel, wl-copy, or pbcopy, depending on the graphical environment and operating system. That is a separate clipboard integration method and normally requires access to the relevant graphical clipboard.

    For remote, headless Linux servers, I generally prefer either:

    • OSC 52 when supported by the local terminal; or
    • the local terminal emulator’s own text-selection and copy features.

    For detailed terminal-specific configuration, consult the official tmux Clipboard documentation.

    Where tmux Fits in Daily Linux Administration

    tmux becomes particularly valuable when Linux administration involves remote SSH sessions, long-running commands, log monitoring, and several terminal workflows at the same time.

    Sessions protect running processes from ordinary terminal disconnections, while windows and panes provide a structured way to organize multiple tasks without opening additional SSH connections.

    Starting with a small set of shortcuts and a simple ~/.tmux.conf is usually enough. More advanced configuration can be added gradually as tmux becomes part of your normal administration workflow.

    External References

    • tmux Manual Page Complete command reference for tmux sessions, clients, windows, panes, key bindings, options, configuration files, and command-line operations.
    • tmux Getting Started Guide Official tmux project guide explaining the server and client model, sessions, windows, panes, attaching, detaching, configuration, and common interactive workflows.
    • Installing tmux Official installation reference covering Linux distribution packages, dependencies, source builds, and installation methods for platforms including Debian, Ubuntu, Fedora, RHEL, CentOS, Arch Linux, and macOS.
    • tmux Clipboard Integration Official documentation for tmux copy buffers, OSC 52, set-clipboard, terminal capabilities, SSH clipboard workflows, and external clipboard utilities.
    • tmux Advanced Use Advanced reference covering tmux sockets, multiple servers, targets, scripting, custom options, session management, terminal behavior, and more complex configuration.
    • tmux Official Source Repository Official tmux project repository containing source code, release information, documentation, development history, and links to current project resources.
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleSlurm Node Is DRAINED: How to Find the Exact Reason
    Next Article Recover ESXi Management Network When the Host Is Disconnected from a vDS
    Danilo Chiacchio
    • LinkedIn

    Infrastructure Engineer with hands-on experience in virtualization, Linux, Windows Server, and enterprise infrastructure troubleshooting. I work with real-world infrastructure environments and technical labs, focusing on diagnosing problems, understanding root causes, and documenting practical solutions. DPC Virtual Tips was created to share hands-on troubleshooting guides, lab experiences, technical procedures, and lessons learned while working with technologies such as VMware, Linux, HPC/Slurm, networking, storage, and infrastructure automation with Python.

    Related Posts

    Creating Your First Ansible Playbook: A Practical Lab Guide

    September 10, 2026

    Linux Commands to Investigate High Disk Partition Usage

    September 9, 2026

    How to Investigate TCP Retransmissions on Linux

    September 3, 2026

    Comments are closed.

    Search
    Categories
    • HPC & Slurm (11)
    • Linux & Automation (12)
    • VMware & Virtualization (16)
    Read More
    VMware & Virtualization

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    By Danilo ChiacchioSeptember 11, 202610 Mins Read
    Linux & Automation

    Creating Your First Ansible Playbook: A Practical Lab Guide

    By Danilo ChiacchioSeptember 10, 202610 Mins Read
    Linux & Automation

    Linux Commands to Investigate High Disk Partition Usage

    By Danilo ChiacchioSeptember 9, 20267 Mins Read
    HPC & Slurm

    How to Investigate Jobs Stuck in COMPLETING State on Slurm

    By Danilo ChiacchioSeptember 8, 202612 Mins Read
    VMware & Virtualization

    Restoring vCenter Server from a File-Based Backup: Practical Lab Walkthrough

    By Danilo ChiacchioSeptember 7, 20269 Mins Read
    Latest Posts

    Configure vCenter File-Based Backups to NFS: Practical Lab Guide

    September 11, 2026

    Creating Your First Ansible Playbook: A Practical Lab Guide

    September 10, 2026

    Linux Commands to Investigate High Disk Partition Usage

    September 9, 2026
    Images from Gallery
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    shell scripting
    vSAN Trace Files
    Categories
    • HPC & Slurm
    • Linux & Automation
    • VMware & Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to improve your browsing experience, analyze website traffic, and display relevant advertising. You can accept all cookies or manage your preferences at any time.