Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What does -9 do?

It does not show up in the syntax:

$ kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
$
share|improve this question
10  
-9 is an instance of -sigspec, it's equivalent to -s 9 or -n 9 or -s KILL or -KILL. –  Gilles Jun 19 '11 at 10:18

2 Answers 2

man signal

Will show you the mapping between signal numbers and signal names.

share|improve this answer

-9 is the signal number (in this case SIGKILL), so kill -9 sends a SIGKILL to the process in question.

This signal causes the process to terminate immediately (unless it's waiting in a kernel function). The signal can neither be ignored nor can the receiving process perform any clean up action after receiving the signal (i.e. a signal handler for SIGKILL is not called). See also the Wikipedia article on SIGKILL.

From the man page of my kill command (Linux):

   The  default  signal  for  kill is TERM. Use -l or -L to list available
   signals.  Particularly useful signals include  HUP,  INT,  KILL,  STOP,
   CONT,  and  0.   Alternate  signals  may be specified in three ways: -9
   -SIGKILL -KILL.

EDIT: kill -l (the bash built-in command) lists the following signal names and numeric values on my system:

 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
21) SIGTTIN     22) SIGTTOU     23) SIGURG      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
share|improve this answer
1  
On Debian kill -l lists the numerical values too. What is your OS? –  Faheem Mitha Jun 19 '11 at 7:55
    
interesting, I'm running Ubuntu (which is Debian based as far as I know). On the other hand, I just noticed that man kill list numeric values for some of the signals. –  Andre Holzner Jun 19 '11 at 8:26
    
Well, kill is in procps, which is version 1:3.2.8-9 in Debian squeeze. And yes, Ubuntu is basically Debian. So I wonder why kill -l doesn't return the same thing. –  Faheem Mitha Jun 19 '11 at 9:24
1  
it turns out that I was running zsh's builtin kill command, not /bin/kill (which actually lists the numeric values as you say) –  Andre Holzner Jun 19 '11 at 9:32
4  
@FaheemMitha There are two reasons why shells need a kill built-in. It allows the kill command to accept job numbers or names (e.g. kill %1). And it allows kill to be used even if some process count limit has been reached. –  Gilles Jun 19 '11 at 16:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.