⌨️--bg Flag
Also known as claude --bg, --background, claude --exec
It starts a session in the background and hands you back the shell.
Think of it like
It is like you put a pot on to cook. Then you go and play while it cooks.
Example
Emma starts two tasks with claude --bg before lunch. Back at her desk, claude agents shows both are done, and she opens one with claude attach.
Why it matters
Long tasks run while your terminal stays free for other work.
Definition
Example code
bash
claude --bg "investigate the flaky test"Common mistake
Key takeaways
- 1Returns at once. Prints the ID.
- 2--exec. A shell job.
- 3Not with -p. Use logs or attach.