askill
using-tmux-for-interactive-commands

using-tmux-for-interactive-commandsSafety 100Repository

Controls interactive CLI tools (vim, git rebase -i, REPLs) through tmux detached sessions and send-keys. Use when running tools requiring terminal interaction, programmatic editor control, or orchestrating Claude Code sessions. Triggers include "interactive command", "vim", "REPL", "tmux", or "git rebase -i".

0 stars
1.2k downloads
Updated 3/12/2026

Package Files

Loading files...
SKILL.md

Using tmux for Interactive Commands

Quick Reference (30 seconds)

Interactive CLI tools (vim, REPLs, git rebase -i) require real terminals. Use tmux detached sessions with send-keys and capture-pane.

Essential Commands

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

tmux new-session -d -s edit vim file.txt  # Start detached
sleep 0.3                                   # Wait for init
tmux send-keys -t edit 'i' 'Hello' Escape ':wq' Enter  # Interact
tmux kill-session -t edit                   # Cleanup

When to Use

Use tmuxDon't use
vim, nano, editorsSimple non-interactive commands
Python/Node REPLsCommands that accept stdin redirection
git rebase -i, git add -pOne-shot commands
Full-screen apps (htop)

Implementation Guide (5 minutes)

Workflow

  1. Create detached session with interactive command
  2. Wait briefly (100-500ms) for initialization
  3. Send input via send-keys
  4. Capture output via capture-pane -p
  5. Repeat steps 3-4 as needed
  6. Terminate session when done

Special Keys

Keytmux name
ReturnEnter
ESCEscape
Ctrl+CC-c
Ctrl+XC-x
ArrowsUp, Down, Left, Right
SpaceSpace
BackspaceBSpace

Working Directory

tmux new-session -d -s git -c /path/to/repo git rebase -i HEAD~3

Common Patterns

Python REPL

tmux new-session -d -s py python3 -i
tmux send-keys -t py 'import math' Enter
tmux send-keys -t py 'print(math.pi)' Enter
tmux capture-pane -t py -p
tmux kill-session -t py

Vim Editing

tmux new-session -d -s vim vim /tmp/file.txt
sleep 0.3
tmux send-keys -t vim 'i' 'New content' Escape ':wq' Enter

Interactive Git Rebase

tmux new-session -d -s rebase -c /repo git rebase -i HEAD~3
sleep 0.5
tmux capture-pane -t rebase -p
tmux send-keys -t rebase 'Down' 'Home' 'squash' Escape ':wq' Enter

Node REPL

tmux new-session -d -s node node
tmux send-keys -t node 'const x = 42' Enter
tmux send-keys -t node 'console.log(x * 2)' Enter
tmux capture-pane -t node -p
tmux kill-session -t node

Common Mistakes

Not Waiting After Start

Problem: Blank screen on immediate capture Fix:

tmux new-session -d -s sess command
sleep 0.3  # Let command initialize
tmux capture-pane -t sess -p

Forgetting Enter Key

Problem: Commands typed but not executed Fix: Always explicitly send Enter

Wrong Session Name

Problem: Session not found Fix: Use tmux list-sessions to verify names

Not Escaping Special Characters

Problem: Shell interprets characters Fix: Use single quotes: tmux send-keys -t s 'echo "hello"' Enter


Advanced: Claude Code Orchestration

Start Claude Code in tmux

tmux new-session -d -s claude -c /project/path claude
sleep 2  # Claude Code takes longer to start
tmux capture-pane -t claude -p  # See initial state

Send Prompts

tmux send-keys -t claude "Fix all TypeScript errors" Enter
sleep 30  # Wait for processing
tmux capture-pane -t claude -p  # Check progress

Graceful Exit

tmux send-keys -t claude '/exit' Enter
sleep 1
tmux kill-session -t claude

Works Well With

Skills: bash-optimizer, git-cli-agentic Tools: tmux, vim, git


Reference

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

94/100Analyzed 3/15/2026

High-quality technical skill document covering tmux-based control of interactive CLI tools. Provides quick reference tables, implementation workflow, multiple concrete examples (Python/Vim/Node/Git REPL), common mistakes section, and advanced Claude Code orchestration. Well-structured with clear sections, proper formatting, and practical value. No significant issues identified.

100
95
90
90
95

Metadata

Licenseunknown
Version-
Updated3/12/2026
PublisherVen0m0

Tags

github-actionsllm