To work on Linux, you often need to use the kill command to stop the process. In general, you can use the ps command to find the process ID to be aborted and directly use "kill PID. However, this command occasionally becomes invalid and the process cannot be aborted. In this case, you need to have an in-depth understanding of the kill command to find a solution.
Let's take a look at the description of the kill command in Linux:
Description
TheCommand kill sends the specified signal to the specified process or process group.If no signal
Is specified, the term signal is sent.
The term signal will kill processes which do not catch this signal.For other processes, it may be necessary
To useKill(9)Signal, Since this signal
Cannot be caught.
...
It turns out that the kill command can send multiple different signals. By default, kill sends the term, that is, the 15 (sigterm) signal. The "kill PID" and "Kill-15 PID" are the same. This signal usually requires the program to exit normally, which is a safe method. However, it can be blocked, processed, and ignored, so some processes will stop and fail.
Another commonly used signal is sigkill. This command indicates that the program is terminated immediately and cannot be blocked, processed, or ignored. If the term signal fails, you can try "Kill-9 PID ". Use "Kill-L" to view more signal lists.
Although the "kill-9" command is very powerful, it may still fail to achieve the goal. At this time, another way is to use "PS-Ef" to find the parent process (ppid) of the process to be aborted, and then use the kill or killall command to kill it.