⌨️CLAUDE_PID
Also known as $CLAUDE_PID
It holds Claude Code's own process id, for the scripts it starts.
Think of it like
It is like the room number of the one who sent you on a job.
Example
Jack's hook needs to know how long the session has been open. It reads the start time from CLAUDE_PID.
Why it matters
Without it, a script has to guess which Claude Code on the machine is its parent.
Definition
Example code
bash
ps -p "$CLAUDE_PID" -o pid,etime,commandCommon mistake
Key takeaways
- 1Claude Code's own id. The parent.
- 2Bash and hooks. Not MCP.
- 3Guards pkill. On Linux.