https://www.youtube.com/watch?v=BjGMQOhujiI
Your terminal closes, your work dies. SSH drops, your process is gone. You've got twelve tabs open and no idea which is which. tmux fixes all of it — and it does way more than you think.
What Is tmux?
tmux is a terminal multiplexer. It lets you run multiple terminal sessions inside one window, and they survive when you disconnect.
Think of three layers. Sessions are workspaces (like "webserver" or "database"). Inside each session: windows (like tabs). Inside each window: panes (splits). You can divide a single window into as many terminals as you need.
The key insight: tmux runs as a server process. Your terminals are clients. When you close your terminal or your SSH drops, the server keeps running. Your processes don't die. You just reattach and pick up exactly where you left off.
Getting Started
Install it (brew install tmux on Mac, apt install tmux on Ubuntu), then type tmux. That's it — you're in. The green status bar at the bottom tells you you're inside tmux.
Everything starts with a prefix key — by default, Ctrl-b. Press it, then press the next key:
| Keys | Action |
|---|---|
Ctrl-b d |
Detach (session keeps running) |
Ctrl-b c |
Create new window |
Ctrl-b n / Ctrl-b p
|
Next / previous window |
Ctrl-b % |
Vertical split |
Ctrl-b " |
Horizontal split |
Ctrl-b z |
Zoom pane (toggle fullscreen) |
Ctrl-b x |
Kill pane |
Ctrl-b s |
Session picker |
Sessions — The Killer Feature
tmux new -s work # Named session
tmux new -s server # Another session
tmux ls # List sessions
tmux attach -t work # Attach to "work"
SSH into a remote server, start a long-running process, detach, go home. Come back tomorrow — tmux attach — everything is exactly where you left it. Running processes, open files, cursor positions. All preserved.
Customization
The defaults are painful. Fix them in ~/.tmux.conf:
# Rebind prefix to Ctrl-a (easier reach)
unbind C-b
set-option -g prefix C-a
# Mouse support
set -g mouse on
# Windows start at 1 (matches keyboard)
set -g base-index 1
# Vim-style pane navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
Themes like Dracula, Catppuccin, and Nord are one line in your config. Install them with tpm (tmux plugin manager).
Power Moves
tmux send-keys — Send keystrokes to any pane from a script. Build your entire dev environment with one command.
tmux capture-pane — Grab terminal output as text. Pipe it into grep, save to a file.
tmuxinator — Define layouts in YAML. Project name, window names, pane splits, startup commands. Type mux start project-name and your workspace materializes.
tmux-resurrect + tmux-continuum — Automatically save your session every 15 minutes and restore everything after a reboot. Your sessions become permanent.
Real-World Workflows
→ Remote servers: One session per service. Detach, disconnect, come back tomorrow. Everything's still running.
→ Pair programming: Two people attach to the same session. Both see the same terminal. Zero latency, zero setup.
→ Long tasks: Start a training run in tmux, detach, go home. Check from your phone over SSH.
→ Dev environments: One session per project, each with a standard layout. Switch projects by switching sessions.
Once you internalize tmux, you never go back. Every terminal becomes persistent. Every workspace becomes portable. Every SSH connection becomes unbreakable.
References:
Watch the full animated breakdown: tmux: Zero to Hero in 8 Minutes
Neural Download — visual mental models for how things work under the hood.
Top comments (0)