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

# devbox session

> List and connect to terminal sessions on a Devbox.

Use `devbox session` to list persistent terminal sessions on a running Devbox or connect to a named session. Connecting activates the selected Devbox.

<h2 id="session-usage">
  Usage
</h2>

```bash theme={null}
devbox session [command]
```

## `devbox session connect`

Connect to a named tmux session. If you omit `--session`, the CLI prompts you to select an existing session or enter a name for a new one. A non-interactive invocation must provide a session name.

<h3 id="connect-usage">
  Usage
</h3>

```bash theme={null}
devbox session connect [devbox-name] [flags]
```

### Connect to a named session

```bash theme={null}
devbox session connect main --session server
```

<h3 id="connect-options">
  Options
</h3>

<ResponseField name="--devbox" type="string">
  Select a Devbox by name or ID instead of using the positional argument.
</ResponseField>

<ResponseField name="--session" type="string">
  Connect to this terminal session. The session is created if it does not exist.
</ResponseField>

<ResponseField name="--show-all" type="boolean" default="false">
  Include Devboxes owned by other workspace members when selecting a Devbox.
</ResponseField>

***

## `devbox session list`

List terminal sessions on a running Devbox. The default table contains each session's name and creation time. JSON output also includes the command when the session has one.

<h3 id="list-usage">
  Usage
</h3>

```bash theme={null}
devbox session list [devbox-name] [flags]
```

### List sessions as JSON

```bash theme={null}
devbox session list main --output json
```

When no sessions exist, the default output is:

```text Output nocopy theme={null}
No terminal sessions.
```

<h3 id="list-options">
  Options
</h3>

<ResponseField name="-o, --output" type="string">
  Set the output format to `json`. Leave empty for a table.
</ResponseField>

<ResponseField name="--show-all" type="boolean" default="false">
  Include Devboxes owned by other workspace members when selecting a Devbox.
</ResponseField>

## Related topics

<Columns cols={2}>
  <Card title="Terminal sessions" icon="square-terminal" href="/docs/devbox/sessions">
    Create and use persistent sessions.
  </Card>

  <Card title="Execute commands" icon="terminal" href="/docs/devbox/exec">
    Run non-interactive retained executions.
  </Card>
</Columns>
