Tmux Cheatsheet: Sessions, Panes & Shortcuts
The complete tmux cheatsheet: sessions, windows, panes, split screen, detach/attach, copy mode, resizing — every shortcut for parallel terminal work.
Independent article: published by AI Coding Tools, not official vendor documentation.
Tmux Cheatsheet: Sessions, Panes & Shortcuts
This is the command reference for tmux, the terminal multiplexer that lets you run multiple AI agents in parallel. Every shortcut below assumes the default prefix key: Ctrl-b. Press the prefix, release it, then press the command key.
Installation
# macOS
brew install tmux
# Debian / Ubuntu
sudo apt install tmux
# Fedora
sudo dnf install tmux
# Windows (WSL2)
sudo apt install tmux
Session commands
Sessions are the top level — each one survives detaching and keeps your agents running in the background.
| Action | Command / shortcut |
|---|---|
| Start a new named session | tmux new -s myproject |
| List sessions | tmux ls |
| Attach to a session | tmux attach -t myproject |
| Detach (keep running) | Ctrl-b d |
| Rename the current session | Ctrl-b $ |
| Kill a session | tmux kill-session -t myproject |
| Detach all clients from a session | tmux detach -a (run outside tmux) |
Window commands
Windows are like tabs inside a session — useful for grouping panes by task.
| Action | Shortcut |
|---|---|
| New window | Ctrl-b c |
| Next window | Ctrl-b n |
| Previous window | Ctrl-b p |
| Jump to window by number | Ctrl-b 0 … Ctrl-b 9 |
| Close the current window | Ctrl-b & (confirm with y) |
| Rename the current window | Ctrl-b , |
| List windows (pick with arrows) | Ctrl-b w |
Pane commands
Panes are the workhorses of parallel AI coding — each pane runs its own shell, agent, or watcher.
| Action | Shortcut |
|---|---|
| Split pane horizontally (top/bottom) | Ctrl-b " |
| Split pane vertically (left/right) | Ctrl-b % |
| Switch to the next pane | Ctrl-b o |
| Move between panes (arrows) | Ctrl-b then ←↑↓→ |
| Close the current pane | Ctrl-b x (confirm with y) |
| Toggle pane zoom (fullscreen) | Ctrl-b z |
| Resize pane | Ctrl-b then hold ←↑↓→ (or Ctrl-b then Ctrl-arrows with vi keys) |
| Break a pane into its own window | Ctrl-b ! |
| Join a pane into another window | Ctrl-b : then join-pane -t <window> |
One-key four-pane quad layout
Split a window into four quadrants with a single ~/.tmux.conf binding:
bind -n M-q send-keys tmux new-session -d \; split-window -h \; split-window -v -t 0 \; split-window -v -t 2 \; select-pane -t 0
Reload config with Ctrl-b : → source-file ~/.tmux.conf. Then press Alt-q in any session for an instant 2×2 grid — the exact layout used in our guide to running 4 AI agents in parallel.
Copy mode and scrolling
| Action | Shortcut |
|---|---|
| Enter copy mode (scroll) | Ctrl-b [ |
| Exit copy mode | q or Esc |
| Scroll up / down | PageUp / PageDown (or Ctrl-u / Ctrl-d) |
| Search forward / backward | Ctrl-s / Ctrl-r |
| Copy a selection (vi keys) | Space to start, Enter to copy |
| Paste buffer | Ctrl-b ] |
Quick productivity config
The smallest config that makes tmux comfortable — the full setup is in our tmux.conf guide:
# ~/.tmux.conf
set -g mouse on
set -g prefix C-a
setw -g mode-keys vi
set -g status-bg black
set -g status-fg white
Common troubleshooting
| Problem | Fix |
|---|---|
| "no server running" on attach | Start it: tmux new -s name first |
| Forgot the session name | tmux ls, then attach by name |
| Pane content frozen | You're in copy mode — press q |
| Split command does nothing | You're inside tmux but pressed a stray key — press Ctrl-b first, then the key |
| Prefix conflicts with another tool | Remap it in ~/.tmux.conf (e.g. set -g prefix C-a) |
Next steps
The cheatsheet is the reference; the strategy lives in the full guide — tmux for AI coding: run parallel agents without waiting. If you use Claude Code, the multi-session setup shows how to pair it with tmux, and tmux vs screen explains why tmux over the alternatives.