# CLI Commands

Build your sandbox with our CLI. {{ className: 'lead' }}

<Note>
You can use `--help` flag for more information about commands.
</Note>

## `build`

Builds a sandbox template defined by `./e2b.Dockerfile` or `./Dockerfile` from the root directory.
By default, the root directory is the current working directory.
This command also creates the `e2b.toml` config.

```bash
e2b build
```

<Note>
Running `e2b build` without specifying a template with the `[template]` argument will rebuild template defined by the `e2b.toml` config.

If there is no `e2b.toml` config a new template will be created.
</Note>

#### **Arguments**

<Options>
  <Option type="[template]">
    Specify the template you want to rebuild. You can use the template name or ID.
  </Option>
</Options>


#### **Options**

<Options>
  <Option type="-c, --cmd" name="start-command">
    Specify the command that should be running when a sandbox starts.
  </Option>
  <Option type="-n, --name" name="template-name">
    Specify the name of the sandbox template. You can use the template name to start the sandbox in the SDK. The name must be lowercase and contain only letters, numbers, dashes, and underscores.
  </Option>
  <Option type="-p, --path" name="path">
    Change the root directory where the command is executed to the `path` directory.
  </Option>
  <Option type="-d, --dockerfile" name="dockerfile">
    Specify the path to Dockerfile. By default E2B tries to find `e2b.Dockerfile` or `Dockerfile` in the root directory.
  </Option>
</Options>

---

## `init`

Creates a basic Dockerfile (`./e2b.Dockerfile`) in current directory.
You can then run `e2b build` to build sandbox template from this Dockerfile.

```bash
e2b init
```

#### **Options**

<Options>
  <Option name="path" type="-p, --path">
    Change the root directory where the command is executed to `path` directory.
  </Option>
</Options>

---

## `delete`

Delete the sandbox template specified by the `[template]` argument, `e2b.toml` config in the working directory, or by an interactive selection.
By default, the root directory is the current working directory.

This command also deletes the `e2b.toml` config.

```bash
e2b delete
```

<Note>
Running `e2b delete` without specifying a template with the `[template]` argument will delete the template defined by the `e2b.toml` config.
</Note>

#### **Arguments**

<Options>
  <Option type="[template]">
    Specify the template you want to delete. You can use the template name or ID.
  </Option>
</Options>


#### **Options**

<Options>
  <Option type="-p, --path" name="path">
    Change the root directory where the command is executed to the `path` directory.
  </Option>
  <Option type="-s, --select">
    Interactively select sandbox templates you want to delete.
  </Option>
  <Option type="-y, --yes">
    Don't ask for confirmation before deleting the sandbox template.
  </Option>
</Options>

---

## `list`

List your sandbox templates.

```bash
e2b list
```

---

## `login`

Log in to the CLI. It will save your access token in `~/.e2b` file.

```bash
e2b login
```

---

## `logout`

Log out of the CLI. It will remove your access token from `~/.e2b` file.

```
e2b logout
```

---

## `shell`

Spawns a sandbox and connects your terminal to the sandbox.
This command can be used to debug your sandbox template.
It works similar to the `docker run -it <image> bash` command.

```bash
e2b shell
```

<Note>
Running `e2b shell` without specifying a template with the `[template]` argument will spawn sandbox defined by the `e2b.toml` config.
</Note>

#### **Arguments**

<Options>
  <Option type="[template]">
    Specify the template you want to spawn sandbox from. You can use the template name or ID.
  </Option>
</Options>


#### **Options**

<Options>
  <Option name="path" type="-p, --path">
    Change the root directory where the command is executed to `path` directory.
  </Option>
</Options>

### Next steps

1. [Create your first sandbox template](/sandbox/templates/overview)
1. [Check out the official guides](/guides/custom-sandbox)
{/* 1. [Follow the "Hello World" example](/guides/) */}
