" kill -0"有什么区别?和"杀死-9"?

时间:2016-04-06 07:31:31

标签: shell kill

请解释上面的区别。 " kill -0"和"杀死-9"

1 个答案:

答案 0 :(得分:1)

https://unix.stackexchange.com/a/169899/55635

杀灭(1)

$ man 1 kill
...
If sig is 0, then no signal is sent, but error checking is still performed.
...

杀灭(2)

$ man 2 kill
...
If sig is 0, then no signal is sent, but error checking is still performed; 
this can be used to check for the existence of a process ID or process 
group ID.
...

因此,信号0实际上实际上并不会向您的进程的PID发送任何内容,但实际上会检查您是否有权这样做。

虽然kill -9 - 实际上将SIGKILL发送到PID