kill
The command that sends a signal to a process or job, SIGTERM by default, despite its name.
In more detail
Give it a process ID or a job spec such as %1, and name the signal, as in kill -INT, rather than using a bare number. kill -l lists the signals. kill -9 sends SIGKILL, which cannot be caught, so try TERM first and let the program clean up.
Examples
kill -TERM %1kill -INT $$Despite the name it does not necessarily end anything: kill -s SIGHUP 42 asks process 42 to hang up or reload, and kill -l lists signal names. Only the process owner or root can signal a process. Verify the PID, owner and parent before sending, because a correct signal to the wrong process is still an outage.Related terms
- signal — A short notification the kernel delivers to a process, such as please stop or stop now.
- SIGTERM — The signal that politely asks a process to finish its work and exit.
- SIGKILL — The signal that ends a process immediately; it cannot be caught or ignored.
- pkill — The command that sends a signal to every process whose name matches a pattern, SIGTERM by default.
- process ID — The number the kernel gives each running process so it can be told apart from all the others.
Taught in
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Processes, Jobs And Signals — Bash Scripting & Command Line Automation
- Signals, And What kill Really Sends — Linux Fundamentals & Systems Administration