Operations 8 min read

Master Multi-Session Management with Tmux: Install, Commands, and Tips

Learn how to install Tmux on various Linux distributions, create and manage named sessions, split and navigate panes, synchronize commands across panes, and safely detach, attach, or kill sessions, with clear command examples and shortcuts for efficient terminal multiplexing.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Multi-Session Management with Tmux: Install, Commands, and Tips

Introduction

Tmux is a free, open‑source terminal multiplexer that lets you run multiple sessions and applications inside a single terminal window. It works on Linux, BSD variants, and macOS, and uses Ctrl+b as the default command prefix (Screen uses Ctrl+a).

Installation

Tmux is available in the official repositories of most Linux distributions:

Arch Linux: $ sudo pacman -S tmux Debian/Ubuntu/Linux Mint: $ sudo apt-get install tmux Fedora: $ sudo dnf install tmux RHEL/CentOS: $ sudo yum install tmux openSUSE: $ sudo zypper install tmux After installation you can start exploring Tmux commands.

Basic Session Management

To create a new session and attach to it: tmux Or create a session without attaching: tmux new When inside a session you’ll see a green status bar at the bottom.

Creating Tmux session
Creating Tmux session

Detach from the current session with Ctrl+b d. The terminal will display: [detached (from session 0)] List all sessions:

tmux ls
Tmux session list
Tmux session list

To create a named session (e.g., for a web server):

tmux new -s webserver
Named Tmux session
Named Tmux session

Attach to the last created session: tmux attach Or attach to a specific named session: tmux attach -t ostechnix Kill a specific session: tmux kill-session -t ostechnix Kill all sessions (use with caution):

tmux kill-server

Pane Management

Split the window into panes (Tmux calls them “panes”).

Horizontal split: Ctrl+b " Vertical split:

Ctrl+b %
Horizontal split
Horizontal split
Vertical split
Vertical split

Switch between panes with Ctrl+b and the arrow keys, or cycle with Ctrl+b o. Show pane numbers using Ctrl+b q. Synchronize input across all panes: :setw synchronize-panes Resize or zoom a pane to full screen with Ctrl+b z. Close a pane by typing exit or Ctrl+b x and confirming with y.

Close pane
Close pane

Automation Tip

When working over SSH, start a Tmux session automatically to keep long‑running processes alive if the network drops. Adding tmux attach || tmux new to your shell’s login script is a common approach.

Summary

You now have the essential Tmux commands for multi‑session management, pane manipulation, and session automation. For more options, consult the manual page with man tmux.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxCommand LineSession Managementtmuxterminal multiplexing
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.