Skip to the workspace
Pebellslearn by building
Using Claude Code  ›  Lesson

Slash Commands, Bang and Backslash

Slash Commands (/) 12 minIn the prompt box a leading slash runs a Claude Code command, a leading exclamation mark runs a shell command whose output joins the conversation, and a backslash before Enter starts a new line.

claude code / Slash Commands, Bang and Backslash

Explore each scene at your own pace.

01 · The rule

The rule

Slash Commands, Bang and Backslash

The prompt box takes more than requests for Claude. A slash talks to Claude Code itself, an exclamation mark talks to your shell, and a backslash lets you keep typing on a new line. Knowing which one you need saves turns and tokens.

The rule

Slash talks to the tool, bang talks to the shell, words talk to Claude.

Slash commands control the session instead of asking the model anything. Type / to see the full list. Everyday ones:

Command Use it to
/help See the commands and help
/clear Start a fresh conversation
/compact Summarise the conversation to free space
/context See what is filling the context window
/model Switch model
/status Check version, account, model and settings
/cost or /usage Check spending or plan usage
/export Save the conversation to a file or the clipboard
/doctor Check the installation for problems
/exit Leave the session

The same menu also lists custom commands added by your project, your skills or your plugins.

Bang runs a shell command directly. ! pytest -q runs the tests in your shell straight away, without asking Claude to do anything, and the output lands in the conversation so Claude can see it too. It is the fastest way to show Claude real output. Because you typed the command yourself, you own it; Claude is not the one running it.

A backslash, then Enter, starts a new line without sending, for multi-line prompts. Pasting multi-line text works too, and some terminals support other key combinations.

> ! git status
> ! pytest -q
> The failing test above is in the pause feature.\
  Fix it in orders.py only, then run pytest again.
> /context
> /clear
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.