Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

run_shell_command

Run a shell command in a pane with your user’s permissions. Run a shell command in one pane, wait for it to finish, and report its singular real exit status and output. This is the tool for ‘run X and tell me if it worked’. It reaches only the pane you name: the command travels through a tmux buffer, which synchronize-panes does not fan out, so the exit status is one pane’s. Use send_keys when you want a synchronized cohort to receive input. Do NOT send keys and then poll a capture in a loop — this waits deterministically and costs one call. The command runs in a subshell, so cd and export do not persist. It refuses the named pane in a human-owned mode. Check linesMissed and anchorLost. A timed-out command MAY STILL BE RUNNING; inspect it and do not retry it — unless started is false, which means it never ran because something other than an idle shell was reading that pane’s input.

All .NET tools · JSON · Source

Arguments

command required · string
The shell command.
maxLines optional · integer | null
Maximum returned lines.

Default: null.

paneId optional · string | null
A pane id. Omit for the active pane.

Default: null.

suppressHistory optional · boolean
Keep the command out of shell history on a best-effort basis.

Default: false.

timeoutSeconds optional · number | null
Requested timeout in seconds.

Default: null.

Schemas

The schema defines required fields, nested values, defaults, and validation constraints.

Input schema
{
"additionalProperties": false,
"properties": {
"command": {
"description": "The shell command.",
"type": "string"
},
"maxLines": {
"default": null,
"description": "Maximum returned lines.",
"maximum": 2147483647,
"minimum": -2147483648,
"type": [
"integer",
"null"
]
},
"paneId": {
"default": null,
"description": "A pane id. Omit for the active pane.",
"type": [
"string",
"null"
]
},
"suppressHistory": {
"default": false,
"description": "Keep the command out of shell history on a best-effort basis.",
"type": "boolean"
},
"timeoutSeconds": {
"default": null,
"description": "Requested timeout in seconds.",
"type": [
"number",
"null"
]
}
},
"required": [
"command"
],
"type": "object"
}
Output schema
{
"properties": {
"anchorLost": {
"default": false,
"type": "boolean"
},
"effectiveTimeoutSeconds": {
"type": "number"
},
"elapsedSeconds": {
"type": "number"
},
"exitStatus": {
"type": [
"integer",
"null"
]
},
"linesMissed": {
"default": false,
"type": "boolean"
},
"output": {
"properties": {
"droppedBytes": {
"type": "integer"
},
"droppedLines": {
"type": "integer"
},
"lines": {
"items": {
"type": "string"
},
"type": "array"
},
"truncated": {
"type": "boolean"
}
},
"required": [
"lines",
"truncated",
"droppedLines",
"droppedBytes"
],
"type": "object"
},
"paneId": {
"type": "string"
},
"started": {
"default": true,
"type": "boolean"
},
"timedOut": {
"type": "boolean"
}
},
"required": [
"paneId",
"exitStatus",
"timedOut",
"output",
"elapsedSeconds",
"effectiveTimeoutSeconds"
],
"type": "object"
}
Tool annotations
{
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Run shell command"
}
Esc

Type to search.