kill
ProcessesSend signals to processes for graceful or forced termination.
Overview
kill sends signals to processes. It is used for graceful shutdowns, reloads, or forced termination.
Syntax
bash
kill [options] pid...
Arguments
pid: One or more process IDs.
Options Table
| Option | Description |
|---|---|
-TERM | Graceful termination (default). |
-HUP | Reload configuration if supported. |
-KILL | Force termination. |
-l | List available signals. |
Examples
bash
kill -TERM 1234
kill -HUP $(cat /var/run/nginx.pid)
Real-world Usage
Use -TERM before -KILL to allow cleanup and logs to flush.
Common Mistakes
- Using
-KILLimmediately without trying graceful signals. - Killing the wrong PID by copying stale output.
Performance Notes
Signals are immediate, but process cleanup may take time.
Security Considerations
Only privileged users should send signals to system processes.
Related Commands
pkill, pgrep, systemctl
Practice Exercises
- Send
HUPto a daemon to reload configuration. - Identify a stuck process and terminate it gracefully.