killall — Kill Processes by Name¶
Overview¶
killall sends a signal to all processes running a specified command name. Unlike kill (which takes PIDs), killall takes command names directly.
Command type: External (psmisc)
Location: /usr/bin/killall
Syntax¶
Options Reference¶
| Option | Description |
|---|---|
-s SIGNAL / -SIGNAL | Send specified signal (default: SIGTERM / 15) |
-i | Interactive — ask for confirmation before killing each process |
-u USER | Kill processes owned by specified USER |
-v | Verbose — report whether signal was sent successfully |
-q | Quiet — do not complain if no matching processes are found |
-w | Wait — block until all killed processes have terminated |
-y N | Kill processes younger than N seconds/minutes/hours/days |
-o N | Kill processes older than N seconds/minutes/hours/days |
Examples¶
Gracefully Terminate All Instances of a Process¶
Force-Kill Processes¶
Interactive Termination with Confirmation¶
Kill Only Processes Owned by a Specific User¶
killall vs pkill¶
| Feature | killall | pkill |
|---|---|---|
| Pattern Matching | Exact process command name match (by default) | Full regular expression pattern match |
| Package | psmisc | procps |
| Safety | Safer against accidental partial pattern matches | Requires care to avoid matching unintended processes |
Interview Questions¶
What is the key difference between killall and pkill?
killall matches exact process command names by default (e.g. killall nginx kills processes named nginx). pkill uses regular expression matching across process names or full command lines (e.g. pkill ng matches nginx, ngg, etc.).
Related Commands¶
| Command | Description |
|---|---|
kill | Send signal to process by Process ID (PID) |
pkill | Kill processes matching pattern |
pgrep | List process IDs matching pattern |