Tmux Essentials: A Quick Reference
Posted on Fri 24 January 2025 in Developer Tools • 2 min read
Tmux (terminal multiplexer) lets you run multiple terminal sessions within a single window, detach and reattach to sessions, and organize work into windows and panes. Here are the essential commands.
Session Management
Sessions persist even when you disconnect, making tmux invaluable for remote work.
| Command | Description |
|---|---|
tmux new -s name |
Create a new session with name |
tmux ls |
List all sessions |
tmux attach -t name |
Attach to a named session |
tmux kill-session -t name |
Kill a session |
Ctrl-b d |
Detach from current session |
Window Management
Windows are like tabs within a session.
| Keybinding | Description |
|---|---|
Ctrl-b c |
Create new window |
Ctrl-b , |
Rename current window |
Ctrl-b & |
Kill current window |
Ctrl-b n |
Next window |
Ctrl-b p |
Previous window |
Ctrl-b l |
Last (previously selected) window |
Ctrl-b w |
List all windows (select interactively) |
Ctrl-b 0-9 |
Switch to window number 0-9 |
Pane Management
Panes split a window into multiple terminals.
Creating Panes
| Keybinding | Description |
|---|---|
Ctrl-b % |
Split vertically (left/right) |
Ctrl-b " |
Split horizontally (top/bottom) |
Navigating Panes
| Keybinding | Description |
|---|---|
Ctrl-b o |
Cycle to next pane |
Ctrl-b q |
Show pane numbers (press number to switch) |
Ctrl-b { |
Move current pane left |
Ctrl-b } |
Move current pane right |
Pane Operations
| Keybinding | Description |
|---|---|
Ctrl-b x |
Kill current pane |
Ctrl-b :break-pane |
Convert pane to its own window |
General
| Keybinding | Description |
|---|---|
Ctrl-b ? |
List all keybindings |
Ctrl-b : |
Enter command mode |
Ctrl-b t |
Show clock |
Useful Customizations
Add to ~/.tmux.conf:
# More intuitive split commands
bind | split-window -h
bind - split-window -v
# Enable mouse support
set -g mouse on
# Start window numbering at 1
set -g base-index 1
Reload config without restarting tmux:
tmux source-file ~/.tmux.conf
Quick Workflow
# Start a new session for a project
tmux new -s myproject
# Split into panes: editor on left, terminal on right
# Ctrl-b %
# Create another window for logs
# Ctrl-b c
# Detach and leave everything running
# Ctrl-b d
# Come back later
tmux attach -t myproject
The key mental model: sessions contain windows, windows contain panes. Learn Ctrl-b d (detach) and tmux attach first - they're the gateway to tmux productivity.