Send signals to processes matched by name or attributes.
high risk
pgrep -a <pattern>Preview which processes match.pkill -x -TERM <name>Exact name, graceful signal.pkill sends signals to all processes matching a name pattern or other criteria. The default signal is SIGTERM (graceful shutdown). With -9 (SIGKILL), it force-kills. Always verify with pgrep first — pkill applies to all matches.
| Flag | Meaning |
|---|---|
-f --full | Match against full command line |
-u --euid | Match by user |
-signal | Signal to send (default: SIGTERM/15) |
-9 | Force kill (SIGKILL) |
-HUP | Send SIGHUP (reload config for many daemons) |
pkill -HUP nginxReload nginx config (graceful) · explain & risk-check →pkill -u www-dataTerminate all processes owned by www-data · explain & risk-check →pkill -f 'python.*stale_worker'Kill stale workers by command pattern · explain & risk-check →pgrep java && pkill -9 javaVerify then force-kill all Java processes · explain & risk-check →Always run `pgrep -a pattern` before `pkill pattern` to see exactly what will be affected — pkill's output tells you nothing about what it killed.
Reference text is hand-written and may be incomplete — check man pkill for your version. Test destructive commands on a non-production system first.