kill

[kill]

  linux中一共有32种信号,在/usr/include/bits/signum.h 头文件中可以看到

 1 #define    SIGHUP        1    /* Hangup (POSIX).  */
 2 #define    SIGINT        2    /* Interrupt (ANSI).  */
 3 #define    SIGQUIT        3    /* Quit (POSIX).  */
 4 #define    SIGILL        4    /* Illegal instruction (ANSI).  */
 5 #define    SIGTRAP        5    /* Trace trap (POSIX).  */
 6 #define    SIGABRT        6    /* Abort (ANSI).  */
 7 #define    SIGIOT        6    /* IOT trap (4.2 BSD).  */
 8 #define    SIGBUS        7    /* BUS error (4.2 BSD).  */
 9 #define    SIGFPE        8    /* Floating-point exception (ANSI).  */
10 #define    SIGKILL        9    /* Kill, unblockable (POSIX).  */
11 #define    SIGUSR1        10    /* User-defined signal 1 (POSIX).  */
12 #define    SIGSEGV        11    /* Segmentation violation (ANSI).  */
13 #define    SIGUSR2        12    /* User-defined signal 2 (POSIX).  */
14 #define    SIGPIPE        13    /* Broken pipe (POSIX).  */
15 #define    SIGALRM        14    /* Alarm clock (POSIX).  */
16 #define    SIGTERM        15    /* Termination (ANSI).  */
17 #define    SIGSTKFLT    16    /* Stack fault.  */
18 #define    SIGCLD        SIGCHLD    /* Same as SIGCHLD (System V).  */
19 #define    SIGCHLD        17    /* Child status has changed (POSIX).  */
20 #define    SIGCONT        18    /* Continue (POSIX).  */
21 #define    SIGSTOP        19    /* Stop, unblockable (POSIX).  */
22 #define    SIGTSTP        20    /* Keyboard stop (POSIX).  */
23 #define    SIGTTIN        21    /* Background read from tty (POSIX).  */
24 #define    SIGTTOU        22    /* Background write to tty (POSIX).  */
25 #define    SIGURG        23    /* Urgent condition on socket (4.2 BSD).  */
26 #define    SIGXCPU        24    /* CPU limit exceeded (4.2 BSD).  */
27 #define    SIGXFSZ        25    /* File size limit exceeded (4.2 BSD).  */
28 #define    SIGVTALRM    26    /* Virtual alarm clock (4.2 BSD).  */
29 #define    SIGPROF        27    /* Profiling alarm clock (4.2 BSD).  */
30 #define    SIGWINCH    28    /* Window size change (4.3 BSD, Sun).  */
31 #define    SIGPOLL        SIGIO    /* Pollable event occurred (System V).  */
32 #define    SIGIO        29    /* I/O now possible (4.2 BSD).  */
33 #define    SIGPWR        30    /* Power failure restart (System V).  */
34 #define SIGSYS        31    /* Bad system call.  */
35 #define SIGUNUSED    31

其中SIGKILL(9)与SIGSTOP(19)是不能捕获的,常用的Ctrl+C 发出的是SIGKILL信号。
子进程退出时会向父进程发出SIGCHLD(17)信号,默认情况下它是被屏蔽的。
SIGSTOP与SIGCONT用来暂停和继续目标进程。
SIGABRT,SIGALRM,SIGFPE,SIGPIPE,SIGINT,SIGHUP,SIGILL,SIGQUIT,SIGSEGV,SIGTERM,SIGUSR1
,SIGUSR2这12种信号,如果在进程中没有对其进行捕获处理的话,进程在收到它们时,会终止,当然还有不可捕获的SIGKILL。

在终端中发送信号用kill命令,格式为 kill 信号 目标进程PID,例如要杀掉1000号进程可以
KILL -9 1000 或者 KILL -kill 1000

参考: http://blog.csdn.net/limuyun/article/details/5598508

原文地址:https://www.cnblogs.com/tekkaman/p/3340933.html