WEBINARLive webinar: Terraform in Buddy, Oct 21st.Terraform: plan, approve, apply with state in Buddy. Live on October 21st.Save your seat

bdy target exec

View as Markdown
$bdy target exec [options] [command]

Run commands on a target and manage executions

OPTIONS
--context <name>
Connection and scope context: default, git, link or a saved name. Overrides the globally active context for this invocation.
--examples
Show only examples; with this flag --format accepts text, json or jsonl
--verbose
Show REST API requests, responses, timing and retries on stderr
-h, --help
display help for command
AVAILABLE COMMANDS
Execute a command on a target Required scopes: TARGET_USE
Cancel a running execution Required scopes: TARGET_USE
List target executions Required scopes: TARGET_READ
Show execution logs Required scopes: TARGET_READ
Show the status of an execution Required scopes: TARGET_READ

Documentation for bdy v1.25.20

Last modified on Oct 14, 2026

Examples

Return the execution state using semantic exit codes
bdy target exec command target-identifier "SELECT 1" --exit-code$
Run a command on a target and print its output
bdy tg exec command target-identifier "ls -la"$
Run SQL on a MySQL target
bdy tg exec command target-identifier "SELECT 1"$
Start a command in background and return the execution id
bdy tg exec command target-identifier "ls -la" --async$
Run a command from a file
bdy tg exec command target-identifier --file ./query.sql$
Print the result with execution metadata as JSON
bdy tg exec command target-identifier "SELECT 1" --format json$
Cancel running execution
bdy tg exec kill exec-id$
Cancel running execution and automatically confirm
bdy tg exec kill exec-id -f$
List executions of a target
bdy tg exec ls target-identifier$
List last 5 executions
bdy tg exec ls target-identifier --limit 5$
Return the execution state using semantic exit codes
bdy target exec logs exec-id --exit-code$
Show logs of execution
bdy tg exec logs exec-id$
Show logs of execution starting from line 100
bdy tg exec logs exec-id --offset 100$
Return log records as JSONL
bdy target exec logs execution-id --format jsonl$
Return the execution state using semantic exit codes
bdy target exec status exec-id --exit-code$
Show status of execution
bdy tg exec status exec-id$