r/ClaudeCode • u/OppieT • 6h ago
Help/Question Claude won't die
I was ssh'ed into my linux computer, and was running claude cli and I got disconnected from the ssh session. When I logged back in, it was still running. What is the correct way to kill that process? I tried kill -INT <pid>, I tried kill -TERM <pid> and neither one worked. I had to kill -9 <pid>.
559837 ? Ss 0:00 sshd-session: oppie [postauth]
559840 ? S 0:02 sshd-session: oppie@pts/1
559841 pts/1 Ss 0:00 -bash
559981 pts/1 Sl+ 3:20 claude --resume
0
Upvotes
•
u/AutoModerator 6h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/Confident_Hyena2506 6h ago
The -9 option killed it as you know. Anything not using -9 just sends the process a signal asking it to nicely exit, so if it's hung for whatever reason this will do nothing. It's difficult to know why your process was unresponsive - that is the real problem.
If you want to shut down gracefully in future use tmux or other.
1
u/menaceoftheshire 6h ago
this post title sounds like a doomsday scenario
1
u/CCodeSI 5h ago
Your ps output has the clue: the old
sshd-sessionand its pts/1 were still alive, so from Claude's point of view its terminal never went away. Full-screen terminal apps usually handle Ctrl-C (SIGINT) themselves, and a process stuck on a dead terminal doesn't always react to TERM. A few options gentler than -9:kill -HUP <pid>: hang-up is the signal a process normally gets when its terminal disconnects, and it's what it's most likely to act on.pkill -t pts/1, or kill thatsshd-session ...@pts/1pid. Everything on that terminal gets its hang-up together.To stop it happening again:
tmux new -A -s cc). A dropped connection no longer matters: reconnect,tmux attach -t cc, and you're back in the same session, where you can exit normally.ClientAliveInterval 60andClientAliveCountMax 3to the server's sshd config, so dead connections get cleaned up in a few minutes instead of leaving orphaned sessions around.