> ## 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.

## Usage

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox session [command]
```

## `devbox session connect`

Connect to a named terminal session. Sessions use tmux on Linux and macOS, and psmux on Windows. 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.

On Windows, session names are case-insensitive and must be valid filenames without dots or surrounding whitespace.

### Usage

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox session connect [devbox-name] [flags]
```

### Connect to a named session

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox session connect main --session server
```

### Options

**--devbox** `string`

Select a Devbox by name or ID instead of using the positional argument.

**--session** `string`

Connect to this terminal session. The session is created if it does not exist.

**--show\_all** `boolean` (default: false)

Include Devboxes owned by other workspace members when selecting a Devbox.

***

## `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.

### Usage

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox session list [devbox-name] [flags]
```

### List sessions as JSON

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox session list main --output json
```

When no sessions exist, the default output is:

```text Output nocopy theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
No terminal sessions.
```

### Options

**-o, --output** `string`

Set the output format to `json`. Leave empty for a table.

**--show\_all** `boolean` (default: false)

Include Devboxes owned by other workspace members when selecting a Devbox.

## Related topics

> [card] [SSH & Sessions](https://namespace.so/docs/devbox/connecting.md#sessions)
>
> Create and use persistent sessions.

> [card] [Execute commands](https://namespace.so/docs/devbox/exec.md)
>
> Run non-interactive retained executions.


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