Every sysadmin knows the pain: you start a long migration over SSH, the connection drops, and the job dies with it. This tmux tutorial solves that problem for good. tmux is a terminal multiplexer — it keeps your shell sessions alive on the server, lets you split one terminal into several panes, and allows multiple people to watch the same session. In this tmux tutorial you will install tmux, master the essential key bindings, and adopt the workflows professionals use daily.
What Is tmux and Why Do Sysadmins Use It? – Tmux Tutorial
tmux creates sessions that live independently of your SSH connection. You can detach from a session, log out, fly home, reconnect tomorrow and reattach to everything exactly as you left it — running processes included. On top of persistence, tmux gives you:
- Split windows into panes for logs, editors and shells side by side
- Multiple windows inside one session, like browser tabs for terminals
- Session sharing, so a colleague can attach to the same screen while you troubleshoot together
- Scriptable layouts you can recreate on every server you manage
It complements simple backgrounding tools from our guide to the nohup command: nohup protects one command, while tmux protects and organizes your entire working environment.
Step 1: Install tmux – Tmux Tutorial
# Ubuntu / Debian
sudo apt update && sudo apt install -y tmux
# RHEL / AlmaLinux / Rocky
sudo dnf install -y tmux
Step 2: Your First tmux Session
Create a named session and detach from it:
tmux new -s work
# inside the session, press Ctrl+b then d to detach
tmux ls
tmux attach -t work
Nearly every tmux command starts with the prefix key, Ctrl+b, followed by a command key. Detach with Ctrl+b d, and your processes keep running. This alone is worth the whole tmux tutorial: start a long upgrade, detach, and it survives any network failure. If you manage servers over SSH regularly, combine tmux with the basics from our guide on how to SSH into a Linux server and you will never lose work again.

Step 3: Windows and Panes
Inside a session, the essential bindings are:
Ctrl+b c— create a new windowCtrl+b n/Ctrl+b p— next / previous windowCtrl+b 0..9— jump to a window by numberCtrl+b %— split the pane verticallyCtrl+b "— split the pane horizontallyCtrl+b arrow keys— move between panesCtrl+b z— zoom the current pane to full screen (toggle)Ctrl+b [— scroll/copy mode; move with arrows or PageUp, quit withq
A typical layout for server work: one window with three panes — a shell, a live journalctl -f, and htop — plus a second window for editing configuration files.
Step 4: Sessions for Projects
Give each server or project its own named session so you can jump straight back into context:
tmux new -s web01
tmux new -s db01
tmux attach -t db01
tmux kill-session -t web01
You can even build a session from a script, creating windows and panes automatically:
tmux new-session -d -s ops -n shell
tmux split-window -h -t ops
tmux send-keys -t ops:0.1 'htop' Enter
tmux attach -t ops
Step 5: Customize tmux with .tmux.conf
Create ~/.tmux.conf to make tmux friendlier. A minimal, popular starting point:
# Use Ctrl+a as prefix (easier to reach)
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Enable mouse support for pane switching and resizing
set -g mouse on
# Start window numbering at 1
set -g base-index 1
# Increase scrollback history
set -g history-limit 10000
Reload the configuration in a running session with tmux source-file ~/.tmux.conf. The tmux wiki documents every option and includes example configurations.
Troubleshooting
“sessions should be nested with care”: you started tmux inside tmux. Press Ctrl+b d to detach the inner one, or unset $TMUX in that shell if you really mean it.
Lost session after reboot: tmux sessions do not survive a server reboot by design. For scheduled or boot-time jobs, use systemd services and timers instead, and keep tmux for interactive work.
Strange colors or broken keys in Vim: set TERM=screen-256color — adding set -g default-terminal "screen-256color" to your config usually fixes it.
Sharing a tmux Session with a Teammate
One underrated tmux feature is pair troubleshooting. If a colleague needs to see exactly what you see, they can attach to the same session from their own SSH login: tmux attach -t work. Both of you view the same panes in real time, and either person can type. For safer sharing with someone who should only watch, create a read-only attachment by duplicating the session: tmux new-session -t work joins a grouped session; to prevent input from a viewer, have them set their client read-only with tmux attach -t work -r on newer tmux versions. This is dramatically safer than sharing your screen through a meeting tool, because the session keeps running even if the call ends.
Conclusion
That completes this tmux tutorial. With detachable sessions, panes and a small custom configuration, tmux turns fragile SSH connections into a stable, organized workspace. Spend one week forcing yourself to work inside tmux — after that, plain SSH will feel like working with one hand tied.