Skip to main content

Tmux Documentation

Tmux is a terminal multiplexer that lets you run multiple terminal sessions inside a single window, detach from sessions, and reattach later — even after SSH disconnects.

Who This Track Is For
  • Operators managing remote servers over SSH who need persistent sessions
  • Developers running long-running processes, logs, and editors side by side
  • DevOps engineers automating multi-pane terminal workflows and monitoring
What You Will Build
  • A reliable persistent session workflow surviving SSH drops
  • A custom Tmux configuration with intuitive key bindings
  • Scripted multi-pane layouts for common server management tasks
  • Automated session templates for application monitoring
How To Use This Track
  • Follow the modules in order (1 to 11). Each lesson includes real commands and exercises.
  • Start with a non-production server or a local VM to practice safely.
  • Copy/adapt the config examples to your own .tmux.conf as you progress.

Learning Path

ModuleFocusLessons
1. IntroductionFundamentals and mental model3
2. SessionsCreate, attach, detach, kill3
3. Windows and PanesLayout and splitting3
4. Navigation and ShortcutsKey bindings and navigation3
5. Configuration.tmux.conf and customization3
6. Copy ModeScrollback, search, and copy/paste2
7. Scripting and AutomationScripted layouts and automation3
8. PluginsPlugin manager and ecosystem2
9. Real-World WorkflowsDevOps and server admin patterns3
10. TroubleshootingRoot-cause debugging2
11. CheatsheetFast operational reference3

Core Architecture

How Tmux Works

flowchart LR
CLIENT[Terminal / SSH] -->|attach| SERVER[Tmux Server]
SERVER --> SESSION1[Session: work]
SERVER --> SESSION2[Session: logs]
SESSION1 --> WIN1[Window 1: editor]
SESSION1 --> WIN2[Window 2: shell]
WIN1 --> PANE1[Pane: vim]
WIN1 --> PANE2[Pane: terminal]

Detach and Reattach (SSH Safety)

sequenceDiagram
participant DEV as Developer
participant SSH as SSH Session
participant TMUX as Tmux Server
DEV->>SSH: Connect to server
SSH->>TMUX: tmux new -s work
TMUX-->>DEV: Session running
DEV->>TMUX: prefix + d (detach)
SSH-->>DEV: SSH drops / disconnects
DEV->>SSH: Reconnect
SSH->>TMUX: tmux attach -t work
TMUX-->>DEV: Session restored — nothing lost
warning

Without tmux (or screen), any process running in your SSH session is killed when the connection drops.

Quick Start

first-tmux-session.sh
# 1) Install tmux
sudo apt install -y tmux # Debian/Ubuntu
sudo dnf install -y tmux # RHEL/Fedora

# 2) Start a named session
tmux new-session -s work

# 3) Do your work...

# 4) Detach safely (keeps everything running)
# Press: Ctrl+b, then d

# 5) Reattach when you come back
tmux attach -t work
note

The default Tmux prefix key is Ctrl+b. Every tmux command starts by pressing this prefix, then another key.

Tmux vs Alternatives

ToolUse CaseKey Advantage
tmuxPersistent sessions, multi-paneScriptable, widely available
screenLegacy persistent sessionsSimpler, older
zellijModern terminal workspaceTUI, built-in plugins
SSH aloneSimple one-time tasksNo setup needed

Prerequisites

  • Linux shell basics (ls, cd, paths)
  • SSH access to a server (or local terminal for practice)
  • Basic understanding of processes and shells

Success Criteria

By the end of this track, you can:

  • Start persistent sessions that survive SSH disconnects
  • Split your terminal into multiple panes for simultaneous monitoring
  • Write a script that launches a complete multi-pane layout automatically
  • Customize Tmux with a .tmux.conf that fits your workflow

Next Step

Start with What is Tmux.