# claude attach Command

> It opens a job that runs in the background, here.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude attach, Attach to a background session

## Think of it like

It is like you go back to a room where your friend is still at work.

## Definition

claude attach opens a background session in the terminal you are in, by its ID or its name. You pick up the chat where it is, and can read and type as normal. To leave it running and go back, press the left arrow on an empty prompt or run /exit. The session keeps working after you detach.

## Example

Jack started a bug fix in the background an hour ago. He runs claude attach with its ID, reads what Claude did, answers a question, then detaches.

## Example code

```bash
claude attach 7c5dcf5d
```

Open this background session here.

## Why it matters

You can check in on long work from any terminal, without stopping it.

## Common mistake

Closing the terminal to leave and fearing the work is lost. The session keeps running. Only stopping it ends the work.

## Three principles

- **By ID or name.** Part of a name works.
- **Pick up the chat.** Read and type.
- **Detach.** It keeps going.

## Related terms

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

## Taught in

- [Background Session Commands](https://learn.benibix.com/learn/ai-claude-code-commands/background-session-commands): Claude Code Commands, 7/17

![A supervisor process runs the background sessions. claude attach, logs, respawn and rm act on one session. claude daemon acts on the supervisor.](https://learn.benibix.com/diagrams/cli-daemon.svg)

---

Source: https://learn.benibix.com/term/ai/claude-attach-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-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
