What are the different htop kill signals?

I have recently started using htop, and I have been needing to kill processes, but when pressing F9 on the process, it has been giving me this list of options, I just chose the one which is selected by defaults, but I don't know what that actually does, although it seems to work:

htop signal options

So really my question is, what are these different options, and which is best to use to kill a process?


Solution 1:

First try

SIGTERM      15       Term    Termination signal

if this doesn't work

SIGKILL       9       Term    Kill signal

From man 7 signal

First the signals described in the original POSIX.1-1990 standard.

Signal     Value     Action   Comment
──────────────────────────────────────────────────────────────────────
SIGHUP        1       Term    Hangup detected on controlling terminal
                              or death of controlling process
SIGINT        2       Term    Interrupt from keyboard
SIGQUIT       3       Core    Quit from keyboard
SIGILL        4       Core    Illegal Instruction
SIGABRT       6       Core    Abort signal from abort(3)
SIGFPE        8       Core    Floating point exception
SIGKILL       9       Term    Kill signal
SIGSEGV      11       Core    Invalid memory reference
SIGPIPE      13       Term    Broken pipe: write to pipe with no
                              readers
SIGALRM      14       Term    Timer signal from alarm(2)
SIGTERM      15       Term    Termination signal
SIGUSR1   30,10,16    Term    User-defined signal 1
SIGUSR2   31,12,17    Term    User-defined signal 2
SIGCHLD   20,17,18    Ign     Child stopped or terminated
SIGCONT   19,18,25    Cont    Continue if stopped
SIGSTOP   17,19,23    Stop    Stop process
SIGTSTP   18,20,24    Stop    Stop typed at terminal
SIGTTIN   21,21,26    Stop    Terminal input for background process
SIGTTOU   22,22,27    Stop    Terminal output for background process

The signals SIGKILL and SIGSTOP cannot be caught, blocked, or
ignored.

Next the signals not in the POSIX.1-1990 standard but described in
SUSv2 and POSIX.1-2001.

Signal       Value     Action   Comment
────────────────────────────────────────────────────────────────────
SIGBUS      10,7,10     Core    Bus error (bad memory access)
SIGPOLL                 Term    Pollable event (Sys V).
                                Synonym for SIGIO
SIGPROF     27,27,29    Term    Profiling timer expired
SIGSYS      12,31,12    Core    Bad argument to routine (SVr4)
SIGTRAP        5        Core    Trace/breakpoint trap
SIGURG      16,23,21    Ign     Urgent condition on socket (4.2BSD)
SIGVTALRM   26,26,28    Term    Virtual alarm clock (4.2BSD)
SIGXCPU     24,24,30    Core    CPU time limit exceeded (4.2BSD)
SIGXFSZ     25,25,31    Core    File size limit exceeded (4.2BSD)

Solution 2:

Those are Process signals in general and not just related to htop, you can list all signals using the command

kill -l

For examplesource :

-1 or -HUP - This argument makes kill send the "Hang Up" signal to processes. This probably originates from the modem/dial-in era. Processes have to be programmed to actually listen to this process and do something with it. Most daemons are programmed to re-read their configuration when they receive such a signal. Anyway; this is very likely the safest kill signal there is, it should not obstruct anything.

-2 or -SIGINT - This is the same as starting some program and pressing CTRL+C during execution. Most programs will stop, you could lose data.

-9 or -KILL - The kernel will let go of the process without informing the process of it. An unclean kill like this could result in data loss. This is the "hardest", "roughest" and most unsafe kill signal available, and should only be used to stop something that seems unstoppable.

-15 or -TERM - Tell the process to stop whatever it's doing, and end itself. When you don't specify any signal, this signal is used. It should be fairly safe to perform, but better start with a "-1" or "-HUP".

The list from signal.h file:

+--------------------+------------------+
 *  |  POSIX signal      |  default action  |
 *  +--------------------+------------------+
 *  |  SIGHUP            |  terminate   |
 *  |  SIGINT            |  terminate   |
 *  |  SIGQUIT           |  coredump    |
 *  |  SIGILL            |  coredump    |
 *  |  SIGTRAP           |  coredump    |
 *  |  SIGABRT/SIGIOT    |  coredump    |
 *  |  SIGBUS            |  coredump    |
 *  |  SIGFPE            |  coredump    |
 *  |  SIGKILL           |  terminate(+)    |
 *  |  SIGUSR1           |  terminate   |
 *  |  SIGSEGV           |  coredump    |
 *  |  SIGUSR2           |  terminate   |
 *  |  SIGPIPE           |  terminate   |
 *  |  SIGALRM           |  terminate   |
 *  |  SIGTERM           |  terminate   |
 *  |  SIGCHLD           |  ignore      |
 *  |  SIGCONT           |  ignore(*)   |
 *  |  SIGSTOP           |  stop(*)(+)      |
 *  |  SIGTSTP           |  stop(*)     |
 *  |  SIGTTIN           |  stop(*)     |
 *  |  SIGTTOU           |  stop(*)     |
 *  |  SIGURG            |  ignore      |
 *  |  SIGXCPU           |  coredump    |
 *  |  SIGXFSZ           |  coredump    |
 *  |  SIGVTALRM         |  terminate   |
 *  |  SIGPROF           |  terminate   |
 *  |  SIGPOLL/SIGIO     |  terminate   |
 *  |  SIGSYS/SIGUNUSED  |  coredump    |
 *  |  SIGSTKFLT         |  terminate   |
 *  |  SIGWINCH          |  ignore      |
 *  |  SIGPWR            |  terminate   |
 *  |  SIGRTMIN-SIGRTMAX |  terminate       |
 *  +--------------------+------------------+
 *  |  non-POSIX signal  |  default action  |
 *  +--------------------+------------------+
 *  |  SIGEMT            |  coredump    |
 *  +--------------------+------------------+

further read:

  • man signal , man 2 signal , man 7 signal , man kill
  • http://man7.org/linux/man-pages/man7/signal.7.html
  • http://lasr.cs.ucla.edu/vahab/resources/signals.html
  • http://www.linuxprogrammingblog.com/all-about-linux-signals