
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-codeInstalls 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
| Task | Command |
|---|---|
| Start session | tmux new-session -d -s <name> <command> |
| Send input | tmux send-keys -t <name> 'text' Enter |
| Capture output | tmux capture-pane -t <name> -p |
| Stop session | tmux kill-session -t <name> |
| List sessions | tmux 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