← ClaudeAtlas

tmux-processeslisted

Patterns for running long-lived processes in tmux. Use when starting dev servers, watchers, tilt, or any process expected to outlive the conversation.
aiskillstore/marketplace · ★ 329 · Web & Frontend · score 79
Install: claude install-skill aiskillstore/marketplace
# tmux Process Management ## Interactive Shell Requirement **Use send-keys pattern for reliable shell initialization.** Creating a session spawns an interactive shell automatically. Use `send-keys` to run commands within that shell, ensuring PATH, direnv, and other initialization runs properly. ```bash # WRONG - inline command bypasses shell init, breaks PATH/direnv tmux new-session -d -s "$SESSION" -n main 'tilt up' # CORRECT - create session, then send command to interactive shell tmux new-session -d -s "$SESSION" -n main tmux send-keys -t "$SESSION:main" 'tilt up' Enter ``` ## Session Naming Convention Always derive session name from the project: ```bash SESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD) ``` For multiple processes in one project, use windows not separate sessions: - Session: `myapp` - Windows: `server`, `tests`, `logs` ## Starting Processes ### Single Process ```bash SESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD) # Create session with named window, then send command tmux new-session -d -s "$SESSION" -n main tmux send-keys -t "$SESSION:main" '<command>' Enter ``` ### Idempotent Start Check if already running before starting: ```bash SESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD) if ! tmux has-session -t "$SESSION" 2>/dev/null; then tmux new-session -d -s "$SESSION" -n main tmux send-keys -t "$SESSION:main" '<command>' Enter else echo "S