tmux × claude code cli

tmux × Claude Code
Cheatsheet

by Chandra Shettigar

tmux shortcut
claude cli command
combined workflow
TMUX — ESSENTIALS // prefix key, session lifecycle, attach/detach
Prefix Key
Ctrl-b Default prefix — press before any tmux shortcut
Ctrl-a Common remap — add set -g prefix C-a to .tmux.conf
Session Lifecycle
tmux new -s name Create a named session
prefix d Detach — session keeps running
tmux attach -t name Reattach to a named session
tmux a Attach to last session
tmux ls List all active sessions
tmux kill-session -t name Kill a specific session
tmux kill-server Kill tmux server — destroys all sessions
TMUX — WINDOW MANAGEMENT // create, switch, rename, close
Create & Close
prefix c Create a new window
prefix & Close current window (confirm)
prefix , Rename current window
Switch Windows
prefix n Next window
prefix p Previous window
prefix 0-9 Jump to window by number
prefix l Toggle to last active window
prefix w List all windows — interactive picker
TMUX — PANE MANAGEMENT // split, navigate, resize, zoom
Split & Close
prefix % Split pane vertically (left/right)
prefix " Split pane horizontally (top/bottom)
prefix x Close current pane (confirm)
Navigate & Resize
prefix ←↑→↓ Move to adjacent pane
prefix o Cycle to next pane
prefix z Zoom toggle — fullscreen current pane
prefix Ctrl-←↑→↓ Resize pane in arrow direction
prefix Space Cycle through preset layouts
prefix { / } Swap pane with previous / next
TMUX — MULTI-PROJECT WORKFLOW // named sessions per project, session switching
Session Per Project
tmux new -s api -c ~/code/api New session with working directory
prefix s Interactive session picker
prefix ( / ) Switch to previous / next session
prefix $ Rename current session
Recommended Layout
# One session per project, named windows per concern
tmux new -s api -c ~/code/api
tmux new -s frontend -c ~/code/frontend
tmux new -s infra -c ~/code/infra

# Inside each session: window 0 = editor, window 1 = claude, window 2 = shell
# Switch projects: prefix s → pick session
# Switch concerns: prefix 0/1/2 → pick window
CLAUDE CODE — CLI BASICS // launching, flags, core slash commands
Launch & Start
claude Start interactive session in current directory
claude --continue Resume the last conversation
claude --resume <id> Resume a specific conversation by ID
claude -p "prompt" One-shot prompt — non-interactive, pipe-friendly
claude --model opus Start with a specific model
claude --version Show current version
Key Slash Commands
/help Show all available commands
/clear Clear conversation context
/compact Compress conversation to save context
/model Switch model mid-conversation
/cost Show token usage and cost
/config Open settings configuration
/vim Toggle vim keybindings
CLAUDE CODE — SESSION MANAGEMENT // multiple sessions, context, conversation control
Multiple Sessions
claude Each terminal/pane runs an independent session
claude -c Short form — continue last conversation
claude --conversations List past conversations
Context Control
/add-file path Add a file or image to context
! command Run a shell command in-session
/memory View and manage saved memories
/permissions Manage tool permissions
Keyboard Shortcuts
Esc Cancel current operation
Tab Autocomplete file paths and commands
Up Arrow Cycle through prompt history
CLAUDE CODE — AGENTS & TASKS // background agents, task tracking, parallel work
Subagents
Agent tool Claude spawns subagents for parallel tasks
Agent (worktree) Subagent in isolated git worktree
Agent (background) Run agent in background — notified on complete
Headless & Daemon Mode
claude -p "task" Headless — run task, output result, exit
cat file | claude -p "review" Pipe content in for processing
claude -p "task" --output-format json Get structured JSON output
Task Patterns
/plan Enter plan mode — design before coding
/compact [focus] Compress context with optional focus area
/fast Toggle fast mode — faster output, same model
COMBINED WORKFLOWS // tmux + claude patterns for multi-project dev
Multi-Agent Setup
pane 0 · claude · feature-auth
✓ Created AuthMiddleware
Writing tests...
pane 1 · claude · bugfix-api
✓ Found root cause
Applying fix...
pane 2 · shell · monitoring
$ git log --oneline -5
Recipe: Parallel Claude Sessions
# 1. Create a tmux session for the project
tmux new -s myproject -c ~/code/myproject

# 2. Split into panes for parallel Claude sessions
#    prefix % → vertical split, prefix " → horizontal split

# 3. In pane 0: work on feature
claude    # → "implement auth middleware"

# 4. In pane 1 (prefix %): work on bugfix
claude    # → "fix the race condition in user service"

# 5. In pane 2 (prefix "): keep a shell for git, tests
npm test

# 6. Zoom into a pane to focus: prefix z
# 7. Switch panes: prefix o  or  prefix ←/→
Cross-Project Pattern
prefix s → select project Jump between projects via session picker
prefix 0/1/2 Switch concern — editor / claude / shell
prefix d → tmux a -t other Detach & switch — Claude keeps running
Tips
💡 Use prefix z to zoom into one Claude pane for detailed reading, prefix z again to unzoom.
Each Claude pane is independent — they don't share context. Use /compact to save tokens in long sessions.
TMUX — COPY MODE & SCROLLBACK // searching output, copying text
Enter & Navigate
prefix [ Enter copy mode — scroll with arrows/PgUp
q Exit copy mode
? Search backward through output
/ Search forward through output
Select & Copy
Space Start selection (in copy mode)
Enter Copy selection to tmux buffer
prefix ] Paste from tmux buffer
set -g history-limit 50000 Increase scrollback buffer in .tmux.conf