AgentSkillsCN

tmux

Tmux会话与进程控制。当您需要重启开发服务器、查看进程输出、停止或启动后台进程,或在Tmux窗格中管理各类服务时,可选用此技能。

SKILL.md
--- frontmatter
name: tmux
description: Tmux session and process control. Use when restarting dev servers, checking process output, stopping/starting background processes, or managing services in tmux panes.
<!-- @agent-architect owns this file. Delegate changes, don't edit directly. --> <discovery> List all windows: tmux list-windows -a Output format: session:window: window_name (n panes) [geometry] [flags]

List panes in window: tmux list-panes -t "session:window" -F "#{pane_index}: #{pane_current_command} - #{pane_current_path}" </discovery>

<targeting> Format: session:window.pane (pane is 0-indexed). Window can be name or index. If single pane, .0 optional. Session name must match exactly. </targeting> <commands> Send command: tmux send-keys -t "session:window.pane" "command" Enter Stop process: tmux send-keys -t "session:window.pane" C-c (no Enter after C-c) Capture output: tmux capture-pane -t "session:window.pane" -p With scrollback: tmux capture-pane -t target -p -S -50 | tail -30 </commands>

<dev_server_restart>

  1. Find pane: tmux list-windows -a
  2. Identify process: tmux list-panes -t "session:window" -F "#{pane_index}: #{pane_current_command}"
  3. Stop: tmux send-keys -t target C-c
  4. Verify stopped via capture
  5. Start: tmux send-keys -t target "yarn start" Enter
  6. Verify started via capture after delay </dev_server_restart>

<error_recovery> Command not executing: verify target exists with list-windows/list-panes. Process not stopping: try multiple C-c sends. Output garbled: use -J flag for join lines. </error_recovery>

<practices> Always verify target pane before sending. Capture output before and after operations. Use delay between stop and start. Check pane current_command to confirm state. Never assume pane state. </practices>