Skip to main content

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.

Core Idea

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
note

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 shell
  • monitoring — htop, logs, tail -f
  • deploy — deployment script, rollback shell

3. Windows

A window is like a tab in a browser. It fills the whole terminal area.

Key BindingAction
Ctrl+b cCreate new window
Ctrl+b ,Rename current window
Ctrl+b nNext window
Ctrl+b pPrevious window
Ctrl+b 0-9Switch to window by number
Ctrl+b wInteractive 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 BindingAction
Ctrl+b %Split pane vertically (side by side)
Ctrl+b "Split pane horizontally (top/bottom)
Ctrl+b arrowMove focus between panes
Ctrl+b xKill current pane
Ctrl+b zZoom/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
warning

You must press and release Ctrl+b before pressing the command key. Do not hold all three at once.

Practice the most important shortcuts:

ShortcutAction
Ctrl+b dDetach (keeps session alive)
Ctrl+b cNew 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

ConceptWhat it isManaged with
ServerBackground daemonAuto-managed
SessionNamed workspacetmux new, tmux ls, tmux attach
WindowTab inside sessionCtrl+b c, Ctrl+b n/p
PaneSplit inside windowCtrl+b %, Ctrl+b "
PrefixCommand initiatorCtrl+b (default)

What's Next