tmux

Send keystrokes and capture pane output in tmux sessions via a private socket.

223|6|Updated May 25, 2018
One-click install
npx skills add https://github.com/megalithic/dotfiles --skill tmux-megalithic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tmux
Source: https://github.com/megalithic/dotfiles/tree/main/home/programs/ai/pi-coding-agent/skills/tmux
Command: npx skills add https://github.com/megalithic/dotfiles --skill tmux-megalithic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tmux, and includes scripts (resource) components.

What problem does it solve?

This Skill enables programmable control of tmux sessions by sending keystrokes and scraping pane output, reducing manual CLI interaction.

Core Features & Use Cases

  • Programmable session control: drive tmux commands across sessions and panes without manual input.
  • Pane output monitoring: capture and process pane text for automation and logging.
  • Use Case: automate a Python REPL or a debugger in a split-pane workflow and programmatically react to prompts.

Quick Start

Start a private tmux session using a dedicated socket and attach to it: tmux -S "$SOCKET" new -s claude-shell -d tmux -S "$SOCKET" attach -t claude-shell

To monitor this session, capture output with: tmux -S "$SOCKET" capture-pane -p -J -t claude-shell: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 running tmux session?

You can automate sending keystrokes to a running tmux session by using a private socket path to programmatically control interactive panes. This enables automated CLI interaction without manual input.

Can I capture and monitor pane output from a tmux session for debugging?

Yes, you can capture and monitor pane output from a tmux session using the capture-pane command. This allows you to programmatically scrape and process terminal text for automation and logging.

What is the best way to automate a Python REPL inside tmux split-panes?

The best way to automate a Python REPL inside tmux split-panes is by programmatically sending keystrokes and capturing output. This approach lets you drive interactive debuggers and react to prompts automatically.

Do I need a private socket to control tmux sessions programmatically?

Yes, using a private socket with tmux -S is required to control sessions programmatically. This setup ensures isolated automation when sending keystrokes and scraping pane output on Linux and macOS.

Does this approach for terminal session management work on macOS?

Yes, this terminal session management approach works on both Linux and macOS. It leverages tmux to drive interactive commands, automate REPLs, and capture multi-pane output across sessions.

Why use a terminal multiplexer for scripting instead of standard shell automation?

Using a terminal multiplexer for scripting allows you to interactively control persistent sessions and split-panes. Unlike standard shell automation, it captures live pane output and reacts to interactive prompts dynamically.