> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-auto-cli-sdk-preview-pr-398.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# vastai execute

Execute a (constrained) remote command on a machine

## Usage

```bash theme={null}
vastai execute id COMMAND
```

## Arguments

<ParamField path="id" type="integer" required>
  id of instance to execute on
</ParamField>

<ParamField path="COMMAND" type="string" required>
  bash command surrounded by single quotes
</ParamField>

## Options

<ParamField path="--schedule" type="string">
  try to schedule a command to run hourly, daily, or weekly. Valid values are HOURLY, DAILY, WEEKLY  For ex. --schedule DAILY
  Allowed values: HOURLY, DAILY, WEEKLY
</ParamField>

<ParamField path="--start_date" type="string" default="2026-06-23">
  Start date/time in format 'YYYY-MM-DD HH:MM:SS PM' (UTC). Default is now. (optional)
</ParamField>

<ParamField path="--end_date" type="string" default="2026-06-30">
  End date/time in format 'YYYY-MM-DD HH:MM:SS PM' (UTC). Default is 7 days from now. (optional)
</ParamField>

<ParamField path="--day" type="parse_day_cron_style">
  Day of week you want scheduled job to run on (0-6, where 0=Sunday) or "\*". Default will be 0. For ex. --day 0
</ParamField>

<ParamField path="--hour" type="parse_hour_cron_style">
  Hour of day you want scheduled job to run on (0-23) or "\*" (UTC). Default will be 0. For ex. --hour 16
</ParamField>

## Examples

```bash theme={null}
vastai execute 99999 'ls -l -o -r'
  vastai execute 99999 'rm -r home/delete_this.txt'
  vastai execute 99999 'du -d2 -h'

available commands:
  ls                 List directory contents
  rm                 Remote files or directories
  du                 Summarize device usage for a set of files

Return value:
Returns the output of the command which was executed on the instance, if successful. May take a few seconds to retrieve the results.
```

## Global Options

The following options are available for all commands:

| Option          | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--url URL`     | Server REST API URL                                   |
| `--retry N`     | Retry limit                                           |
| `--raw`         | Output machine-readable JSON                          |
| `--explain`     | Verbose explanation of API calls                      |
| `--api-key KEY` | API key (defaults to `~/.config/vastai/vast_api_key`) |
