Skip to main content
Execute shell commands in HopX sandboxes using the cmd command. Run commands synchronously or in the background with full control over execution environment.

Command Syntax

Subcommands

run

Run a shell command synchronously. Syntax:
Arguments:
  • SANDBOX_ID - Sandbox ID (required)
  • COMMAND - Shell command to execute (required)
Options:
  • --timeout INTEGER - Command timeout in seconds
  • --workdir TEXT - Working directory for command execution
  • --env TEXT - Environment variable in KEY=VALUE format (repeatable)
  • --background - Run command in background (returns immediately)
  • --output, -o FORMAT - Output format: table, json, plain (default: table)
Examples:
Expected Output:
Expected Output (JSON):
Exit Codes:
  • 0 - Success
  • 1 - Command execution error
  • 3 - Authentication error
  • 4 - Sandbox not found
  • 5 - Timeout

exec

Execute a shell command (alias for run). Syntax:
Same as run command. See run for options and examples.

Shell Scripting Examples

Install Dependencies

Run Tests

Background Process

Chain Commands

Next Steps