Interactive terminal control via tmux for TUI apps, prompts, and long-running CLI workflows.
Use tmux to drive interactive terminal sessions, including TUI workflows like ralph-tui. tmux lets you send keystrokes, capture screen output, and keep processes running between steps.
ralph-tui or any interactive CLI promptstmux installed (pre-installed on macOS)Verify:
tmux -V
Create a detached session:
tmux new-session -d -s <name>
Send commands (append Enter to execute):
tmux send-keys -t <name> "<command>" Enter
Capture screen output:
tmux capture-pane -t <name> -p
Kill session when done:
tmux kill-session -t <name>
Use send-keys with key names:
EnterC-c (Ctrl-C)C-d (Ctrl-D)TabEscapeUp, Down, Left, RightExamples:
tmux send-keys -t <name> Up
tmux send-keys -t <name> C-c
tmux new-session -d -s ralph-tui
tmux send-keys -t ralph-tui "cargo run -p ralph-tui" Enter
tmux send-keys -t ralph-tui Down
tmux send-keys -t ralph-tui Enter
tmux capture-pane -t ralph-tui -p -S -200
Use -S -200 to capture the last 200 lines when the screen is noisy.
capture-pane to confirm health (look for "listening" or "ready" text).C-c then kill-session.Example:
tmux new-session -d -s ralph-web
tmux send-keys -t ralph-web "cargo run -p ralph-cli -- web" Enter
tmux capture-pane -t ralph-web -p | rg -n "listening|ready"
tmux send-keys -t ralph-web C-c
tmux kill-session -t ralph-web