> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zocomputer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run command

> Run a single shell command on the computer.

{/* Tool: bash */}

Zo can execute shell commands in a bash session, allowing for system operations, script execution, and command-line automation. Use cases include: System automation (execute scripts, manage files, automate tasks), Data processing (process files, run analysis scripts, manage datasets), Environment setup (install packages, configure environments).

## Parameters

<ParamField path="cmd" type="string" required={true}>
  The shell command string to execute.
</ParamField>

<ParamField path="cwd" type="string" default={"/home/workspace"}>
  The working directory in which to execute the command. Defaults to the user's workspace root.
</ParamField>

<ParamField path="device" type="string" default={""}>
  Optional fleet device name or id. When set, the command runs inside that running device's container instead of the host (e.g. `psql -c 'SELECT 1'` against a Postgres device). The device must be started first. Requires the 'devices:manage' scope.
</ParamField>

<ParamField path="zapp" type="string" default={""}>
  Optional Zo App slug or id. When set, the command runs inside that Zo App's sandbox instead of the host — the app is a separate computer you have a shell on. Mutually exclusive with 'device'. The app server lives at /zo-app/server.ts (Bun); write private/user-specific data under /user-data (ZO\_APP\_DATA\_DIR) so the app stays cleanly shareable. Requires the 'apps:shell' scope.
</ParamField>

<ParamField path="timeout" type="number" default={0}>
  Optional time limit in seconds. When set, the command is terminated if it runs longer than this. Defaults to unbounded.
</ParamField>

<ParamField path="description" type="string" default={""}>
  Optional short human-readable label for the command (shown in the UI). Does not affect execution.
</ParamField>
