Run interactive CLI sessions safely via tmux for editors, REPLs, and Git flows.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "using-tmux-for-interactive-commands" skill from askskill: 1. Download https://raw.githubusercontent.com/obra/superpowers-lab/main/skills/using-tmux-for-interactive-commands/SKILL.md 2. Save it as ~/.claude/skills/using-tmux-for-interactive-commands/SKILL.md 3. Reload skills and tell me it's ready
Show me how to start a detached tmux session, run git rebase -i HEAD~5 inside it, and use send-keys to save and exit. Include complete commands and precautions.
A runnable set of tmux and Git commands to create the session, start interactive rebase, and control keypresses.
I need to launch a Python REPL in a detached tmux session, send several lines of Python code, and inspect the output. Give me the steps, including session creation, command sending, and result checking.
Instructions for running a Python REPL in tmux, injecting inputs, and capturing or viewing terminal output.
Demonstrate how to use tmux to open Vim in a detached session, then use send-keys to enter insert mode, add content, and save and quit.
A tmux control workflow for Vim covering launch, key sending, save-and-quit, and common risk notes.
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.
Use tmux when:
git rebase -i, git add -p)Don't use for:
| 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 |
# This hangs because vim expects interactive terminal
bash -c "vim file.txt"
# Create detached tmux session
tmux new-session -d -s edit_session vim file.txt
# Send commands (Enter, Escape are tmux key names)
tmux send-keys -t edit_session 'i' 'Hello World' Escape ':wq' Enter
# Capture what's on screen
tmux capture-pane -t edit_session -p
# Clean up
tmux kill-session -t edit_session
send-keys (can send special keys like Enter, Escape)capture-pane -p to see current screen stateCommon tmux key names:
Enter - Return/newlineEscape - ESC keyC-c - Ctrl+CC-x - Ctrl+XUp, Down, Left, Right - Arrow keysSpace - Space barBSpace - BackspaceSpecify working directory when creating session:
tmux new-session -d -s git_session -c /path/to/repo git rebase -i HEAD~3
For easier use, see /home/jesse/git/interactive-command/tmux-wrapper.sh:
# Start session
/path/to/tmux-wrapper.sh start <session-name> <command> [args...]
# Send input
/path/to/tmux-wrapper.sh send <session-name> 'text' Enter
# Capture current state
/path/to/tmux-wrapper.sh capture <session-name>
# Stop
/path/to/tmux-wrapper.sh stop <session-name>
tmux new-session -d -s python python3 -i
tmux send-keys -t python 'import math' Enter
tmux send-keys -t python 'print(math.pi)' Enter
tmux capture-pane -t python -p # See output
tmux kill-session -t python
tmux new-session -d -s vim vim /tmp/file.txt
sleep 0.3 # Wait for vim to start
tmux send-keys -t vim 'i' 'New content' Escape ':wq' Enter
# File is now saved
tmux new-session -d -s rebase -c /repo/path git rebase -i HEAD~3
sleep 0.5
tmux capture-pane -t rebase -p # See rebase editor
# Send commands to modify rebase instructions
tmux send-keys -t rebase 'Down' 'Home' 'squash' Escape
tmux send-keys -t rebase ':wq' Enter
Problem: Capturing immediately after new-session shows blank screen
Fix: Add brief sleep (100-500ms) before first capture
tmux new-session -d -s sess command
sleep 0.3 # Let command initialize
tmux capture-pane -t sess -p
Problem: Commands typed but not executed
Fix: Explicitly send Enter
…
Audit codebases to find semantically duplicate functions with different names or implementations.
Use MCP services on demand via CLI without preloading extra context.
Create isolated workspaces for feature development without disturbing current code.
Implement features and fixes by writing tests before production code.
Clarify intent, requirements, and solution direction before any creative implementation work.
Set conversation rules to discover and invoke skills before replying.
Control tmux sessions and panes to automate interactive terminal workflows.
Programmatically manage tmux sessions, windows, and panes for terminal automation.
Let AI safely control tmux sessions, windows, and panes for terminal automation.
Run commands and control a persistent tmux terminal session remotely.
Control Neovim in tmux so AI can automate editing and development tasks.
Let AI run commands in a shared tmux terminal with live human visibility.