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

# console

> Open an interactive shell in a sandbox

## `bonya console [sandbox]`

> [!NOTE]
>
> Aliases: `sh`, `shell`

Opens an interactive shell in a sandbox — the command you want most of the time.

```shell theme={null}
bonya console            # pick a sandbox, then attach
bonya console web        # by name
bonya console sbx-1a2b…  # by id
```

The sandbox argument accepts a name or id interchangeably — see [Sandbox resolution](https://docs.bonya.ai/cli-reference/overview.md#how-resolution-works) for exactly how that's decided. Omit it to pick from a list of your sandboxes.

## What it does

1. **Resumes the sandbox** if it's currently suspended, with a spinner while it wakes. Attaching would trigger the wake anyway, but doing it explicitly first means the wait is visible instead of looking like a hang.
2. **Attaches to the sandbox's `console` session**, creating it if it doesn't exist yet. `console` is a reserved session name used specifically for this command, so repeated runs of `bonya console` land back in the same session rather than piling up new ones.
3. If a `console` session exists but has already finished (exited, killed, or failed), it's replaced with a fresh one rather than reused.

Leaving the console (Ctrl+D, `exit`, or closing the terminal) detaches from the session — it **keeps running** in the sandbox. Running `bonya console` again reattaches to the same place, replaying any scrollback produced while you were away.

## Flags

| Flag | Default | Description |
| - | - | - |
| `--session` | `console` | Managed session to attach to, instead of the default `console` session. |
| `--by-name` | `false` | Treat the sandbox argument as a name even if it looks like an id. |

Passing `--session` points `console` at a different [managed session](https://docs.bonya.ai/cli-reference/session.md) — useful for keeping a dedicated long-running terminal (say, `dev`) separate from your interactive one.

## Examples

```shell Pick a sandbox interactively theme={null}
bonya console
```

```shell By name theme={null}
bonya console web
```

```shell By id theme={null}
bonya console sbx-4f1c9a2b3c4d5e6f7a8b9c0d1e2f3a4b
```

```shell Attach to a different session theme={null}
bonya console web --session dev
```

> [!NOTE]
>
> For full control over managed sessions — listing them, creating one running a specific command, killing one — see [`bonya session`](https://docs.bonya.ai/cli-reference/session). `console` is a convenient shortcut for the single most common case.


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