How to Kill a Process in Linux with the kill Command

Published 2026-08-05 · Learn Linux

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.

$ pgrep -a firefox

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.

$ kill 4321

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 -9 4321

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.

$ pkill firefox

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:

$ kill -HUP $(pgrep nginx)

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.