bdy target exec command

View as Markdown
$bdy target exec command|cmd [options] <identifier> [command]

Execute a command on a target

ARGUMENTS
identifier
Target identifier (required)
command
Command to execute on the target (e.g. a SQL query or a shell command) (required)
OPTIONS
-w, --workspace <domain>
Workspace URL handle. Can be set via variable: BUDDY_WORKSPACE
-p, --project <name>
Project name. Can be set via variable: BUDDY_PROJECT
--pipeline <identifier>
Pipeline identifier to scope the target to. Requires --project
--environment <identifier>
Environment identifier to scope the target to. Resolves a workspace environment; add --project to point at a project environment
--async
Start the command and return the execution id without waiting for completion
--file <path>
Read the command from a file instead of the argument
--format <text|json>
Output format: json, text. Default: text
-h, --help
display help for command

Documentation for bdy v1.24.8

Last modified on Sep 3, 2026

Examples

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$