Linux Command: kill
Send signals to processes (terminate, stop, continue)
The kill command sends signals to processes, most commonly used to terminate them. Despite its name, kill can send any signal, not just termination signals. Signals are the primary inter-process communication mechanism in Unix/Linux. The most important signals are SIGTERM (15, graceful shutdown), SIGKILL (9, force kill), SIGHUP (1, reload configuration), and SIGSTOP/SIGCONT (pause/resume). SIGTERM is the default and allows processes to clean up before exiting. kill requires the process ID (PID). Use ps, pgrep, or pidof to find PIDs. For killing by name instead of PID, use killall or pkill.
Syntax
kill [SIGNAL] PID...Key Options
-15 / -TERMโ Send SIGTERM โ graceful termination (default)-9 / -KILLโ Send SIGKILL โ force kill (cannot be caught)-1 / -HUPโ Send SIGHUP โ reload configuration-STOPโ Pause a process-CONTโ Resume a paused process-lโ List all signal names
Examples
Graceful termination
kill 1234Force kill
kill -9 1234Reload configuration
kill -HUP $(cat /var/run/nginx.pid)Pro Tips
- Always try kill PID (SIGTERM) first. Only use kill -9 if the process does not respond. SIGKILL prevents cleanup and can leave corrupted data.
- Use killall processname or pkill processname instead of finding the PID first. More convenient for most cases.
- kill -0 PID does not send a signal โ it just checks if the process exists and you have permission to signal it. Useful in scripts.
Learn more: Full kill reference โ
Related Resources