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

bdy sandbox exec command

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

Execute a command in sandbox. Commands run as buddy with passwordless sudo. Use sudo for package installs Required scopes: SANDBOX_WRITE

ARGUMENTS
identifier
Sandbox identifier (required)
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
-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
--scope <scope>
Force scope (WORKSPACE, PROJECT, ENVIRONMENT). By default calculated by provided options and environmental variables (--project,
--environment
BUDDY_PROJECT, linked project)
-e, --environment <identifier>
Environment identifier
--runtime <runtime>
Command runtime: BASH, JAVASCRIPT, TYPESCRIPT, PYTHON (default: BASH)
--wait
Wait until operation completes
--format <text|jsonl>
Output format: jsonl, text. JSONL CLI errors: {type:"error",error:{code,message,hint}}, exit 1 (2 or 3 with --exit-code). Default: text (choices: "text", "jsonl")
--exit-code
Use semantic exit codes: 0 success, 1 unsuccessful, 2 command error, 3 not found, 8 pending
-h, --help
display help for command

Documentation for bdy v1.25.20

Last modified on Oct 14, 2026

Examples

Return the execution state using semantic exit codes
bdy sandbox exec command sandbox-identifier "echo hello" --exit-code$
Ran command in sandbox
bdy sb exec command sandbox-identifier "ls -la"$
Ran command in sandbox and wait for it to complete
bdy sb exec command sandbox-identifier "sleep 10" --wait$
Install package from apt
bdy sb exec command sandbox-identifier "sudo apt-get update && sudo apt-get install -y nginx" --wait$
Return log records as JSONL
bdy sandbox exec cmd my-sandbox "echo hello" --wait --format jsonl$