Journal
Tutorials

How to Kill a Claude Code Process (the Clean Way)

C

Clearly Team

Engineering

5 min read
Jul 9, 2026

How to Kill a Claude Code Process (the Clean Way)

Sometimes you don't want to interrupt Claude Code — you want it gone. The session's wedged, or it's off doing something you never asked for, and you need the process dead now. Here's the clean way, from gentle to forceful.

From gentle to forceful

  1. Interrupt first. Esc stops the current action; Ctrl+C (often twice) exits the session. This is enough most of the time — the process ends cleanly.
  2. If it's truly hung, find and signal the process. Claude Code runs as node (the claude CLI):
    • pgrep -fl claude to find it.
    • kill <pid> sends SIGTERM (asks it to shut down).
    • kill -9 <pid> sends SIGKILL (forces it) when it won't go — the nuclear option, no cleanup, but it always works.
  3. Rewind instead, if it's one bad edit. If the session's fine but it made one change you want gone, press Esc twice to roll the files back to the checkpoint before that edit — you keep the good context and lose only the bad diff. (Killing throws away the whole session.)

The order matters: interrupt → SIGTERM → SIGKILL. Reach for kill -9 only when the polite options don't work.

The catch: unsaved work dies with it

Killing a session ends whatever it was doing. Anything not written to disk goes with it. That's usually fine — you're killing it because it went wrong — but know it before you pull the trigger. (When to kill vs. save: shoot your Claude Code in the head.)

Finding the right one to kill

The hard part isn't the kill command — it's finding which process when you've got five node sessions running and only one is stuck. pgrep gives you PIDs, not context; you end up guessing.

This is exactly what Mwah is for: it puts every live Claude Code session on your desktop as a labelled robot — real name, project, ALIVE or STUCK — and a headshot ends the actual process (SIGTERM → SIGKILL) for you. It's a kill switch with a face, so you never pgrep for the right PID again. Take the shot →


Related: Is your session stuck? · Run multiple sessions

#claude code#cli#developer workflow#debugging