Linux basic commands -kill

The kill command

The kill command to delete the program or work execution. kill information can be sent to the specified procedures. Preset information SIGTERM (15), can be specified to terminate. If this does not terminate the program, you can use SIGKILL (9) Information attempt to forcibly remove the program. No program or work can use ps command or job instructions view.

grammar

kill (option) (parameters)
Options
- A: When dealing with the current process, does not limit the correspondence between the command name and the process ID;
 the -l <message number>: If left <message number> option, the - L parameter name will list all of the information;
 - the p-: Specifies the kill command to print only the process ID related processes, without sending any signal;
 -s <message name or number> : Specifies the information to be sent;
 -u: Specifies the user.

parameter

Process or job ID: Specifies the process or job to be deleted.

Examples

List all signal names:

kill - l
  1 ) SIGHUP        2 ) SIGINT        3 ) SIGQUIT       4 ) SIGILL
  5 ) SIGTRAP       6 ) SIGABRT       7 ) SIGBUS        8 ) SIGFPE
  9 ) SIGKILL      10 ) User1      11 ) SIGSEGV      12 ) SIGUSR2
 13 ) SIGPIPE      14 ) SIGALRM      15 ) SIGTERM      16 ) SIGSTKFLT
 17 ) SIGCHLD      18 ) SIGCONT      19 ) SIGSTOP      20 ) SIGTSTP
21 ) SIGTTIN      22 ) SIGTTOU      23 ) Sigurd       24 ) SIGXCPU
 25 ) SIGXFSZ      26 ) SIGVTALRM    27 ) SIGPROF      28 ) SIGWINCH
 29 ) SIGIO        30 ) SIGPWR       31 ) SIGSYS       34 ) SIGRTMIN
 35 ) SIGRTMIN + 1   36 ) SIGRTMIN + 2   37 ) SIGRTMIN + 3   38 ) SIGRTMIN + 4 
39 ) SIGRTMIN + 5   40 ) SIGRTMIN + 6   41 ) SIGRTMIN +7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12
47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14
51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10
55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7  58) SIGRTMAX-6
59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

Only ninth signal (SIGKILL) can unconditionally terminate the process, other processes have the right to ignore the signal, the following are commonly used signals:

The HUP      . 1     terminal break 
the INT      2     interrupt (with Ctrl + C) 
the QUIT     . 3     exits (with Ctrl + \) 
the TERM    15     terminates 
the KILL     . 9     forced termination 
CONT    18 is     continued (with the contrary STOP, FG / BG command) 
STOP    . 19     suspended (with Ctrl + Z)

First find the process with ps, then killed with kill:

-ef PS | grep vim 
root       3268   2884   0  16 : 21 PTS / 1     00 : 00 : 00 vim install.log 
root       3370   2822   0  16 : 21 PTS / 0     00 : 00 : 00 grep vim 

the kill 3268 
the kill 3268 
-bash: the kill : ( 3268 ) - do not have that process

 

Guess you like

Origin www.cnblogs.com/lj7xun/p/10983166.html