# sandscale sandbox

> sandscale sandbox: Sandboxes. Usage, options and examples, generated from the CLI.

Sandboxes.

[All commands](https://sandscale.dev/docs/reference/cli)

Uses your own Sandscale sign-in (sandscale login).

| Command | What it does |
| --- | --- |
| `list` | Your sandboxes |
| `start` | Start a sandbox (--options: what you may start now) |
| `show` | One sandbox |
| `exec` | Run a command; prints its output and exits with its exit code |
| `files` | List, read and write files in a sandbox |
| `logs` | The sandbox's runs, or one run's output |
| `stop` | Stop a sandbox |
| `run` | Send a folder, run a command, stream its output and exit with its code |
| `spawn` | Start a sandbox, wait until it runs and open a terminal in it |
| `connect` | A terminal in a running sandbox |
| `metrics` | A sandbox's CPU, memory and disk use |
| `template` | Sandbox templates: an image pinned by digest and its default size |

## `sandscale sandbox list`

Your sandboxes.

```
sandscale sandbox list: Your sandboxes

Usage:
  sandscale sandbox list [--limit N] [--cursor C] [--json]

Examples:
  sandscale sandbox list
```

## `sandscale sandbox start`

Start a sandbox (--options: what you may start now).

```
sandscale sandbox start: Start a sandbox (--options: what you may start now)

Usage:
  sandscale sandbox start [--template ID] [--name NAME] [--ttl 1h] [--network none] [--mem MB] [--cpus N] [--label KEY=VALUE]... [--json]
  sandscale sandbox start --options [--json]

Examples:
  sandscale sandbox start --options
  sandscale sandbox start --template python-3.12 --ttl 1h --network none
```

## `sandscale sandbox show`

One sandbox.

```
sandscale sandbox show: One sandbox

Usage:
  sandscale sandbox show ID [--json]

Examples:
  sandscale sandbox show sbx_9
```

## `sandscale sandbox exec`

Run a command; prints its output and exits with its exit code.

```
sandscale sandbox exec: Run a command; prints its output and exits with its exit code

Usage:
  sandscale sandbox exec ID [--workdir DIR] [--timeout SECONDS] [--stdin] [--json] -- COMMAND [ARGS...]

Examples:
  sandscale sandbox exec sbx_9 -- python -V
  sandscale sandbox exec sbx_9 --workdir /work -- make test
```

## `sandscale sandbox files`

List, read and write files in a sandbox.

```
sandscale sandbox files: List, read and write files in a sandbox

Usage:
  sandscale sandbox files ls ID PATH [--json]
  sandscale sandbox files get ID PATH [--out FILE] [--json]
  sandscale sandbox files put ID PATH --from FILE [--mode 0644]

Commands:
  ls   List a directory
  get  Read a file
  put  Write a file

Examples:
  sandscale sandbox files ls sbx_9 /work
  sandscale sandbox files put sbx_9 /work/data.csv --from ./data.csv
```

## `sandscale sandbox logs`

The sandbox's runs, or one run's output.

```
sandscale sandbox logs: The sandbox's runs, or one run's output

Usage:
  sandscale sandbox logs ID [--run RUN_ID] [--json]

Examples:
  sandscale sandbox logs sbx_9 --run run_3
```

## `sandscale sandbox stop`

Stop a sandbox.

```
sandscale sandbox stop: Stop a sandbox

Usage:
  sandscale sandbox stop ID [--json]

Examples:
  sandscale sandbox stop sbx_9
```

## `sandscale sandbox run`

Send a folder, run a command, stream its output and exit with its code.

```
sandscale sandbox run: Send a folder, run a command, stream its output and exit with its code

Usage:
  sandscale sandbox run [--sandbox ID | --template ID [--ttl 1h] [--network none] [--mem MB] [--cpus N] [--label KEY=VALUE]... [--keep]] [--sync DIR [--to /workspace] [--dry-run]] [--workdir DIR] [--timeout SECONDS] [--json] -- COMMAND [ARGS...]

Without --sandbox it starts a sandbox, waits until it runs and stops it afterwards (--keep leaves it running). --sync sends the folder first (to /workspace unless --to says otherwise) and runs the command there. It leaves out what .gitignore and a .neuralinverseignore at the top of the folder leave out, .git, node_modules and symbolic links, and never sends a secret or environment file (.env*, keys, credentials, cloud and registry tokens, Terraform state): those are listed by rule and path, never shown. --dry-run lists what would be sent and sends nothing. Ctrl+C cancels the run.

Examples:
  sandscale sandbox run --sync . -- make test
  sandscale sandbox run --sync . --template python-3.12 -- pytest -q
  sandscale sandbox run --sync . --dry-run -- true
  sandscale sandbox run --sandbox sbx_9 --sync ./app --to /workspace/app -- npm test
```

## `sandscale sandbox spawn`

Start a sandbox, wait until it runs and open a terminal in it.

```
sandscale sandbox spawn: Start a sandbox, wait until it runs and open a terminal in it

Usage:
  sandscale sandbox spawn [TEMPLATE] [--name NAME] [--ttl 1h] [--network none] [--mem MB] [--cpus N] [--label KEY=VALUE]... [--no-connect] [--json]

The terminal needs Sandscale to offer one (start --options, features.terminal); without it spawn starts nothing. --no-connect starts the sandbox and waits until it runs.

Examples:
  sandscale sandbox spawn python-3.12
  sandscale sandbox spawn python-3.12 --ttl 2h --no-connect
```

## `sandscale sandbox connect`

A terminal in a running sandbox.

```
sandscale sandbox connect: A terminal in a running sandbox

Usage:
  sandscale sandbox connect ID

Needs a terminal and Sandscale to offer one in sandboxes; exits with the shell's exit code.

Examples:
  sandscale sandbox connect sbx_9
```

## `sandscale sandbox metrics`

A sandbox's CPU, memory and disk use.

```
sandscale sandbox metrics: A sandbox's CPU, memory and disk use

Usage:
  sandscale sandbox metrics ID [--follow] [--interval 5s] [--json]

--follow prints new samples as they come (one JSON object per line with --json).

Examples:
  sandscale sandbox metrics sbx_9
  sandscale sandbox metrics sbx_9 --follow --interval 10s
```

## `sandscale sandbox template`

Sandbox templates: an image pinned by digest and its default size.

```
sandscale sandbox template: Sandbox templates: an image pinned by digest and its default size

Usage:
  sandscale sandbox template init [--name NAME] [--image REF] [--file FILE] [--force] [--json]
  sandscale sandbox template build [--file FILE] [--name NAME] [--version 1.0.0] [--image REF] [--cpus N] [--mem MB] [--disk MB] [--json]
  sandscale sandbox template list [--json]
  sandscale sandbox template delete NAME|ID [--yes] [--json]

init writes neuralinverse.sandbox.json and sends nothing. Sandscale builds no images: build and push the image yourself, set image to its reference pinned by digest (name@sha256:...), then template build registers it.

Commands:
  init    Write the template file in this folder (nothing is sent)
  build   Register the template the file (and the options) describe
  list    The templates you may use
  delete  Delete a template (by name or id); asks first unless --yes

Examples:
  sandscale sandbox template init
  sandscale sandbox template build
  sandscale sandbox template list
  sandscale sandbox template delete my-app --yes
```

## Examples

```
sandscale sandbox run --sync . -- make test
sandscale sandbox start --template python-3.12
sandscale sandbox exec sbx_9 -- python -V
```

Exit codes: 0 done (exec and run: the command's code), 1 failed, 2 usage, 3 no session, 4 refused, 5 not found, 6 conflict, 7 rate limited.

This page is generated from the sandscale CLI's command registry. Do not edit it by hand.

---
Source: https://sandscale.dev/docs/reference/cli/sandbox
