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

# `disk` CLI

> Reference for the Node CLI that creates disks, runs `disk exec`, and manages API keys.

The [`disk`](https://www.npmjs.com/package/disk) npm package ships a CLI under the same name. Run it with `npx disk` from any machine that has Node, with no install required and no platform restrictions. Use it to create disks, list and inspect them, manage who can mount them, and run [serverless commands](https://docs.archil.com/compute/serverless-execution.md) against the data, all from a script, CI job, or your terminal. For a step-by-step walkthrough, see the [Quickstart](https://docs.archil.com/getting-started/quickstart.md).

```bash theme={null}
npx disk <command> [options]
```

`disk` talks to the Archil control plane over HTTPS. It has no native dependencies and works on any platform Node.js does. This page is a reference for every command it accepts; for a walkthrough, see the [Quickstart](https://docs.archil.com/getting-started/quickstart.md).

## Authentication

`disk` reads credentials from environment variables or flags:

| | Env var | Flag |
| - | - | - |
| API key | `ARCHIL_API_KEY` | `-k`, `--api-key` |
| Region | `ARCHIL_REGION` | `-r`, `--region` |

API keys are account-level credentials. They are **not** the same as disk tokens — see the [disk users concept page](https://docs.archil.com/concepts/authorization.md#token-based-disk-authorization).

## Disks

### `disk list`

List the disks in the current region.

```bash theme={null}
npx disk list [--limit <n>] [-o table|json]
```

Outputs a box-drawing table by default; `-o json` emits an array suitable for piping into `jq`.

### `disk get <id>`

Show details for a disk: status, region, mounts, authorized users, connected clients.

```bash theme={null}
npx disk get dsk-abc123 [-o table|json]
```

### `disk create <name>`

Create a new disk. The response includes a one-time **disk token** for mounting — save it; it cannot be retrieved again.

```bash theme={null}
npx disk create my-disk
```

### `disk delete <id>`

Delete a disk. This does not delete the underlying bucket data.

```bash theme={null}
npx disk delete dsk-abc123
```

### `disk exec <id> <command...>`

Run a bash command inside a Firecracker microVM with the disk mounted at `/mnt/archil`, which is also the working directory — so relative paths address the disk root. Stdout, stderr, and the exit code from the remote command are forwarded back. See [Serverless Execution](https://docs.archil.com/compute/serverless-execution.md) for the full model.

```bash theme={null}
npx disk exec dsk-abc123 "ls -la && cat config.json"
```

`disk` also accepts the sugar form `disk <id> exec <cmd...>` for ergonomics:

```bash theme={null}
npx disk dsk-abc123 exec "du -sh logs"
```

The CLI process exits with the remote command's exit code, so it composes naturally with shell pipelines and CI step outcomes.

### `disk grep <pattern> <id>[/<path>]`

Search a disk for lines matching a regular expression, using [Search files](https://docs.archil.com/compute/search-files.md). The part of the
target after the first `/` is the directory to search; without it, the whole disk is searched. The target accepts a
disk ID or name. The search is recursive unless you pass `--no-recursive`.

```bash theme={null}
npx disk grep "ERROR|FATAL" dsk-abc123/logs
npx disk grep -i -t py "import pandas" my-disk/src
npx disk grep panic dsk-abc123/logs -C 3 -g '*.log' -g '!archive/**'
```

| Option | Description |
| - | - |
| `-i`, `--ignore-case` | Match regardless of case. |
| `-U`, `--multiline` | Let matches span lines. |
| `-g`, `--glob <glob>` | Search files matching the glob, or skip them with a leading `!`. Repeatable. |
| `-t`, `--type <type>` | Search only files of this ripgrep type, such as `py`. Repeatable. |
| `-T`, `--type-not <type>` | Skip files of this type. Repeatable. |
| `-A`, `--after-context <n>` | Lines of context after each match, up to 10. |
| `-B`, `--before-context <n>` | Lines of context before each match, up to 10. |
| `-C`, `--context <n>` | Lines of context before and after each match, up to 10. |
| `--no-recursive` | Search only the given directory, not its subdirectories. |
| `--max-results <n>` | Stop once this many matches are collected. |
| `--max-duration <seconds>` | Deadline for the whole search, up to 30. |
| `--concurrency <n>` | Maximum parallel workers, up to 100. |
| `-o`, `--output <format>` | `text` (the default) or `json`. |

Text output prints matches as `file:line:text` on stdout, and context lines as `file-line-text` with `--` between
groups, like `rg`. A summary goes to stderr, with a warning when the search did not complete. The command exits `0`
when it finds matches and `1` when it finds none.

## API keys

API keys live at the account level. Manage them with the `api-keys` subcommand.

### `disk api-keys list`

```bash theme={null}
npx disk api-keys list [--limit <n>]
```

### `disk api-keys create <name>`

```bash theme={null}
npx disk api-keys create ci-bot --description "GitHub Actions"
```

The key value is shown once at create time. Save it.

### `disk api-keys delete <id>`

```bash theme={null}
npx disk api-keys delete key-abc123
```

## Global options

```bash theme={null}
npx disk --help
npx disk --version

# Override credentials per-invocation rather than using env vars
npx disk --api-key key-... --region aws-us-east-1 list

# Point at a non-production control plane
npx disk --base-url https://staging.archil.com list
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.