
Tmux
- 5.8k installs
- 385k repo stars
- Updated August 3, 2026
- steipete/clawdis
Programmatic control interface for tmux terminal sessions, enabling reading pane state and sending keystrokes to automate interactive CLI workflows.
About
tmux is a terminal multiplexer control skill for agents and scripts managing interactive CLI sessions. Developers use it to automate workflows that require real-time interaction with long-running processes, capturing pane output, sending keys/text, and monitoring prompts. Key workflows include listing sessions/windows/panes, capturing full scrollback history, sending literal text or special keys (Ctrl+C, Ctrl+D), and waiting for specific prompt patterns before responding. Critical for testing scenarios where agent tooling must interact with interactive CLIs that don't support non-interactive flags, and for monitoring multi-pane setups that persist across SSH disconnects. --- name: tmux description: "Control tmux sessions/panes for interactive CLIs: list, capture output, send keys, paste text, monitor prompts." metadata: { "openclaw": { "emoji": "🧵", "os": ["darwin", "linux"], "requires": { "bins": ["tmux"] }, "install": [ { "id": "brew", "kind": "brew", "formula": "tmux", "bins": ["tmux"], "label": "Install tmux (brew)", }, ], }, } --- # tmux Use for existing interactive tmux sessions.
- List, capture, and interact with existing tmux sessions, windows, and panes via target format (session:window.pane)
- Send literal text, special keys (C-c, C-d, Escape), and Enter separately to handle paste/newline edge cases
- Capture full scrollback history with -S - flag and parse output with grep/regex to detect prompts before responding
- Create, rename, and kill sessions for ephemeral interactive workflows; sessions persist across SSH disconnects
- Helper scripts (find-sessions.sh, wait-for-text.sh) simplify session discovery and prompt detection patterns
Tmux by the numbers
- 5,815 all-time installs (skills.sh)
- +187 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #34 of 550 CLI & Terminal skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Aug 3, 2026 (Skillselion catalog sync)
tmux capabilities & compatibility
- Capabilities
- list and enumerate tmux sessions, windows, panes · capture pane output (current or full scrollback) · send literal text with proper escaping · send special keys (ctrl+c, ctrl+d, escape, enter · create, rename, kill tmux sessions · parse output for prompt detection and conditiona
- Use cases
- testing · debugging · orchestration
- Platforms
- macOS · Linux
- Runs
- Runs locally
- Pricing
- Free
What tmux says it does
Use for existing interactive tmux sessions. For one-shot commands, use normal shell.
tmux sessions persist across SSH disconnects.
npx skills add https://github.com/steipete/clawdis --skill tmuxAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 5.8k |
|---|---|
| repo stars | ★ 385k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 3, 2026 |
| Repository | steipete/clawdis ↗ |
What it does
Automate interactive CLI workflows by controlling tmux sessions, capturing output, and sending keystrokes programmatically.
Who is it for?
Testing interactive CLIs, automating approval workflows, monitoring multi-pane sessions, handling prompts in unattended environments.
Skip if: Simple one-shot commands (use shell directly), fire-and-forget background jobs (use background execution), non-tmux interactive processes.
When should I use this skill?
Agent must interact with existing tmux session, detect prompt state, send input, or capture output from running process.
What you get
Automate interactive CLI workflows reliably by detecting state changes (prompts, errors, completion) and sending appropriate responses via tmux.
- tmux CLI commands for session/window/pane control
- output capture with full scrollback
- prompt detection patterns
By the numbers
- Target format supports 3-level hierarchy: session:window.pane
- Documented 6+ tmux command families: list, capture, send, session mgmt, prompt checks, helpers
- Supports full scrollback capture with -S - flag for historical output inspection
Files
tmux
Use for existing interactive tmux sessions. For one-shot commands, use normal shell. For new non-interactive background jobs, use background execution.
Basics
tmux ls
tmux list-windows -t shared
tmux list-panes -t shared:0
tmux capture-pane -t shared:0.0 -p
tmux capture-pane -t shared:0.0 -p -S -Target format: session:window.pane, e.g. shared:0.0.
Send input
Literal text, then Enter:
tmux send-keys -t shared:0.0 -l -- "Please continue"
tmux send-keys -t shared:0.0 EnterSpecial keys:
tmux send-keys -t shared:0.0 C-c
tmux send-keys -t shared:0.0 C-d
tmux send-keys -t shared:0.0 EscapeUse -l -- for arbitrary text. Split text and Enter to avoid paste/newline surprises.
Sessions
tmux new-session -d -s worker
tmux rename-session -t old new
tmux kill-session -t workerPrompt checks
tmux capture-pane -t worker-3 -p | tail -20
tmux capture-pane -t worker-3 -p | rg "proceed|permission|Yes|No|❯"Approve/select only when the prompt is understood:
tmux send-keys -t worker-3 -l -- "y"
tmux send-keys -t worker-3 EnterHelpers
scripts/find-sessions.sh: discover sessions.scripts/wait-for-text.sh: wait until pane output contains text.
Notes
capture-pane -pprints to stdout for scripts.-S -captures full scrollback.- tmux sessions persist across SSH disconnects.
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'USAGE'
Usage: find-sessions.sh [-L socket-name|-S socket-path|-A] [-q pattern]
List tmux sessions on a socket (default tmux socket if none provided).
Options:
-L, --socket tmux socket name (passed to tmux -L)
-S, --socket-path tmux socket path (passed to tmux -S)
-A, --all scan all sockets under OPENCLAW_TMUX_SOCKET_DIR
-q, --query case-insensitive substring to filter session names
-h, --help show this help
USAGE
}
socket_name=""
socket_path=""
query=""
scan_all=false
socket_dir="${OPENCLAW_TMUX_SOCKET_DIR:-${TMPDIR:-/tmp}/openclaw-tmux-sockets}"
while [[ $# -gt 0 ]]; do
case "$1" in
-L|--socket) socket_name="${2-}"; shift 2 ;;
-S|--socket-path) socket_path="${2-}"; shift 2 ;;
-A|--all) scan_all=true; shift ;;
-q|--query) query="${2-}"; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
esac
done
if [[ "$scan_all" == true && ( -n "$socket_name" || -n "$socket_path" ) ]]; then
echo "Cannot combine --all with -L or -S" >&2
exit 1
fi
if [[ -n "$socket_name" && -n "$socket_path" ]]; then
echo "Use either -L or -S, not both" >&2
exit 1
fi
if ! command -v tmux >/dev/null 2>&1; then
echo "tmux not found in PATH" >&2
exit 1
fi
list_sessions() {
local label="$1"; shift
local tmux_cmd=(tmux "$@")
if ! sessions="$("${tmux_cmd[@]}" list-sessions -F '#{session_name}\t#{session_attached}\t#{session_created_string}' 2>/dev/null)"; then
echo "No tmux server found on $label" >&2
return 1
fi
if [[ -n "$query" ]]; then
sessions="$(printf '%s\n' "$sessions" | grep -i -- "$query" || true)"
fi
if [[ -z "$sessions" ]]; then
echo "No sessions found on $label"
return 0
fi
echo "Sessions on $label:"
printf '%s\n' "$sessions" | while IFS=$'\t' read -r name attached created; do
attached_label=$([[ "$attached" == "1" ]] && echo "attached" || echo "detached")
printf ' - %s (%s, started %s)\n' "$name" "$attached_label" "$created"
done
}
if [[ "$scan_all" == true ]]; then
if [[ ! -d "$socket_dir" ]]; then
echo "Socket directory not found: $socket_dir" >&2
exit 1
fi
shopt -s nullglob
sockets=("$socket_dir"/*)
shopt -u nullglob
if [[ "${#sockets[@]}" -eq 0 ]]; then
echo "No sockets found under $socket_dir" >&2
exit 1
fi
exit_code=0
for sock in "${sockets[@]}"; do
if [[ ! -S "$sock" ]]; then
continue
fi
list_sessions "socket path '$sock'" -S "$sock" || exit_code=$?
done
exit "$exit_code"
fi
tmux_cmd=(tmux)
socket_label="default socket"
if [[ -n "$socket_name" ]]; then
tmux_cmd+=(-L "$socket_name")
socket_label="socket name '$socket_name'"
elif [[ -n "$socket_path" ]]; then
tmux_cmd+=(-S "$socket_path")
socket_label="socket path '$socket_path'"
fi
list_sessions "$socket_label" "${tmux_cmd[@]:1}"
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'USAGE'
Usage: wait-for-text.sh -t target -p pattern [options]
Poll a tmux pane for text and exit when found.
Options:
-t, --target tmux target (session:window.pane), required
-p, --pattern regex pattern to look for, required
-F, --fixed treat pattern as a fixed string (grep -F)
-T, --timeout seconds to wait (integer, default: 15)
-i, --interval poll interval in seconds (default: 0.5)
-l, --lines number of history lines to inspect (integer, default: 1000)
-h, --help show this help
USAGE
}
target=""
pattern=""
grep_flag="-E"
timeout=15
interval=0.5
lines=1000
while [[ $# -gt 0 ]]; do
case "$1" in
-t|--target) target="${2-}"; shift 2 ;;
-p|--pattern) pattern="${2-}"; shift 2 ;;
-F|--fixed) grep_flag="-F"; shift ;;
-T|--timeout) timeout="${2-}"; shift 2 ;;
-i|--interval) interval="${2-}"; shift 2 ;;
-l|--lines) lines="${2-}"; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
esac
done
if [[ -z "$target" || -z "$pattern" ]]; then
echo "target and pattern are required" >&2
usage
exit 1
fi
if ! [[ "$timeout" =~ ^[0-9]+$ ]]; then
echo "timeout must be an integer number of seconds" >&2
exit 1
fi
if ! [[ "$lines" =~ ^[0-9]+$ ]]; then
echo "lines must be an integer" >&2
exit 1
fi
if ! command -v tmux >/dev/null 2>&1; then
echo "tmux not found in PATH" >&2
exit 1
fi
# End time in epoch seconds (integer, good enough for polling)
start_epoch=$(date +%s)
deadline=$((start_epoch + timeout))
while true; do
# -J joins wrapped lines, -S uses negative index to read last N lines
pane_text="$(tmux capture-pane -p -J -t "$target" -S "-${lines}" 2>/dev/null || true)"
if printf '%s\n' "$pane_text" | grep $grep_flag -- "$pattern" >/dev/null 2>&1; then
exit 0
fi
now=$(date +%s)
if (( now >= deadline )); then
echo "Timed out after ${timeout}s waiting for pattern: $pattern" >&2
echo "Last ${lines} lines from $target:" >&2
printf '%s\n' "$pane_text" >&2
exit 1
fi
sleep "$interval"
done
Related skills
Forks & variants (1)
Tmux has 1 known copy in the catalog totaling 44 installs. They canonicalize to this original listing.
- smithery.ai - 44 installs
FAQ
When should I use tmux vs shell execution?
Use tmux for existing interactive sessions requiring real-time responses and state checking. Use shell for one-shot commands. Use background execution for fire-and-forget jobs.
How do I avoid paste/newline issues when sending text?
Send literal text with `-l --` flag, then send Enter as a separate command to split text and newline handling.
How do I detect a prompt before responding?
Capture pane output with `capture-pane -t session:window.pane -p`, pipe to grep/rg for keywords like 'proceed|Yes|No|❯', then send response.
Is Tmux safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.