← System & Processes
Linux · System & Processes
How to kill a process in Linux
Stop a process by PID or name with kill, pkill, and killall, including when to use SIGKILL (-9) as a last resort.
Stop a process by PID or by name. Send the default TERM signal first, and only escalate to KILL (-9) if it will not exit.
Killing a process ends it immediately; SIGKILL (-9) gives it no chance to clean up, which can leave temp files or shared memory behind. Prefer the default TERM signal, and double-check the PID.
# Find the PID first
ps -ef | grep [n]ame
# Graceful stop (SIGTERM)
kill <pid>
# Force kill (SIGKILL) - last resort
kill -9 <pid>
# By name instead of PID
pkill <name>
killall <name>
# Verify it is gone (should print nothing)
ps -p <pid>LinuxkillProcesses