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

# Use a sandbox from your terminal

> Install the vms command line tool, sign in with your browser, create a sandbox, run a command, copy a file, connect with SSH, and delete the sandbox.

In this tutorial, you use the `vms` command line tool to create a sandbox, run a command in it, copy a file, open SSH, and delete the sandbox.

Use a sandbox from the terminal with the vms CLI.

Use the vms CLI. Check that I am signed in with vms ls.
Create a small sandbox with vms new, run a command in it with vms exec,
copy a file into it with vms cp, and delete it with vms rm at the end.
Do not ask me to share my API key.

## Before you start

* Your workspace needs a plan or a trial. See [Choose a plan or start a trial](https://vms.dev/docs/workspace/billing.md).
* You need the **Owner** or **Admin** role in the workspace to sign in with your browser. A member can sign in with an API key. See [Sign in](https://vms.dev/docs/reference/cli.md#sign-in).
* You need Homebrew on macOS or Linux. To install without Homebrew, see [Install](https://vms.dev/docs/reference/cli.md#install).

**1. Install the CLI**

```bash theme={null}
brew install vms-dev-org/tap/vms
vms --version
```

**2. Sign in**

```bash theme={null}
vms login
```

The CLI shows a code and opens a page in your browser. Check that the page shows the same code, and choose **Approve**. The CLI saves an API key for your workspace.

**3. Create a sandbox**

```bash theme={null}
vms new agent-42
```

The CLI waits until the sandbox is `running`, and writes its ID.

**4. Run a command**

```bash theme={null}
vms exec agent-42 -- uname -a
vms exec agent-42 'echo hello > /home/user/hello.txt && cat /home/user/hello.txt'
```

The CLI streams the output, and exits with the exit code of the command.

**5. Copy a file**

```bash theme={null}
echo "notes" > notes.txt
vms cp notes.txt agent-42:/home/user/
vms cp agent-42:/home/user/hello.txt ./hello.txt
```

**6. Open a shell**

```bash theme={null}
vms ssh agent-42
```

The CLI adds your public key to the sandbox and the host key of `ssh.vms.dev` to `~/.ssh/known_hosts`. Type `exit` to close the shell.

**7. Delete the sandbox**

```bash theme={null}
vms rm agent-42
```

This deletes the sandbox and its files. You cannot undo this.

## Check the result

Run `vms ls`. The list does not show `agent-42`.

## Next steps

* See each command and its options in the [CLI reference](https://vms.dev/docs/reference/cli.md).
* Stop a sandbox and resume it later with its files. See [Stop and resume a sandbox](https://vms.dev/docs/sandboxes/stop-and-resume.md).
* Make many copies of one sandbox with `vms fork`. See [Fork a sandbox](https://vms.dev/docs/sandboxes/fork.md).
* Use a sandbox from code. See [Use a sandbox from TypeScript](https://vms.dev/docs/sdk-quickstart.md).

Read the [changelog.](https://vms.dev/docs/changelog.md)


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