You are viewing our old blog site. For latest posts, please visit us at the new space. Follow our publication there to stay updated with tech articles, tutorials, events & more.

Use of “Kill” & “Kill -9”

0.00 avg. rating (0% score) - 0 votes

Folks normally have the practice to use “kill -9 ”; to terminate any process. Many times this creates zombies process and this is true!!!

My 1 cent request is to use “kill -9 ” command carefully. I’m sharing a brief difference on “Kill” & “Kill -9“. Hopefully, this will be useful.

kill” command sends a kill signal to terminate any process gracefully when attached with a pid or a processname. This is the default and safest way to kill/terminate a or set of processes. “kill <pid> / <processname>” sends SIGTERM (15) – Termination signal. However, this signal can be handled, ignored or caught in code. If the signal is not caught by a process, the process is killed. Hence, this is used for graceful termination of a process.

kill -9” command sends a kill signal to terminate any process immediately when attached with a pid or a processname. It is a forceful way to kill/terminate a or set of processes. “Kill -9 <pid> / <processname>” sends SIGKILL (9) – Kill signal. This signal cannot be handled (caught), ignored or blocked. Hence, this immediately kill the process without any handling and this can create zombies process.

Actually, if you don’t specify a signal number, the kill command will send SIGTERM, not SIGKILL. That’s why you have to say “kill -9” to send SIGKILL. Of course, you can specify any signal number to send with the kill command.

So, unless you are sure of which one to use; make your wise judgment …good luck