Skip to content
Back to skills

003 Name Skill C0390286

ASecurity

Use tmux instead of bash tool to run commands that take more than ~30 seconds, like bulk operations, db migrations, dev servers.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
toolsbash

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 003-name-skill_c0390286 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 003 Name Skill C0390286?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 003 Name Skill C0390286
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-003-name-skill-c0390286/badge)](https://www.skillsdirectory.com/skills/tools-only-003-name-skill-c0390286)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: tmux
description: Use tmux instead of bash tool to run commands that take more than ~30 seconds, like bulk operations, db migrations, dev servers.
---

# tmux for Long-Running Processes

Use tmux for any process that needs to run independently (dev servers, background tasks, long-running scripts). Do **not** use `nohup`, `&`, or other backgrounding techniques with the bash tool.

## Start a Process

```bash
tmux new-session -d -s <name> '<command> > /tmp/pi-tmux-<name>.log 2>&1'
```

**Naming:** Use descriptive names like `dev-server`, `build-kernel`, `test-run`.

**Examples:**
```bash
# Simple command
tmux new-session -d -s dev-server 'npm run dev > /tmp/pi-tmux-dev-server.log 2>&1'

# Compound commands - use braces to capture all output
tmux new-session -d -s build '{ npm install && npm run build; } > /tmp/pi-tmux-build.log 2>&1'
```

## List Sessions

```bash
tmux ls
```

## Read Output

**For long-running processes**, use log files (these persist even after the process exits):
```bash
# Read with the read tool
/tmp/pi-tmux-<name>.log

# Or tail for recent output
tail -100 /tmp/pi-tmux-<name>.log
```

**For interactive tools** (REPLs, prompts), capture the current screen:
```bash
tmux capture-pane -t <name> -p
```

Allow ~0.5 seconds after starting a session before reading output.

## Stop a Session

```bash
tmux kill-session -t <name>
```

## Send Input

If a process needs input:
```bash
tmux send-keys -t <name> "input text" Enter
```

**Special keys:** `Enter`, `Escape`, `C-c` (Ctrl+C), `C-d` (Ctrl+D), `Up`, `Down`, `Space`, `BSpace` (backspace)

**Note:** Keys are separate arguments, not escape sequences. Use `"text" Enter`, not `"text\n"`.

## Rules

1. **Always redirect output** to `/tmp/pi-tmux-<name>.log` so you can read it later
2. **Use descriptive session names** - they're easier to manage than PIDs
3. **Check `tmux ls`** before creating sessions to avoid name conflicts
4. **Always clean up**: kill sessions without asking; remove log files at your own discretion

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…