# ssh div.io

> Reference for the commands at the ssh div.io prompt, which manage sandboxes, keys, orgs, plans and credit with only ssh.

## Synopsis

```text
ssh div.io                       # the prompt
ssh div.io <command> [flags]     # one command, then exit
ssh <sandbox>@div.io [command]   # a shell on a sandbox
```

Your SSH key is your account. To sign up, see [Use a sandbox over SSH](https://docs.divergentlabs.xyz/sandboxes/ssh.md#sign-up).

Every command accepts `--json`, which prints the full API response.

## Commands

| Command | Description |
| --- | --- |
| `new [--name <name>] [--size <size>] [--secret <NAME>]... [--environment <env>] [--idle <duration>]` | Create a sandbox and start it. `--secret` is read from `--environment`, `default` unless given. At the prompt with a terminal, open a shell on it; `exit` returns to the prompt. Flags and defaults are the same as [`div sandbox create`](https://docs.divergentlabs.xyz/sandboxes/cli/sandbox.md#create). |
| `ls [--all]` | List the org's sandboxes. `--all` includes deleted ones. |
| `set <name> --idle <duration>` | Change the idle timeout. `0` means never. |
| `stop <name>` | Stop a sandbox, keeping its files and processes. |
| `resume <name>` | Resume a stopped sandbox. |
| `fork <name> [--name <new>]` | Create a new running sandbox with a copy of the files. |
| `rm <name>` | Delete a sandbox permanently. |
| `keys` | List the SSH keys that sign in to your account. |
| `keys rm <fingerprint>` | Remove a key. |
| `org` | List the orgs you belong to. |
| `org <slug>` | Switch to another org for this session. |
| `plan` | List the plans, with the org's current plan marked. |
| `plan <name>` | Print a Checkout link to subscribe to `personal`, `team` or `platform`. On a paid plan, print a billing portal link to change or cancel it. Requires an owner or admin role. |
| `credit` | Show the org's remaining credit. |
| `credit add [dollars]` | Add credit, $10 to $10,000. Charges the card on file, or prints a Checkout link if there is none. Requires an owner or admin role. Default $10. |
| `browser` | Print a one-time link that signs a browser in to the dashboard. Valid for 10 minutes. |
| `whoami` | Show the account and org this key signs in as. |
| `tour` | Show the introduction to sandboxes and pricing again. Works without an account. |
| `help` | List the commands. |
| `exit` | Close the session. |

## Shell on a sandbox

```bash
ssh agent-box@div.io
ssh agent-box@div.io 'cd app && npm test'
scp ./app.py agent-box@div.io:/root/app.py
sftp agent-box@div.io
```

- The username is the sandbox's name, in any org you belong to.
- Commands run as root.
- A stopped sandbox: with a terminal, you are asked whether to resume it. Without one, the command exits 1.
- These sessions are not end-to-end encrypted. For end-to-end encryption, use [`div sandbox ssh`](https://docs.divergentlabs.xyz/sandboxes/cli/sandbox.md#ssh).

## Exit codes

| Code | When |
| --- | --- |
| the command's own | A command run on a sandbox |
| `0` | The command succeeded. |
| `1` | The request was refused. The message gives the reason. |
| `2` | A command or flag was typed wrong. |

These match [every `div` command](https://docs.divergentlabs.xyz/compute/cli/exit-codes.md).
