首页 > 代码库 > What is the difference between Kill and Kill -9 command in Unix?

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?