centos next kill, killall, pkill command difference

kill is used to terminate the process

First, you can view the system by ps aux what processes are running.

 

1. with a kill to kill a process

#kill, plus options-9, plus PID, expressed kill the process number PID of the process
# -1 restart
# kill -9 PID
# kill the process below represent the process with PID 2899

[root @ localhost ~] # the kill -9 2899

2. use killall Kill a class of processes

#killall, plus options-9, plus service name, the service represents kill all processes
# -1 restart
# killall -9 Service
# kill all processes below represent httpd service

[the root @ localhost ~] # killall the httpd -9

3. with certain terminal kicked pkill

#pkill, plus options-9, plus terminal number, indicate kicked out of the terminal
# -1 restart
#pkill -9 PTS / 0
# presented below represent my Telnet terminal PTS / 0
[root @ localhost ~] # pkill -9 PTS / 0
___________________________________________________________________________________________________________________________________

  First talk about the kill command to kill it by pid (Process ID) process, a process to get pid, we can use the ps (process status) command, by default, the kill command sends a signal to terminate the process is 15, but some reason this process does not signal, in which case, the signal can be used to force kill 9, signal 9 is mandatory to perform signal can not be ignored.

      The killall and pkill are using the name of the command to terminate the process of effective means, different from the way they kill to kill the process by pid, it can be understood as droves of killing process, of course, the risk of doing so is relatively improved a lot. Of course, they may also send a corresponding signal to terminate the process.

       For example, we want to kill related processes mysql, we can use pkill -9 mysqld mysql to kill all related processes, more convenient, but it may inadvertently remove programs.

     

      The following is a common digital signals and their meaning:

      1 indicates the end of the signal from the terminal

      2 represents the signal transmitted from a terminal keyboard (i.e., Ctrl + c)

      3 shows the exit signal sent from the keyboard (ie Ctrl + \)

      8 represents a floating point exception, such as by 0

      9 receiving the signal indicating the end of the process, which is forced to kill the process

     15 kill command default termination signal

     17 signal the end of the child process to terminate or

     Signal 19 from the keyboard to perform the

Guess you like

Origin www.cnblogs.com/kinwing/p/11104966.html