Appearance
tmux Cheatsheet
Prefix key: Ctrl-b (referred to as C-b below)
Starting / Attaching
bash
tmux # New unnamed session
tmux new -s farm # New session named "farm"
tmux ls # List sessions
tmux a # Attach to last session
tmux a -t farm # Attach to session named "farm"
tmux kill-session -t farm # Kill session
tmux kill-server # Kill everythingSessions
| Keys | Action |
|---|---|
C-b d | Detach from session |
C-b $ | Rename session |
C-b s | List/switch sessions |
C-b ( | Previous session |
C-b ) | Next session |
Windows (tabs)
| Keys | Action |
|---|---|
C-b c | New window |
C-b , | Rename window |
C-b & | Kill window |
C-b w | List windows (interactive picker) |
C-b n | Next window |
C-b p | Previous window |
C-b 0-9 | Jump to window by number |
C-b l | Last active window |
Panes (splits)
| Keys | Action |
|---|---|
C-b % | Split vertical (left/right) |
C-b " | Split horizontal (top/bottom) |
C-b x | Kill pane |
C-b o | Cycle to next pane |
C-b ; | Toggle to last active pane |
C-b q | Show pane numbers, then press number to jump |
C-b z | Zoom/unzoom pane (fullscreen toggle) |
C-b { | Move pane left |
C-b } | Move pane right |
C-b Space | Cycle pane layouts |
C-b ! | Convert pane to its own window |
Resizing panes
| Keys | Action |
|---|---|
C-b C-arrow | Resize by 1 cell |
C-b M-arrow | Resize by 5 cells |
Copy / Scroll Mode
| Keys | Action |
|---|---|
C-b [ | Enter copy/scroll mode |
q | Exit copy mode |
Space | Start selection (in copy mode) |
Enter | Copy selection and exit |
C-b ] | Paste buffer |
/ | Search forward (in copy mode) |
? | Search backward (in copy mode) |
g | Jump to top |
G | Jump to bottom |
Arrow keys and Page Up/Down work in copy mode.
Running Long Processes on Farm
Fire and forget
bash
# Start session, kick off process, detach
tmux new -s deploy -d 'cd ~/projects/bodmail && npm run build'
# Check on it later
tmux a -t deployMulti-window workflow
bash
# Create a session with named windows
tmux new -s farm -n logs -d
tmux new-window -t farm -n build
tmux new-window -t farm -n monitor
# Send commands to specific windows
tmux send-keys -t farm:logs 'tail -f /var/log/app.log' Enter
tmux send-keys -t farm:build 'npm run build' Enter
tmux send-keys -t farm:monitor 'htop' Enter
# Attach when ready
tmux a -t farmRun command in existing session
bash
tmux send-keys -t farm:0 'npm test' EnterWait for a command to finish
bash
# Run in a pane and get notified
tmux set -t farm monitor-activity on
# Now switch to another window — tmux highlights the window when activity occursCapture output from a pane
bash
tmux capture-pane -t farm:0 -p > output.txt # Current visible
tmux capture-pane -t farm:0 -p -S -1000 > output.txt # Last 1000 linesUseful Options
bash
# Mouse support (scrolling, clicking panes, resizing)
tmux set -g mouse on
# Increase scrollback buffer
tmux set -g history-limit 50000
# Start window numbering at 1
tmux set -g base-index 1
tmux set -g pane-base-index 1Put these in ~/.tmux.conf to make them permanent.
Quick Reference: Common Combos
C-b d → detach (go do other stuff, come back later)
C-b c → new window
C-b % → split side by side
C-b " → split top/bottom
C-b z → zoom a pane to fullscreen (again to unzoom)
C-b [ → scroll up through output
C-b w → visual window/session picker
C-b s → session picker