tmux
Manage tmux sessions for background processes. Use to run long-running commands, manage multiple terminals, and capture output from background processes.
What this skill does
# Tmux Session Manager
Run and manage background processes using tmux.
## Prerequisites
Install tmux:
```bash
brew install tmux
# or
apt install tmux
```
## CLI Reference
### Create Session
```bash
# Basic session
tmux new-session -d -s mysession
# With window name
tmux new-session -d -s mysession -n mywindow
# With working directory
tmux new-session -d -s mysession -c /path/to/dir
# With initial command
tmux new-session -d -s mysession "npm run dev"
# Combined
tmux new-session -d -s dev -n server -c /project "npm run dev"
```
### List Sessions
```bash
# List all sessions
tmux list-sessions
# Short format
tmux ls
# With format
tmux list-sessions -F "#{session_name}: #{session_windows} windows"
```
### Send Keys to Session
```bash
# Send command
tmux send-keys -t mysession "npm test" Enter
# Send to specific window
tmux send-keys -t mysession:mywindow "command" Enter
# Send without Enter
tmux send-keys -t mysession "partial command"
# Send special keys
tmux send-keys -t mysession C-c # Ctrl+C
tmux send-keys -t mysession C-d # Ctrl+D
tmux send-keys -t mysession Escape # Escape
tmux send-keys -t mysession Up # Arrow up
```
### Capture Output
```bash
# Capture visible pane
tmux capture-pane -t mysession -p
# Capture with history (last N lines)
tmux capture-pane -t mysession -p -S -100
# Capture all history
tmux capture-pane -t mysession -p -S -
# Save to file
tmux capture-pane -t mysession -p > output.txt
```
### Kill Session
```bash
# Kill specific session
tmux kill-session -t mysession
# Kill all sessions
tmux kill-server
```
### Attach to Session
```bash
# Attach
tmux attach -t mysession
# Attach or create
tmux new-session -A -s mysession
```
### Window Management
```bash
# New window
tmux new-window -t mysession -n windowname
# Select window
tmux select-window -t mysession:windowname
# Kill window
tmux kill-window -t mysession:windowname
# List windows
tmux list-windows -t mysession
```
### Pane Management
```bash
# Split horizontally
tmux split-window -t mysession -h
# Split vertically
tmux split-window -t mysession -v
# Select pane
tmux select-pane -t mysession:0.1
# Kill pane
tmux kill-pane -t mysession:0.1
```
## Workflow Patterns
### Run Dev Server in Background
```bash
# Start server
tmux new-session -d -s devserver -c /project "npm run dev"
# Check output
tmux capture-pane -t devserver -p -S -50
# Stop server
tmux send-keys -t devserver C-c
tmux kill-session -t devserver
```
### Run Tests with Output Capture
```bash
# Start tests
tmux new-session -d -s tests "npm test"
# Wait and capture output
sleep 30
tmux capture-pane -t tests -p -S - > test-output.txt
# Cleanup
tmux kill-session -t tests
```
### Multiple Services
```bash
# Create session with multiple windows
tmux new-session -d -s services -n frontend
tmux new-window -t services -n backend
tmux new-window -t services -n database
# Start each service
tmux send-keys -t services:frontend "npm run dev" Enter
tmux send-keys -t services:backend "go run main.go" Enter
tmux send-keys -t services:database "docker-compose up db" Enter
# Check all services
for win in frontend backend database; do
echo "=== $win ==="
tmux capture-pane -t services:$win -p -S -10
done
```
### Long-Running Process
```bash
# Start process
tmux new-session -d -s build "npm run build:production"
# Monitor progress
watch -n 5 "tmux capture-pane -t build -p -S -20"
# Or periodic check
while tmux has-session -t build 2>/dev/null; do
sleep 10
echo "Still running..."
done
echo "Build complete"
```
## Socket Mode (for Agents)
When running in agent context, use a dedicated socket:
```bash
SOCKET_PATH="/tmp/agent-tmux-$$"
# Create session with socket
tmux -S $SOCKET_PATH new-session -d -s agent "command"
# Send keys via socket
tmux -S $SOCKET_PATH send-keys -t agent "input" Enter
# Capture via socket
tmux -S $SOCKET_PATH capture-pane -t agent -p
# Cleanup
tmux -S $SOCKET_PATH kill-server
rm -f $SOCKET_PATH
```
## Best Practices
1. **Name sessions descriptively** - Easy to identify later
2. **Use `-d` for detached** - Don't block the terminal
3. **Capture output regularly** - Before killing sessions
4. **Set working directory** - Use `-c /path` for context
5. **Clean up sessions** - Kill when done
6. **Use sockets for isolation** - Prevent conflicts between agents
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.