Tmux Key Concepts
Before you can use tmux fluently, you need to internalize five core concepts: the server, sessions, windows, panes, and the prefix key.
Tmux organizes terminal real estate in a strict hierarchy: Server → Sessions → Windows → Panes.
The Five Core Concepts
1. The Tmux Server
Tmux runs as a background daemon the moment you start your first session. It persists independently of any terminal.
# you can see it as a process
pgrep -la tmux
The server starts automatically on first use. You do not need to manage it manually.
2. Sessions
A session is a named workspace. It groups windows together.
tmux new -s work # create session named "work"
tmux new -s monitoring # another session
tmux ls # list all sessions
tmux switch -t monitoring # switch between sessions
When to use multiple sessions:
work— editor, development shellmonitoring— htop, logs, tail -fdeploy— deployment script, rollback shell
3. Windows
A window is like a tab in a browser. It fills the whole terminal area.
| Key Binding | Action |
|---|---|
Ctrl+b c | Create new window |
Ctrl+b , | Rename current window |
Ctrl+b n | Next window |
Ctrl+b p | Previous window |
Ctrl+b 0-9 | Switch to window by number |
Ctrl+b w | Interactive window list |
# from shell (outside tmux)
tmux new-window -t work:2 -n "logs"
4. Panes
A pane is a split section inside a window. You can have multiple terminals visible simultaneously.
flowchart LR
WIN[Window]
WIN --> PANE1[Pane: vim]
WIN --> PANE2[Pane: terminal]
PANE2 --> PANE3[Pane: logs]
| Key Binding | Action |
|---|---|
Ctrl+b % | Split pane vertically (side by side) |
Ctrl+b " | Split pane horizontally (top/bottom) |
Ctrl+b arrow | Move focus between panes |
Ctrl+b x | Kill current pane |
Ctrl+b z | Zoom/unzoom current pane (fullscreen toggle) |
5. The Prefix Key
Every tmux shortcut starts with the prefix key (Ctrl+b by default), followed by a command key.
Ctrl+b → release → command key
You must press and release Ctrl+b before pressing the command key. Do not hold all three at once.
Practice the most important shortcuts:
| Shortcut | Action |
|---|---|
Ctrl+b d | Detach (keeps session alive) |
Ctrl+b c | New window |
Ctrl+b % | Vertical split |
Ctrl+b " | Horizontal split |
Ctrl+b [ | Enter copy/scroll mode |
Ctrl+b : | Open tmux command prompt |
Ctrl+b ? | Show all key bindings |
Command Mode
Pressing Ctrl+b : opens the tmux command prompt at the bottom of your screen. You can type any tmux command here:
# at the Ctrl+b : prompt:
new-window -n "logs"
split-window -h
kill-pane
This is equivalent to running tmux <command> from your shell.
The Config File
Tmux loads its configuration from ~/.tmux.conf at startup.
# check if you have one
cat ~/.tmux.conf 2>/dev/null || echo "no config yet"
# reload config without restarting
tmux source-file ~/.tmux.conf
# or with Ctrl+b :
# source-file ~/.tmux.conf
Concept Map at a Glance
flowchart TD
S[Server: tmux daemon]
S --> SES1[Session: work]
S --> SES2[Session: monitoring]
SES1 --> W1[Window 0: editor]
SES1 --> W2[Window 1: git]
W1 --> P1[Left Pane: vim]
W1 --> P2[Right Pane: shell]
SES2 --> W3[Window 0: htop]
W3 --> P3[Top: htop]
W3 --> P4[Bottom: tail -f app.log]
Quick Reference Summary
| Concept | What it is | Managed with |
|---|---|---|
| Server | Background daemon | Auto-managed |
| Session | Named workspace | tmux new, tmux ls, tmux attach |
| Window | Tab inside session | Ctrl+b c, Ctrl+b n/p |
| Pane | Split inside window | Ctrl+b %, Ctrl+b " |
| Prefix | Command initiator | Ctrl+b (default) |