Is SIGQUIT the same as SIGTERM?

22,809

Solution 1

No, they're not the same. The default action for both is to terminate the process, but SIGQUIT also dumps core. See e.g. the Linux man page signal(7). kill by default sends SIGTERM, so I can only imagine that the mention of SIGQUIT being default is indeed just a mistake. That default is in POSIX, and so are the numbers for SIGTERM, SIGKILL and SIGQUIT.

Solution 2

There are two kill commands, one in procps and one in shell. Both use SIGTERM as the default. For procps kill, the command help, manual page and kill source (skill.c line 724 in latest master branch) all say SIGTERM, which is nice to know it is consistent.

One thing to remember about signals is once you start going past the "usual bunch" and use systems a bit more different to a x86 Linux system you may find the signals aren't there or they have different numbers. procps (and probably a lot of other programs) bakes the numbers in at compile time (essentially whatever the include file has, look for signum.h).

Not something to worry about for SIGTERM, as @ilkkachu says, its in POSIX.

Share:
22,809

Related videos on Youtube

bitofagoob
Author by

bitofagoob

By day: everyman bozo. By night: personal conservationalist!

Updated on September 18, 2022

Comments

  • bitofagoob
    bitofagoob over 1 year

    I'm learning CentOS/RHEL and currently doing some stuff about process management.

    The RHCSA book I'm reading describes running kill 1234 as sending SIGQUIT. I always thought the kill command without adding a switch for signal type should default to kill -15

    SIGTERM is kill -15 and SIGKILL is kill -9, right?

    Does CentOS/RHEL use a slightly different method of kill -15 or have I just been mistaken?

    EDIT: kill -l gives SIGQUIT as kill -3 and it seems to be associated with using the keyboard to terminate a process. man 7 signal also states that SIGQUIT is kill -3, so I can only assume that my book is wrong in stating that SIGQUIT is kill -15 default.

  • bitofagoob
    bitofagoob almost 7 years
    Yeah. I think the book is mistaken because it also lists SIGQUIT as -15. Signal -15 is such an established way of ending a process in the Linux world there's no doubt it's a misprint. I will mark your answer as correct. Thanks for expanding on what SIGQUIT does.
  • bitofagoob
    bitofagoob almost 7 years
    manpage for skill says that skill and snice are obsolete. I wonder why they haven't been removed from userspace? Interesting information, anyway. Thanks.