20.4 "Linux learning is not difficult" process management (4): Kill process kills Command
To close an application can be done by killing its process, and if the process cannot be killed at the moment, it can be forced to kill.
Use the KILL command to kill a process. Before using the KILL command, you need to get the PID (process number) of the process to be killed. The user can use the PS command to get the PID of the process and then use the PID of the process as the parameter of the KILL command. When the KILL command is used, the user will not get any feedback even if the job is completed on schedule. The only way to determine if a process is terminated is to use the PS command to see if the PID number or process name of the process still exists.
Kill with no options will close the open file, and if this does not work, use the-9 option when using the KILL command, which will unconditionally kill a process. The disadvantage of this approach is the process of forcing the job to abort before the job is completed. If you use "kill-9" for a program that is updating a file, the user may lose the updated material or the entire file. In most cases, the KILL command without an option can terminate most processes.
Another use of the KILL command is to send a signal to the specified process or process group, or to determine whether the process that specifies the process number still exists. Sends a signal to the specified process, and if the process does not capture the signal, the process terminates.
Command syntax:
Kill [Options] [process number]
The meanings of the options in the command are as shown in the table.
Options |
option meaning |
-S < signals > |
specify the signal to send |
-L |
display a list of signal names , altogether a |
Example: forcing a process with process number 1659 to be killed.
[Email protected] ~]# kill-9 1659
This article extracts from "Linux Learning is not difficult" textbook, which is one of the most practical, theoretical and practical Linux Introductory materials. To read the entire book, visit the Linux ops (www.linuxywz.com) website .
"Linux learning is not difficult" process management (4): Kill process kills command