What is the difference between Kill and Kill -9 command in Unix?

Posted rsapaper

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了What is the difference between Kill and Kill -9 command in Unix?相关的知识,希望对你有一定的参考价值。

w

 

difference kill -9 pid and kill pid command - Ask Ubuntu  https://askubuntu.com/questions/791841/difference-kill-9-pid-and-kill-pid-command

 

kill pid (which sends signal 15 (SIGTERM)) tells pid to terminate, but said program can execute some code first or even ignore the signal. kill -9 pid, on the other hand, forces the program to immediately terminate (it cannot be ignored).

You should always try kill pid first, as it allows the program to do things like saving/closing open files before exiting. Only use kill -9 when you need the program to close and it won‘t respond to a simple kill pid.

 

 https://www.quora.com/What-is-the-difference-between-Kill-and-Kill-9-command-in-Unix

kill  is used to send signal to a process. The default signal is TERM i.e. to terminate(kill) the process. Similar to End Task on windows task manager.

To terminate(kill) any ordinary process :

  1. kill <pid>

For a highly critical process, which kill alone cannot terminate :

  1. kill -9 <pid>

where 99 is the strongest signal

 

https://en.wikipedia.org/wiki/Unix_signal#List_of_signals

SIGKILL 9 Terminate Kill (cannot be caught or ignored).

以上是关于What is the difference between Kill and Kill -9 command in Unix?的主要内容,如果未能解决你的问题,请参考以下文章

What is the difference between Reactjs and Rxjs?

What is the maximum length of a URL in different browsers?

What is the difference between sed and awk

What is the difference between sed and awk

What is the difference between J2EE and Spring

What is the difference between Shrink Database and File?