kill vs pkill
Both commands terminate processes but differ in how they identify targets:
kill
- Requires process ID (PID)
- Syntax:
kill [options] <PID>
- More precise targeting
- Example:
kill 1234
pkill
- Accepts process name patterns
- Syntax:
pkill [options] <pattern>
- Can target multiple processes at once
- Example:
pkill firefox
Key differences:
kill → Targets by PID
pkill → Targets by name/pattern
Both support the same signal options (-9, -15, etc.) to specify how processes are terminated.
Common Signal Options
-1
(SIGHUP): Reload configuration-2
(SIGINT): Interrupt (like Ctrl+C)-9
(SIGKILL): Force kill, cannot be caught or ignored-15
(SIGTERM): Graceful termination (default)-18
(SIGCONT): Continue if stopped-19
(SIGSTOP): Stop process execution