microck avatar

Using Tmux For Interactive Commands

When you need Claude to control interactive CLI tools like vim, git rebase -i, or Python REPLs, this provides a tmux-based pattern for handling the real terminal requirements those tools expect. The approach is straightforward: spin up a detached tmux session, use send-keys to inject commands (including special keys like Enter and Escape), and capture-pane to see what's on screen. The skill includes practical examples for common scenarios like editing files in vim programmatically and automating interactive git workflows. The main gotcha is remembering to add a brief sleep after starting sessions so tools have time to initialize before you try capturing output. It's the difference between Claude hanging on interactive commands and actually being able to control them.

GitHub stars
237
last updated
Apr 30, 2026

Install

$ npx -y skills add microck/ordinary-claude-skills --skill using-tmux-for-interactive-commands --agent claude-code

Installs into .claude/skills of the current project.

Files

Using tmux for Interactive Commands

Overview

Interactive CLI tools (vim, interactive git rebase, REPLs, etc.) cannot be controlled through standard bash because they require a real terminal. tmux provides detached sessions that can be controlled programmatically via send-keys and capture-pane.

When to Use

Use tmux when:

  • Running vim, nano, or other text editors programmatically
  • Controlling interactive REPLs (Python, Node, etc.)
  • Handling interactive git commands (git rebase -i, git add -p)
  • Working with full-screen terminal apps (htop, etc.)
  • Commands that require terminal control codes or readline

Don't use for:

  • Simple non-interactive commands (use regular Bash tool)
  • Commands that accept input via stdin redirection
  • One-shot commands that don't need interaction

Quick Reference

TaskCommand
Start sessiontmux new-session -d -s <name> <command>
Send inputtmux send-keys -t <name> 'text' Enter
Capture outputtmux capture-pane -t <name> -p
Stop sessiontmux kill-session -t <name>
List sessionstmux list-sessions

Core Pattern

Sponsors

Details

Repository
github.com/microck/ordinary-claude-skills
Categories
Git & Pull Requests, Python, CLI & Terminal
First seen
Jun 11, 2026

More from microck/ordinary-claude-skills

All 9
1microsoft avatarazure-reliabilitymicrosoft/github-copilot-for-azureAssess and improve the reliability posture of PaaS Applications (Azure Functions and Azure App Service). Scans deployed resources for zone redundancy, ZRS stora0skills.sh installs
2mlflow avatarfetch-unresolved-commentsmlflow/mlflowFetch unresolved PR review comments using GitHub GraphQL API, filtering out resolved and outdated feedback.0skills.sh installs
3noobnooc avatarwtfnoobnooc/agentPre-launch and pre-commit audit for vibe coding projects. Use when asked to check whether a project is ready to ship, deploy, merge, or commit, especially for c0skills.sh installs
4noobnooc avatarwtfnoobnooc/noobnoocPre-launch and pre-commit audit for vibe coding projects. Use when asked to check whether a project is ready to ship, deploy, merge, or commit, especially for c0skills.sh installs
5open-gitagent avatarrun-agentopen-gitagent/opengapConfigures and runs agents with different adapters including Claude, OpenAI, CrewAI, Lyzr, and GitHub Models. Supports local execution, remote git repos, and on0skills.sh installs
6PackmindHub avataradd-agent-propertyPackmindHub/coding-agents-matrixAdd a new property to the AI agents database. Use when the user wants to add, create, or introduce a new column, property, field, or feature to track across all0skills.sh installs