tmux

Automate interactive CLIs by sending keystrokes and capturing tmux pane output.

2.8k|212|Updated Nov 2, 2025
One-click install
npx skills add https://github.com/mitsuhiko/agent-commands --skill tmux-mitsuhiko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tmux
Source: https://github.com/mitsuhiko/agent-commands/tree/main/skills/tmux
Command: npx skills add https://github.com/mitsuhiko/agent-commands --skill tmux-mitsuhiko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill lets you automate interactive terminal workflows by controlling tmux sessions, sending keystrokes, and extracting pane output, saving you time on repetitive tasks.

Core Features & Use Cases

  • Programmable sessions: Create, attach, or monitor tmux sessions from scripts.
  • Keystroke automation: Send keys to specific panes to drive interactive programs.
  • Pane capture: Retrieve real-time or captured output for analysis and logging.
  • Use Case: Automate a long-running Python REPL or a debugger session without manual keyboard input.

Quick Start

To start a private tmux session and monitor it yourself:

  • Create a private socket directory: export CLAUDE_TMUX_SOCKET_DIR="${TMPDIR:-/tmp}/claude-tmux-sockets" mkdir -p "$CLAUDE_TMUX_SOCKET_DIR"
  • Start a session and pipe keystrokes: tmux -S "$CLAUDE_TMUX_SOCKET_DIR/claude.sock" new -d -s claude-session -n shell tmux -S "$CLAUDE_TMUX_SOCKET_DIR/claude.sock" send-keys -t "claude-session":0.0 -- 'python3 -q' Enter
  • Watch output: tmux -S "$CLAUDE_TMUX_SOCKET_DIR/claude.sock" capture-pane -p -J -t "claude-session":0.0 -S -200

Frequently Asked Questions about tmux

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate sending keystrokes to a tmux session?

Automate keystrokes by creating a private tmux session with a dedicated socket, then use `tmux send-keys` to transmit input to specific panes. This lets you drive interactive programs like Python REPLs or debuggers without manual keyboard input, using literal key transmission to avoid shell expansion.

Can I capture and extract output from a running tmux pane?

Yes, use `tmux capture-pane` to retrieve real-time or historical output from panes for analysis and logging. This captures what's currently displayed, enabling you to monitor and scrape results from interactive terminal sessions programmatically.

What's the best way to automate interactive CLI workflows like a Python REPL or debugger?

Create a dedicated tmux session using a private socket directory, send keystrokes to panes to control the CLI, and capture output to monitor results. This approach isolates automation from your main terminal and avoids interference with other processes.

Do I need to install additional software beyond tmux to automate terminal sessions?

No, tmux automation requires only stock tmux on Linux or macOS with access to create private socket directories. No dependencies or extra tools are needed beyond standard tmux commands and shell scripting.

Why use private socket directories when automating tmux sessions?

Private sockets confine sessions to a specific directory, preventing conflicts with other tmux instances and securing your automation from unintended interference. This isolation is essential for reliable, safe keystroke transmission and pane monitoring in scripted workflows.

Can tmux automation handle long-running interactive programs without manual intervention?

Yes, you can automate long-running sessions like interactive debuggers or database CLIs by programmatically sending keystrokes and capturing output at intervals. The session persists independently, letting you monitor and drive it from scripts without keeping a terminal open.