How to Kill a Process That Isn't Responding on Linux
With kill and pkill, and why to use -9 only as a last resort.
1. Find the PID
ps aux | grep program-name
2. Politely ask it to close first
kill [PID]
Sends a "polite close" signal (SIGTERM) — the program gets a chance to save any pending changes before closing.
3. If it doesn't respond, force it closed
kill -9 [PID]
Use -9 only as a last resort — it
forces immediate closure with no chance for the program to save
anything. Reserve this for when the polite close (kill
without -9) has already failed.
By name, without looking up the PID by hand
pkill program-name
Finds and ends the process directly by its name, without the intermediate step of looking up the PID manually.
Frequently asked questions
What's the difference between kill and kill -9?
kill without -9 asks for a polite close, giving the program a chance to save pending changes. kill -9 forces immediate closure without that chance — reserve it for when the polite close doesn't work.
Is pkill more dangerous than kill with a PID?
It can be, if there are several processes with similar names, since it could affect more than one at once. kill with a specific PID is more precise when you know exactly which one you want to end.