# Connect to sandbox (/docs/cli/connect-to-sandbox)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 204 · updated: 2026-07-30 -->
Related: [Authentication in CLI](/docs/cli/auth.md), [Create sandbox](/docs/cli/create-sandbox.md), [Execute commands in sandbox](/docs/cli/exec-command.md), [List sandboxes](/docs/cli/list-sandboxes.md), [Shutdown running sandboxes](/docs/cli/shutdown-sandboxes.md)

You can connect an interactive terminal to an already running sandbox.

<CodeGroup>
  <CodeBlockTabs defaultValue="Terminal" groupId="terminal">
    <CodeBlockTabsList>
      <CodeBlockTabsTrigger value="Terminal">
        Terminal
      </CodeBlockTabsTrigger>
    </CodeBlockTabsList>

    <CodeBlockTab value="Terminal">
      ```bash  terminal 
      e2b sandbox connect <sandbox-id>
      ```
    </CodeBlockTab>
  </CodeBlockTabs>
</CodeGroup>

Unlike the `create` command, `connect` does not kill the sandbox when you disconnect. When you exit the terminal, only your terminal session is closed—the sandbox continues running.

Once connected, you can inspect the sandbox filesystem and processes to debug or experiment, or use it as a dedicated environment for running agents instead of your local computer.
