tmux Scripting, Formats, and Automation/Send a command into a pane

Programmatically run startup commands.

Section: Repeatable workspaces

Send a command into a pane

bash
bash
tmux send-keys -t api:editor "npm run dev" C-m
Explanation

Use `C-m` to send Enter after the command.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Repeatable workspaces
Build a session in the background
Create a detached session before laying out windows.
OpenIn sheetbashsame section
Focus a specific window
Choose the window users should see first.
OpenIn sheetbashsame section
Attach after setup
Open the session after all windows and panes are ready.
OpenIn sheetbashsame section
List windows with a custom format
Print a compact machine-friendly window summary.
OpenIn sheetbash1 tag match
List panes with path and command
Inspect pane metadata.
OpenIn sheetbash1 tag match
Print a format string
Evaluate a format without changing the UI.
OpenIn sheetbash1 tag match