Close Menu
DPC Virtual Tips
    Read More

    Essential Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    Essential Slurm Administration Commands Every HPC Administrator Should Know

    July 15, 2026

    How to Install, Configure, and Use tmux on Linux

    July 14, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Tuesday, July 28
    DPC Virtual Tips
    • Home
    • Operating Systems
    • CLI
    • PowerFlex
    • HPC
    • Certificates
    • Virtualization
    • About Us
    • Contact
    DPC Virtual Tips
    Home » How to Install, Configure, and Use tmux on Linux
    Operating Systems

    How to Install, Configure, and Use tmux on Linux

    DaniloBy DaniloJuly 14, 2026Updated:July 28, 2026No Comments6 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    linux tux
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Working in a Linux terminal often means managing multiple tasks at the same time. You might be monitoring logs, editing configuration files, running long processes, or connecting to several remote servers. Opening multiple terminal windows is one option, but it quickly becomes difficult to manage.

    This is where tmux becomes useful. tmux is a terminal multiplexer that allows you to create multiple terminal sessions, split your screen into panes, and keep applications running even after disconnecting from an SSH session. It is lightweight, reliable, and available in virtually every Linux distribution.

    This guide covers the installation, initial configuration, and everyday usage of tmux with practical examples that you can immediately apply.

    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.

    Installing tmux

    Most Linux distributions include tmux in their official repositories:

    Ubuntu and Debian

    sudo apt update
    sudo apt install tmux
    

    Fedora

    sudo dnf install tmux
    

    CentOS 8, Rocky Linux, AlmaLinux

    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/splited into multiple panes.

    Split vertically:

    Ctrl+b %
    

    Split horizontally:

    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 windows 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/
    

    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

    tmux includes its own scrollback buffer.

    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

    A common source of confusion is selecting text inside tmux and discovering that it cannot be pasted into applications such as Notepad, VS Code, or another terminal window.

    This usually happens because tmux keeps its own copy buffer, which is separate from your operating system’s clipboard.

    If you simply need to copy text to another pane or window inside tmux, use copy mode:

    Ctrl+b [
    

    Select the text and press Enter to copy it into tmux’s internal buffer.

    To integrate tmux with the system clipboard, install a clipboard utility.

    On Debian and Ubuntu:

    sudo apt install xclip
    

    or

    sudo apt install xsel
    

    On Fedora:

    sudo dnf install xclip
    

    Then add the following line to your ~/.tmux.conf:

    set -s set-clipboard on
    

    Reload the configuration:

    tmux source-file ~/.tmux.conf
    

    Keep in mind that clipboard integration only works when a graphical clipboard is available. If you’re connected to a headless Linux server over SSH, tmux cannot access the clipboard on your local computer. In that case, the simplest solution is often to use your terminal emulator’s own text selection, which usually copies directly to the local clipboard.

    Final Thoughts

    tmux is one of the most valuable command-line tools available for Linux users, especially system administrators, developers, and anyone who regularly works over SSH. Once you become comfortable with sessions, windows, and panes, it significantly reduces the need to juggle multiple terminal windows while making long-running tasks much safer.

    Start with the basic commands covered in this guide, create a simple ~/.tmux.conf, and gradually incorporate more shortcuts into your daily workflow. After a few days of regular use, managing terminal sessions without tmux will likely feel far less efficient.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Danilo

    Infrastructure Engineer with experience in Virtualization, Linux, Windows Server and learning automation using Python. DPC Virtual Tips was created to share practical tutorials, lab experiences and troubleshooting guides focused on enterprise infrastructure technologies.

    Related Posts

    Essential Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    Installing Rocky Linux

    April 27, 2026

    Creating a Simple Python Project Using a Virtual Environment

    January 12, 2026
    Leave A Reply Cancel Reply

    Latest Posts

    Essential Linux Commands to Investigate High Disk Partition Usage

    July 20, 2026

    Essential Slurm Administration Commands Every HPC Administrator Should Know

    July 15, 2026

    How to Install, Configure, and Use tmux on Linux

    July 14, 2026
    Images from Gallery
    linux tux
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    Categories
    • Certificates
    • CLI
    • HPC
    • Operating Systems
    • PowerFlex
    • Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

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

    We use cookies to ensure your best experience on our website. If you continue using our website, we'll assume you agree to our cookie policy