Terminal Multiplexer — Sessions, Windows, and Panes for SysAdmins
tmux is a terminal multiplexer. It lets you run multiple terminal sessions inside a single SSH connection, split your screen into panes, and — crucially — detach from a session and reattach later with everything still running exactly as you left it.
For a SysAdmin, that last part is the killer feature. You SSH into a server, start a long job, detach, lose your connection, reconnect hours later, and your job is still running. Your session survived. tmux is session persistence at the terminal level.
It is also a productivity tool: split panes let you watch logs in one pane while running
commands in another, all inside a single SSH window. And it pairs naturally with AI tools —
run sgpt in one pane, your shell in another, your log tail in a third.
sudo dnf install tmux
sudo apt install tmux
tmux -V
# tmux 3.3a (or similar)
Most distro packages are fine. If you need tmux 3.x features (better mouse support, extended keys) on an older RHEL system, you can build from source, but for most SysAdmin use the repo version is sufficient.
tmux has three levels: sessions, windows, and panes. A session contains windows. A window contains panes. You can have as many of each as you like.
Every tmux command starts with the prefix key, which is
Ctrl+b by default. Press prefix, release it, then press the
command key. You will see this written as C-b in tmux documentation.
~/.tmux.conf. Use whatever your fingers know. The default C-b
works fine if you are starting fresh.
| Action | Command |
|---|---|
| Start a new named session | tmux new -s mysession |
| List sessions | tmux ls |
| Attach to a session | tmux attach -t mysession |
| Detach from session | C-b d |
| Kill a session | tmux kill-session -t mysession |
| Split pane horizontal | C-b % |
| Split pane vertical | C-b " |
| Move between panes | C-b arrow keys |
| New window | C-b c |
| Next window | C-b n |
| Previous window | C-b p |
| Rename window | C-b , |
| Show key bindings | C-b ? |
| Enter copy mode (scroll) | C-b [ |
This is the workflow that matters most:
# On your workstation — SSH in and start a named session
ssh admin@prod-server-01
tmux new -s maintenance
# Do your work inside tmux
# ...
# Something comes up, or your connection drops — detach cleanly
# C-b d
# Later — reconnect and pick up exactly where you left off
ssh admin@prod-server-01
tmux attach -t maintenance
tmux new -s descriptive-name makes
tmux ls readable when you have multiple sessions running on a server.
The original killer use case. Package upgrades, database dumps, disk checks, migrations — anything that takes minutes to hours and cannot be interrupted:
tmux new -s db-backup
pg_dump -Fc mydb > /backup/mydb-$(date +%Y%m%d).dump
# C-b d (detach — job keeps running)
# Hours later:
tmux attach -t db-backup
# Session is still there, job completed, output is waiting
Split your window into panes and watch multiple streams simultaneously:
tmux new -s monitor
# Split horizontal: C-b %
# Split the right pane vertical: C-b "
# Pane 1: system logs
tail -f /var/log/messages
# Pane 2: service status
watch -n 5 systemctl status httpd mariadb
# Pane 3: active connections
watch -n 2 ss -tnp
Keep separate tmux sessions for separate contexts so you are never hunting for the right terminal window:
tmux new -s prod-web # production web servers
tmux new -s prod-db # database work
tmux new -s dev-testing # development environment
tmux new -s log-watch # persistent log monitoring
tmux ls
# prod-web: 2 windows (created Thu Mar 28 09:14:22 2026)
# prod-db: 1 window (created Thu Mar 28 09:20:01 2026)
# dev-testing: 3 windows (created Thu Mar 28 10:05:44 2026)
# log-watch: 1 window (created Thu Mar 28 07:00:12 2026)
Run updates across multiple servers in parallel without juggling terminal windows:
# Open one tmux session, create a window per server
tmux new -s patch-night
# Window 0: server01
ssh admin@server01
sudo dnf update -y
# C-b c (new window)
# Window 1: server02
ssh admin@server02
sudo dnf update -y
# C-b c (new window)
# Window 2: server03
ssh admin@server03
sudo dnf update -y
# Toggle between them with C-b n / C-b p
# Or jump directly: C-b 0, C-b 1, C-b 2
Two admins can attach to the same tmux session and see each other's terminal in real time. Useful for training a junior admin or pair troubleshooting a production issue:
# Admin 1 creates session
tmux new -s collab
# Admin 2 attaches to same session (both see the same screen)
tmux attach -t collab
tmate (tmux-compatible
session sharing over the internet).
Start a dedicated session just for log tailing that you attach to whenever you need it:
tmux new -s logs
# Window 0: system
journalctl -f
# C-b c
# Window 1: httpd
tail -f /var/log/httpd/error_log
# C-b c
# Window 2: auth
tail -f /var/log/secure
# Detach — session lives on, logs keep scrolling
# C-b d
tmux is the natural container for AI-assisted SysAdmin workflows. The same session persistence and pane splitting that makes it useful for long jobs makes it ideal for running AI tools alongside your normal shell work.
Keep sgpt or an AI session running in a pane while you work in another:
tmux new -s ai-work
# Left pane: your shell
# C-b % (split)
# Right pane: sgpt chat mode
sgpt --chat mywork "You are helping me troubleshoot a RHEL 9 httpd issue"
# Ask questions, get answers, switch back to left pane to apply them
# C-b <left arrow>
# Pane 1: live log tail
tail -f /var/log/httpd/error_log | tee /tmp/current-errors.log
# Pane 2: on-demand AI analysis
cat /tmp/current-errors.log | sgpt "Summarize the recurring errors and suggest root causes"
aider sessions can run for a long time as you work through a codebase.
tmux gives you session persistence so a disconnect does not abort the work:
tmux new -s aider-work
cd /opt/myproject
aider --model gpt-4o myscript.sh
# Work through changes with aider
# Detach — aider session is preserved
# C-b d
# Reconnect later:
tmux attach -t aider-work
Run ollama serve in a tmux session so it persists as a background service
even if your shell session ends:
tmux new -s ollama-server
ollama serve
# C-b d (detach — ollama keeps running)
# From any other pane or session:
sgpt --api-host http://localhost:11434 "explain this error"
# Pane 1: run a recurring fabric analysis
watch -n 300 'journalctl --since "5 minutes ago" | fabric -p analyze_logs'
# Pane 2: shell for responding to findings
tmux is highly configurable. A minimal ~/.tmux.conf goes a long way.
Here is a practical starting point for SysAdmins:
# ~/.tmux.conf — practical SysAdmin baseline
# Remap prefix to Ctrl+a (screen-style) — optional, remove if you prefer C-b
# unbind C-b
# set-option -g prefix C-a
# bind-key C-a send-prefix
# Increase scrollback buffer (default is 2000 — too small for log work)
set-option -g history-limit 50000
# Enable mouse support (click to select panes, drag to resize)
set -g mouse on
# Start window and pane numbering at 1 (easier keyboard access)
set -g base-index 1
setw -g pane-base-index 1
# Re-number windows when one is closed
set -g renumber-windows on
# Status bar — show session name, window list, date/time
set -g status-right '%Y-%m-%d %H:%M '
set -g status-bg colour235
set -g status-fg colour136
# Reload config without restarting tmux
bind r source-file ~/.tmux.conf \; display "Config reloaded"
# Intuitive pane splitting (| and - instead of % and ")
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# Pane navigation with Alt+arrow (no prefix needed)
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
~/.tmux.conf, reload it with
C-b r (if you added the reload bind above)
or from the shell with tmux source-file ~/.tmux.conf.
| Option | What it does |
|---|---|
history-limit 50000 |
Scrollback buffer size — increase for log-heavy work |
mouse on |
Click panes to focus, drag borders to resize |
base-index 1 |
Windows numbered from 1 — easier to reach on keyboard |
renumber-windows on |
Keeps window numbers contiguous after closing one |
status-right |
Right side of status bar — add date, time, hostname |
tmux belongs in your baseline install on every server you manage. It is not an AI tool — it is the infrastructure that makes your AI tools (and everything else you do over SSH) more reliable. The learning curve is real but short. The payoff is permanent.
If you manage remote Linux servers and you are not using tmux, you are working harder than you need to.
ollama serve running in a dedicated tmux session