How to Kill a Process in Linux with the kill Command
The kill command sends a signal to a running process, usually to stop it. The target is a PID you find with ps or pgrep: kill 4321. When a program ignores the polite request, the heavier kill -9 force-kills it.
Find the PID first
kill needs the process ID. Find it with pgrep, or with ps piped into grep.
Kill a process by PID
Sending the default signal (SIGTERM, signal 15) politely asks the process to close its files and exit. Give it a second or two before escalating.
Force kill with -9
If the process ignores SIGTERM and still runs, send SIGKILL (signal 9). The kernel removes it immediately with no chance to clean up — use it only as a last resort for stuck processes.
Kill by name with pkill
When you know the program name but not the PID, pkill matches names directly. Be careful: pkill -9 firefox kills every process with firefox in its name.
Other useful signals
SIGTERM (15) is the normal shutdown, SIGKILL (9) is the hard stop, and SIGHUP (1) makes many daemons reload their config. Send any signal by number or name:
List every signal with kill -l. The kill reference page has full details.
Keep learning
Related guides: How to Monitor Processes with ps and top · How to Reuse Commands with the bash history Feature · How to Schedule Tasks in Linux with cron. Read all tutorials on the Learn Linux blog.