Claude Skills Guide

Claude Code Terminal Multiplexer Tmux Workflow Tips

Terminal multiplexers have been essential tools for developers for decades, and combining them with Claude Code creates a powerful development environment. This guide covers practical workflows that will help you get the most out of Claude Code when working within tmux sessions.

Why Use Tmux with Claude Code

Claude Code runs in your terminal, which means it naturally pairs well with terminal multiplexers. Tmux allows you to maintain persistent sessions across SSH connections, split your terminal into multiple panes, and run multiple Claude Code instances simultaneously for parallel task processing.

The combination becomes particularly valuable when you need to maintain context across multiple projects or when working on servers where leaving a terminal session running is essential.

Setting Up Your Tmux Environment for Claude Code

First, ensure your tmux configuration supports a productive Claude Code workflow. Add these settings to your ~/.tmux.conf:

# Enable mouse support for pane navigation
set -g mouse on

# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

# Renumber windows when one is closed
set -g renumber-windows on

# Increase scrollback buffer
set -g history-limit 50000

After modifying your configuration, reload it with tmux source-file ~/.tmux.conf.

Creating Persistent Claude Code Sessions

One of the primary benefits of tmux is session persistence. When working on complex tasks with Claude Code, you do not want to lose your progress if your SSH connection drops or you accidentally close a terminal window.

Create a dedicated session for Claude Code work:

# Create a new tmux session named 'claude-work'
tmux new-session -d -s claude-work

# Attach to the session
tmux attach-session -t claude-work

For long-running Claude Code tasks, detach from the session with Ctrl-b d and your work continues running in the background. Reconnect later with the attach command shown above.

Split Pane Workflows for Multi-Task Development

Tmux allows you to split your terminal into multiple panes, which is valuable when you need to run Claude Code alongside test output, server logs, or reference documentation.

Vertical Split (Left-Right)

Press Ctrl-b % to split the current pane vertically. This creates a left and right pane. You can then run Claude Code in one pane and monitor tests or server output in the other.

Horizontal Split (Top-Bottom)

Press Ctrl-b " to split the current pane horizontally. This works well for keeping Claude Code in the top pane while viewing test results in the bottom pane.

Use Ctrl-b followed by an arrow key to move between panes. For faster navigation, bind keys in your tmux configuration:

# Quick pane navigation with Alt+arrow
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

Running Multiple Claude Code Instances in Parallel

For tasks that benefit from parallel processing, tmux makes it simple to run multiple Claude Code sessions simultaneously. Each Claude Code instance operates independently, allowing you to work on different aspects of a project concurrently.

Create multiple windows within a single tmux session:

# Create a new window in the current session
Ctrl-b c

# Switch between windows
Ctrl-b n  # next window
Ctrl-b p  # previous window

This approach works well when combined with Claude Code skills that specialize in different areas. For example, you might have one window running the frontend-design skill for UI work while another runs the tdd skill for test-driven development in a different module.

Automating Tmux Workflows with Scripts

Create shell scripts to automate your Claude Code tmux setup. Here is a script that creates a pre-configured development environment:

#!/bin/bash
SESSION="claude-dev"

# Create session and first window
tmux new-session -d -s "$SESSION"
tmux rename-window -t "$SESSION:1" "claude"

# Split the first window horizontally
tmux split-window -t "$SESSION:1" -v
tmux select-pane -t "$SESSION:1.0"

# Create additional windows for different tasks
tmux new-window -t "$SESSION" -n "tests"
tmux new-window -t "$SESSION" -n "server"
tmux new-window -t "$SESSION" -n "logs"

# Attach to the session
tmux attach-session -t "$SESSION"

Save this script as ~/scripts/claude-tmux.sh, make it executable with chmod +x ~/scripts/claude-tmux.sh, and run it whenever you need a fresh Claude Code development environment.

Using Tmux with Claude Code Skills

Claude Code skills enhance your workflow when combined with tmux. The pdf skill works well when you need to reference documentation while Claude Code edits code in an adjacent pane. The supermemory skill maintains context across sessions, which pairs nicely with tmux session persistence.

Organize your panes so that skills requiring different contexts have dedicated space. Keep reference materials in one pane while Claude Code operates in another, using the skills system to switch between specialized modes.

Monitoring Long-Running Claude Code Tasks

When Claude Code works on large refactoring tasks or code generation, you can monitor progress in a separate tmux pane while continuing other work. Split your terminal and run:

# In one pane: run Claude Code
claude

# In another pane: monitor system resources
htop

# In a third pane: check git status
watch -n 5 'git status'

This visibility helps you understand how Claude Code is progressing and catch any issues early.

Session Persistence and Recovery

Tmux provides resilience against connection issues. If your SSH session disconnects, tmux keeps your Claude Code session running. When you reconnect:

# List all running sessions
tmux ls

# Attach to a specific session
tmux attach-session -t claude-work

# If the session is stuck, kill and recreate
tmux kill-session -t claude-work
tmux new-session -d -s claude-work

For important work, consider using tmux plugins like tmux-resurrect to save and restore entire tmux environments, including running programs and pane layouts.

Conclusion

Combining Claude Code with tmux creates a robust development environment that handles disconnection gracefully, supports parallel task execution, and keeps your workflows organized. The terminal multiplexer adds resilience and flexibility to your Claude Code sessions, making it easier to work on complex projects without losing context.

Start with the basic session management commands, add pane splitting for parallel workflows, and gradually incorporate scripts to automate your setup. The investment in learning these workflows pays dividends in productivity and peace of mind.

Built by theluckystrike — More at zovo.one