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

# Remote Shell

The CLI's `connect` command attaches an interactive terminal — a **Remote Shell** — to an already-running sandbox. It opens a real shell inside the sandbox over a PTY, streaming your keystrokes in and the shell's output back, so you can run commands, inspect state, and debug as if you were sitting at the sandbox's terminal.

<Warning>
  **Note:** The sandbox must already be running. `connect` attaches to an existing sandbox by its ID; it does not create one. Disconnecting leaves the sandbox and any other users' sessions untouched.
</Warning>

***

## Prerequisites

Set your API key in the environment before connecting:

```bash CLI icon="terminal" theme={"system"}
export NOVITA_API_KEY=<your API key>
```

***

## Usage

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli sandbox connect <sandboxID>

# Using the short aliases (sandbox → sbx, connect → cn)
novita-sandbox-cli sbx cn <sandboxID>
```

| Item     | Value             | Description                                        |
| -------- | ----------------- | -------------------------------------------------- |
| Command  | `sandbox connect` | Connect a terminal to an already-running sandbox   |
| Alias    | `sbx cn`          | Short form of `sandbox connect`                    |
| Argument | `<sandboxID>`     | ID of the running sandbox to connect to (required) |

On connect, the CLI prints the sandbox's dashboard inspect URL and a confirmation line, then hands your terminal over to the sandbox shell:

```text Output icon="code" theme={"system"}
Terminal connecting to sandbox <sandboxID>
user@sandbox:~$ 
```

***

## Ending the session

Exit the shell as you normally would — type `exit` or press **Ctrl+C**. The CLI cleans up the terminal, closes the connection, and prints:

```text Output icon="code" theme={"system"}
Closing terminal connection to sandbox <sandboxID>
```

<Note>
  **Note:** Disconnecting only ends your terminal session. It does not stop or kill the sandbox, and it does not disconnect other users connected to the same sandbox.
</Note>
