File contents Tmux
终端复用工具。
name: tmux
description: "Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output."
description_zh: "远程控制 tmux 交互式终端会话"
description_en: "Remote-control tmux terminal sessions"
tmux Skill
Use tmux only when you need an interactive TTY. Prefer bash background mode for long-running, non-interactive tasks.
Quickstart (isolated socket)
SOCKET_DIR="${TMPDIR:-/tmp}/codebuddy-tmux-sockets"
mkdir -p "$SOCKET_DIR"
SOCKET="$SOCKET_DIR/codebuddy.sock"
SESSION=codebuddy-python
tmux -S "$SOCKET" new -d -s "$SESSION" -n shell
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
Socket convention
Default socket dir: ${TMPDIR:-/tmp}/codebuddy-tmux-sockets
Default socket path: "$SOCKET_DIR/codebuddy.sock"
Targeting panes
Target format: session:window.pane (defaults to :0.0)
Keep names short; avoid spaces.
Finding sessions
List sessions: {baseDir}/scripts/find-sessions.sh -S "$SOCKET"
Scan all sockets: {baseDir}/scripts/find-sessions.sh --all
Sending input safely
Literal sends: tmux -S "$SOCKET" send-keys -t target -l -- "$cmd"
Control keys: tmux -S "$SOCKET" send-keys -t target C-c
Watching output
Capture recent: tmux -S "$SOCKET" capture-pane -p -J -t target -S -200
Wait for prompts: {baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern'
Cleanup
Kill session: tmux -S "$SOCKET" kill-session -t "$SESSION"
Kill all: tmux -S "$SOCKET" kill-server
Helper: wait-for-text.sh
{baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern' [-F] [-T 20] [-i 0.5] [-l 2000]
1 --- 2 name: tmux 3 description: Tmux 4 --- 5 # Tmux 6 7 终端复用工具。 8 9 --- 10 name: tmux 11 description: "Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output." 12 description_zh: "远程控制 tmux 交互式终端会话" 13 description_en: "Remote-control tmux terminal sessions" 14 --- 15 16 # tmux Skill 17 18 Use tmux only when you need an interactive TTY. Prefer bash background mode for long-running, non-interactive tasks. 19 20 ## Quickstart (isolated socket) 21 22 ```bash 23 SOCKET_DIR="${TMPDIR:-/tmp}/codebuddy-tmux-sockets" 24 mkdir -p "$SOCKET_DIR" 25 SOCKET="$SOCKET_DIR/codebuddy.sock" 26 SESSION=codebuddy-python 27 28 tmux -S "$SOCKET" new -d -s "$SESSION" -n shell 29 tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter 30 tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200 31 ``` 32 33 ## Socket convention 34 35 - Default socket dir: `${TMPDIR:-/tmp}/codebuddy-tmux-sockets` 36 - Default socket path: `"$SOCKET_DIR/codebuddy.sock"` 37 38 ## Targeting panes 39 40 - Target format: `session:window.pane` (defaults to `:0.0`) 41 - Keep names short; avoid spaces. 42 43 ## Finding sessions 44 45 - List sessions: `{baseDir}/scripts/find-sessions.sh -S "$SOCKET"` 46 - Scan all sockets: `{baseDir}/scripts/find-sessions.sh --all` 47 48 ## Sending input safely 49 50 - Literal sends: `tmux -S "$SOCKET" send-keys -t target -l -- "$cmd"` 51 - Control keys: `tmux -S "$SOCKET" send-keys -t target C-c` 52 53 ## Watching output 54 55 - Capture recent: `tmux -S "$SOCKET" capture-pane -p -J -t target -S -200` 56 - Wait for prompts: `{baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern'` 57 58 ## Cleanup 59 60 - Kill session: `tmux -S "$SOCKET" kill-session -t "$SESSION"` 61 - Kill all: `tmux -S "$SOCKET" kill-server` 62 63 ## Helper: wait-for-text.sh 64 65 ```bash 66 {baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern' [-F] [-T 20] [-i 0.5] [-l 2000] 67 ```
tugoukezhang/workbuddy-skills/tree/main/skills/tmux commit 57426ac02a
Frequently asked questions How do I install the Tmux skill? Run npx skillmds@latest add tugoukezhang/tmux in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Tmux skill do? Tmux It is listed under Coding & Dev Tools on SkillMD.
Is Tmux safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Tmux? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Tmux free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Tmux? tugoukezhang (@tugoukezhang) published this skill. Their other Agent Skills are listed on their SkillMD profile.