I want to kill a process under Linux will usually use kill-9, but to tell the truth, why in the end why use kill-9 oneself also can not say why, today just think of this problem on the Internet to check.
Let's start with the KILL command, which is a command to terminate a process under Linux.
To kill under the shell, you can see that the kill syntax is as follows,
[Root@cent-1 opt]# kill
Kill:usage:kill [s Sigspec |-n signum |-sigspec] pid | jobspec ... or kill-l [Sigspec]
-s specifies the signal to send
PID is the process number to terminate
Sigspec indicates a signal.
All the signal variables can be seen through the kill-l,
[Root@cent-1 opt]# kill-l 1) sighup 2) SIGINT 3) Sigquit 4) Sigill 5) Sigtrap 6) SIGABRT 7) Sigbus 8) SIGFPE 9) SIGKILL) SIGUSR1 SIGSEGV) SIGUSR2 1) 5) (sigterm) Sigstkflt) sigchld) Sigcont SIGSTOP) SIGTSTP (23) Sigurg) (SIGXCPU) sigxfsz) sigvtalrm) sigprof) sigwinch)-SI Gsys) sigrtmin) (sigrtmin+1) sigrtmin+2 () sigrtmin+3) Sigrtmin+4 4 1) sigrtmin+7 sigrtmin+8) sigrtmin+9 sigrtmin+10) sigrtmin+11) sigrtmin+12 (sigrtmin+13) +14) sigrtmin+15 (SIGRTMAX-14) SIGRTMAX-13) SIGRTMAX-12) SIGRTMAX-11) (SIGRTMAX-10) SI GRTMAX-8) SIGRTMAX-7) (SIGRTMAX-6) SIGRTMAX-5) SIGRTMAX-4 () SIGRTMAX-3) SIGRTMAX-2 64 ) Sigrtmax
The meaning of each variable in this is not long explanation, here mainly say the difference between kill and kill-9.
Kill PID
Kill PID is the same as kill-s PID, which means sending a sigterm signal to the corresponding program. After the program receives the signal, the following events will occur,
1 program immediately stop
2 program releases the appropriate resources immediately after the stop
3 programs may still continue to run
Most programs will release their resources and then stop after receiving the sigterm signal. But there are also programs that, after receiving the signal, do something else and these things can be configured. In other words, sigterm is likely to be blocked, ignored.
kill-9 pid
kill-9 pid equals kill-s 9 pid, which means forcing, terminating a process as soon as possible. Most admin will use this command.