# /exit Command

> It closes Claude Code. The session is saved.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** /exit, /quit

## Think of it like

It is like closing a door. The room is still there when you come back.

## Definition

/exit closes Claude Code and takes you back to your shell, and the session is saved on disk. So /resume or claude --continue can open it again later. In a background session you are attached to, /exit only leaves it, and the session keeps running. Alias /quit.

## Example

Lucy is done for the day. She types /exit, and tomorrow claude --continue opens the same chat again.

## Example code

```console
/exit
```

Leave Claude Code and go back to the shell.

## Why it matters

Leaving is safe. Nothing is lost, so you can stop at any point.

## Common mistake

Using /exit to end a background session. It only leaves it, and it keeps working. /stop is the one that ends it.

## Three principles

- **Closes the program.** Back to the shell.
- **Session is saved.** Resume it later.
- **Leaves background ones.** They keep running.

## Related terms

- [/stop Command](https://learn.benibix.com/term/ai/stop-command)
- [/resume Command](https://learn.benibix.com/term/ai/resume-command)
- [Claude Code Session](https://learn.benibix.com/term/ai/claude-code-session)
- [Background Session](https://learn.benibix.com/term/ai/background-session)

## Told apart from

- [/exit vs /stop](https://learn.benibix.com/compare/exit-command-vs-stop-command): People often think /exit ends a background session. It only lets go of it, and the work goes on. /stop is the one that ends it, and it keeps the chat and the worktree. In a normal session, /exit closes Claude Code and saves the chat for later.

## Taught in

- [Resume, Branch and Rename](https://learn.benibix.com/learn/ai-claude-code-commands/resume-branch-and-rename): Claude Code Commands, 4/17

---

Source: https://learn.benibix.com/term/ai/exit-command
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
