码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-05-09 19:46:18      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:math   always   ordinary   thml   other   mat   frame   list   critical   

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?

标签:math   always   ordinary   thml   other   mat   frame   list   critical   

原文地址:http://www.cnblogs.com/yuanjiangw/p/6832086.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!