> ## Documentation Index
> Fetch the complete documentation index at: https://opensandbox-oc-s-762ac928075c46d2828bcb22.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox Management

> Create, manage, and control sandbox lifecycles from the CLI

## Creating a Sandbox

`oc create` (shortcut for `oc sandbox create`) provisions a new sandbox VM:

```bash theme={null}
oc create
oc create --timeout 600 --cpu 2 --memory 2048 --env NODE_ENV=production
```

The sandbox ID is printed on success. Use `--json` to capture it programmatically:

```bash theme={null}
ID=$(oc create --json | jq -r '.sandboxID')
```

## Listing & Inspecting

```bash theme={null}
# List all sandboxes
oc ls

# Detailed info for a specific sandbox
oc sandbox get sb-abc123
```

`oc ls` shows a table with ID, template, status, CPU, memory, and age. Add `--json` for machine-readable output.

## Hibernation & Wake

Save state and stop paying for compute. Wake resumes the same sandbox — the platform attempts fast snapshot restore with a cold-boot fallback if needed.

```bash theme={null}
oc sandbox hibernate sb-abc123

# ... hours later ...
oc sandbox wake sb-abc123
oc shell sb-abc123
```

The sandbox keeps the same ID across hibernate/wake cycles. Preview URLs remain active.

## Adjusting Timeout

The idle timeout resets on every operation (exec, file access, agent activity). Default: `0` — persistent, never auto-hibernates. Set a positive value (or `0` to disable) with `oc sandbox set-timeout`.

```bash theme={null}
oc sandbox set-timeout sb-abc123 3600  # 1 hour
```

## Killing a Sandbox

```bash theme={null}
oc sandbox kill sb-abc123
```

All data is lost unless you've created a [checkpoint](/cli/checkpoint) first.

## Common Patterns

### Create and Shell In

```bash theme={null}
oc shell $(oc create --json | jq -r '.sandboxID')
```

### Filter Running Sandboxes

```bash theme={null}
oc ls --json | jq '.[] | select(.status == "running") | .sandboxID'
```

### Batch Cleanup

```bash theme={null}
oc ls --json | jq -r '.[].sandboxID' | xargs -I{} oc sandbox kill {}
```

<Tip>
  SDK usage: [Sandboxes](/sandboxes/overview). Full flags: [CLI Reference](/reference/cli#oc-sandbox).
</Tip>
