6

We all know the kill command in Linux (kill -9 if some more power is needed ;) ), but what I don't understand is what are the other numbers for?

These are the numbers I know:

  1. kill -1 → Hangup (Closing window)
  2. kill -2 → Interrupt (Control + C)
  3. kill -9 → Kill
  4. kill -15 → Terminate

What are the other numbers for like 5 or 12? Is 15 the highest or can I type kill -20234?

I tried other numbers and some of them worked, but that still does not give me any understanding of what is going on under the hood or the use case.

Note: Just to be sure this is only related to Linux (and Unix)

8

What are the signal number that can be passed to kill?

kill -l lists the names of the signals.

The man page SIGNAL(7) gives an overview of the signals.

For example:

enter image description here

See the above link for a complete overview of all the signals.

  • Many thanks, I was looking in the man page of kill itself. So the info does exsists I was just looking at the wrong place. Many thanks for pointing that out! – user3892683 Jun 20 '15 at 19:12
0

The accepted answer is right and I won't add to it, but what do you mean by "worked"? They all work, just do one of basically 6 different things (called Action in the table in the accepted answer). Remember that kill is kind of misnamed. It doesn't necessarily terminate your process. It sends a signal which most likely (that's why you sent it, right?) kills your process. But it can do other things.

A signal can only ever be ignored, cause the program to terminate with a core file, terminate with no core file, stop the program, continue the program, or the program can override most signals with a signal handler.

That's it. So, INT, TERM, HUP, and others are terminate no core. SEGV, BUS, ABRT, and others are terminate with core, etc.

  • I get your point and understand that kill is kind of misleading of what it can do. For a signal to work an program has to implement that signal (of course the basic ones works all the time). So for some numbers they do not "work" means they do change the state of the program. Whether is kills the program or suspens it. So the kill command does work all the time, but the program is not always responding due to the implementation of that number of not. – user3892683 Jun 21 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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