---
title: The Shell and REPL
summary: Use the interactive shell, tab completion, history, help and the REPL.
icon: phosphor-duotone:terminal-window
tags: [course]
---

In this lesson you will open the CommandBox interactive shell, learn the shortcuts that save typing, and try the REPL for quick experiments.

## One-off commands and the shell

Every command so far started with `box`. That runs a single command and returns you to your normal terminal:

```bash
box version
```

Run `box` on its own to open the interactive shell:

```bash
box
```

Inside the shell you can drop the `box` prefix. These two lines do the same thing:

```bash
box version
version
```

Type `exit` (or press Ctrl-D) to leave the shell.

## Tab completion

Press Tab to complete commands, namespaces and parameters. At an empty prompt, Tab lists every top level command. Keep pressing Tab to cycle through the options and press Enter to pick one.

## History

Press the up arrow to step back through earlier commands. Type the start of a command first, such as `cd`, and the up arrow only shows history that starts with it. The `history` command prints everything you have run:

```bash
history
```

## Getting help

```bash
help
help install
install help
```

`help` alone lists commands. Add a command or namespace to see its parameters and examples. Appending `help` to the end of a command works too.

## The REPL

The `repl` command evaluates code line by line, and variables stay available until you exit:

```bash
repl
```

To run a single expression and return immediately, pass it as input:

```bash
repl input="1+1"
```

!!! note
    Inside the REPL, type `exit` to get back to the shell.

## Recap

- `box` opens the shell, and inside it you can drop the `box` prefix.
- Tab completes, the up arrow recalls history, and `help` explains any command.
- `repl` gives you a quick code scratchpad, and `repl input="..."` runs one expression.
