The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
 

kill - Terminate Processes





The kill command is used to send a specific signal to a process. The default signal sent is 'SIGTERM' (15), which terminates the process. By using kill -l' (lowercase 'L'), you can list all available signal names and numbers. If the default 'SIGTERM' signal doesn't terminate a process, you can escalate the intensity by using the 'SIGKILL' (9) signal.

The basic usage of kill -l is either kill -s signal name or kill -#, where '#' is the signal number. For instance, kill -s SIGKILL is equivalent to kill -9.

Example:
$ kill -l ←List all signal numbers
1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
5) SIGTRAP      6) SIGABRT      7) SIGBUS       8) SIGFPE
9) SIGKILL      10) SIGUSR1     11) SIGSEGV     12) SIGUSR2
13) SIGPIPE     14) SIGALRM     15) SIGTERM     16) SIGSTKFLT
17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
. . .

Example:
$ seq 1000000000 > /dev/null & ←Run 'seq' in the background
[1] 20468
$ kill %+1 ←Terminate the background process
[1]+ Terminated seq 1000000000 > /dev/null

To send a signal using 'kill , you can use either the Process ID (PID) of the process (which you can find using the ps command) or the job number (which you can find using the jobs command). For more examples and explanations of operations, you can refer to this link.