What is the difference between kill and kill -9 on the Linux command line?
kill aka kill -TERM aka kill -15 is the safe and correct way of terminating a process. It's equivalent to safely shutting down a computer.
kill -9 is the unsafe way of brutally murdering a process. It's equivalent to pulling the power cord, and may cause data corruption.
See the Linux&Unix stack exchange for more information.
kill is a utility program, found in Unix-like operating systems, for sending different signals to one or more processes (usually, for terminating, pausing, continuing, etc. – manipulating processes).
When executing kill without any signal number (which is sometimes referred to as a signal code), the default signal number 15 will be used and that is equivalent to the SIGTERM signal name.
One other signal number is 9, which is equivalent to the SIGKILL signal name.
The difference between kill -15 PID (which is same as kill PID) and kill -9 PID is that the first shuts the specified process down gracefully and the second does that forcefully, killing the process and all its subprocesses.
Generally, for killing specific process, you can use kill in one of four alternative fashions:
kill -signalnumber PIDkill -s signalnumber PIDkill -SIGNALNAME PIDkill -s SIGNALNAME PID(PID stands for Process ID)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With