System and processes
The pkill command
Kills processes by name, without looking up the PID first.
Syntax
pkill [-f] [-x] [-SEÑAL] PATRÓNMost useful options
-fMatches the full command line-xRequires the exact name-9Forces death instead of asking to finishCopy-ready examples
$ sleep 100 & && pgrep sleepCheck who you are about to kill$ sleep 100 & && pkill sleepTerminates all sleep processes$ sleep 100 & && pkill sleep && jobsKill and check no job remainsYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- It is easy to overdo it: check first with pgrep.
- A short pattern kills too much (pkill py can take down other processes). Use -x or the full name.
FAQ
Do I need sudo?
Not to kill your own user's processes; for root's ones, yes.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course