KILL(1)                    POSIX Programmer's Manual                   KILL(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       kill -- terminate or signal processes

SSYYNNOOPPSSIISS
       kill -s _s_i_g_n_a_l___n_a_m_e _p_i_d...

       kill -l [[_e_x_i_t___s_t_a_t_u_s]]

       kill [[-_s_i_g_n_a_l___n_a_m_e]] _p_i_d...

       kill [[-_s_i_g_n_a_l___n_u_m_b_e_r]] _p_i_d...

DDEESSCCRRIIPPTTIIOONN
       The _k_i_l_l utility shall send a signal to the process or processes
       specified by each _p_i_d operand.

       For each _p_i_d operand, the _k_i_l_l utility shall perform actions equivalent
       to the _k_i_l_l() function defined in the System Interfaces volume of
       POSIX.1-2017 called with the following arguments:

        *  The value of the _p_i_d operand shall be used as the _p_i_d argument.

        *  The _s_i_g argument is the value specified by the --ss option,
           --_s_i_g_n_a_l___n_u_m_b_e_r option, or the --_s_i_g_n_a_l___n_a_m_e option, or by SIGTERM,
           if none of these options is specified.

OOPPTTIIOONNSS
       The _k_i_l_l utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, except that in
       the last two SYNOPSIS forms, the --_s_i_g_n_a_l___n_u_m_b_e_r and --_s_i_g_n_a_l___n_a_m_e
       options are usually more than a single character.

       The following options shall be supported:

       --ll        (The letter ell.) Write all values of _s_i_g_n_a_l___n_a_m_e supported
                 by the implementation, if no operand is given. If an
                 _e_x_i_t___s_t_a_t_u_s operand is given and it is a value of the ''??''
                 shell special parameter (see _S_e_c_t_i_o_n _2_._5_._2, _S_p_e_c_i_a_l
                 _P_a_r_a_m_e_t_e_r_s and _w_a_i_t) corresponding to a process that was
                 terminated by a signal, the _s_i_g_n_a_l___n_a_m_e corresponding to the
                 signal that terminated the process shall be written. If an
                 _e_x_i_t___s_t_a_t_u_s operand is given and it is the unsigned decimal
                 integer value of a signal number, the _s_i_g_n_a_l___n_a_m_e (the
                 symbolic constant name without the SSIIGG prefix defined in the
                 Base Definitions volume of POSIX.1-2017) corresponding to
                 that signal shall be written. Otherwise, the results are
                 unspecified.

       --ss _s_i_g_n_a_l___n_a_m_e
                 Specify the signal to send, using one of the symbolic names
                 defined in the _<_s_i_g_n_a_l_._h_> header. Values of _s_i_g_n_a_l___n_a_m_e shall
                 be recognized in a case-independent fashion, without the SSIIGG
                 prefix. In addition, the symbolic name 0 shall be recognized,
                 representing the signal value zero. The corresponding signal
                 shall be sent instead of SIGTERM.

       --_s_i_g_n_a_l___n_a_m_e
                 Equivalent to --ss _s_i_g_n_a_l___n_a_m_e.

       --_s_i_g_n_a_l___n_u_m_b_e_r
                 Specify a non-negative decimal integer, _s_i_g_n_a_l___n_u_m_b_e_r,
                 representing the signal to be used instead of SIGTERM, as the
                 _s_i_g argument in the effective call to _k_i_l_l().  The
                 correspondence between integer values and the _s_i_g value used
                 is shown in the following list.

                 The effects of specifying any _s_i_g_n_a_l___n_u_m_b_e_r other than those
                 listed below are undefined.

                 0     0

                 1     SIGHUP

                 2     SIGINT

                 3     SIGQUIT

                 6     SIGABRT

                 9     SIGKILL

                 14    SIGALRM

                 15    SIGTERM

                 If the first argument is a negative integer, it shall be
                 interpreted as a --_s_i_g_n_a_l___n_u_m_b_e_r option, not as a negative _p_i_d
                 operand specifying a process group.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _p_i_d       One of the following:

                  1. A decimal integer specifying a process or process group
                     to be signaled.  The process or processes selected by
                     positive, negative, and zero values of the _p_i_d operand
                     shall be as described for the _k_i_l_l() function. If process
                     number 0 is specified, all processes in the current
                     process group shall be signaled. For the effects of
                     negative _p_i_d numbers, see the _k_i_l_l() function defined in
                     the System Interfaces volume of POSIX.1-2017. If the
                     first _p_i_d operand is negative, it should be preceded by
                     ""----"" to keep it from being interpreted as an option.

                  2. A job control job ID (see the Base Definitions volume of
                     POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_0_4, _J_o_b _C_o_n_t_r_o_l _J_o_b _I_D) that
                     identifies a background process group to be signaled. The
                     job control job ID notation is applicable only for
                     invocations of _k_i_l_l in the current shell execution
                     environment; see _S_e_c_t_i_o_n _2_._1_2, _S_h_e_l_l _E_x_e_c_u_t_i_o_n
                     _E_n_v_i_r_o_n_m_e_n_t.

       _e_x_i_t___s_t_a_t_u_s
                 A decimal integer specifying a signal number or the exit
                 status of a process terminated by a signal.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _k_i_l_l:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       When the --ll option is not specified, the standard output shall not be
       used.

       When the --ll option is specified, the symbolic name of each signal shall
       be written in the following format:


           "%s%c", <_s_i_g_n_a_l___n_a_m_e>, <_s_e_p_a_r_a_t_o_r>

       where the <_s_i_g_n_a_l___n_a_m_e> is in uppercase, without the SSIIGG prefix, and
       the <_s_e_p_a_r_a_t_o_r> shall be either a <newline> or a <space>.  For the last
       signal written, <_s_e_p_a_r_a_t_o_r> shall be a <newline>.

       When both the --ll option and _e_x_i_t___s_t_a_t_u_s operand are specified, the
       symbolic name of the corresponding signal shall be written in the
       following format:


           "%s\n", <_s_i_g_n_a_l___n_a_m_e>

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    At least one matching process was found for each _p_i_d operand, and
             the specified signal was successfully processed for at least one
             matching process.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Process numbers can be found by using _p_s.

       The job control job ID notation is not required to work as expected
       when _k_i_l_l is operating in its own utility execution environment. In
       either of the following examples:


           nohup kill %1 &
           system("kill %1");

       the _k_i_l_l operates in a different environment and does not share the
       shell's understanding of job numbers.

EEXXAAMMPPLLEESS
       Any of the commands:


           kill -9 100 -165
           kill -s kill 100 -165
           kill -s KILL 100 -165

       sends the SIGKILL signal to the process whose process ID is 100 and to
       all processes whose process group ID is 165, assuming the sending
       process has permission to send that signal to the specified processes,
       and that they exist.

       The System Interfaces volume of POSIX.1-2017 and this volume of
       POSIX.1-2017 do not require specific signal numbers for any
       _s_i_g_n_a_l___n_a_m_e_s.  Even the --_s_i_g_n_a_l___n_u_m_b_e_r option provides symbolic
       (although numeric) names for signals. If a process is terminated by a
       signal, its exit status indicates the signal that killed it, but the
       exact values are not specified. The _k_i_l_l --ll option, however, can be
       used to map decimal signal numbers and exit status values into the name
       of a signal. The following example reports the status of a terminated
       job:


           job
           stat=$?
           if [ $stat -eq 0 ]
           then
               echo job completed successfully.
           elif [ $stat -gt 128 ]
           then
               echo job terminated by signal SIG$(kill -l $stat).
           else
               echo job terminated with error code $stat.
           fi

       To send the default signal to a process group (say 123), an application
       should use a command similar to one of the following:


           kill -TERM -123
           kill -- -123

RRAATTIIOONNAALLEE
       The --ll option originated from the C shell, and is also implemented in
       the KornShell. The C shell output can consist of multiple output lines
       because the signal names do not always fit on a single line on some
       terminal screens. The KornShell output also included the
       implementation-defined signal numbers and was considered by the
       standard developers to be too difficult for scripts to parse
       conveniently. The specified output format is intended not only to
       accommodate the historical C shell output, but also to permit an
       entirely vertical or entirely horizontal listing on systems for which
       this is appropriate.

       An early proposal invented the name SIGNULL as a _s_i_g_n_a_l___n_a_m_e for signal
       0 (used by the System Interfaces volume of POSIX.1-2017 to test for the
       existence of a process without sending it a signal). Since the
       _s_i_g_n_a_l___n_a_m_e 0 can be used in this case unambiguously, SIGNULL has been
       removed.

       An early proposal also required symbolic _s_i_g_n_a_l___n_a_m_es to be recognized
       with or without the SSIIGG prefix. Historical versions of _k_i_l_l have not
       written the SSIIGG prefix for the --ll option and have not recognized the
       SSIIGG prefix on _s_i_g_n_a_l___n_a_m_es.  Since neither applications portability nor
       ease-of-use would be improved by requiring this extension, it is no
       longer required.

       To avoid an ambiguity of an initial negative number argument specifying
       either a signal number or a process group, POSIX.1-2008 mandates that
       it is always considered the former by implementations that support the
       XSI option. It also requires that conforming applications always use
       the ""----"" options terminator argument when specifying a process group,
       unless an option is also specified.

       The --ss option was added in response to international interest in
       providing some form of _k_i_l_l that meets the Utility Syntax Guidelines.

       The job control job ID notation is not required to work as expected
       when _k_i_l_l is operating in its own utility execution environment. In
       either of the following examples:


           nohup kill %1 &
           system("kill %1");

       the _k_i_l_l operates in a different environment and does not understand
       how the shell has managed its job numbers.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e, _p_s, _w_a_i_t

       The Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_0_4, _J_o_b _C_o_n_t_r_o_l
       _J_o_b _I_D, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x
       _G_u_i_d_e_l_i_n_e_s, <<ssiiggnnaall..hh>>

       The System Interfaces volume of POSIX.1-2017, _k_i_l_l()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                              KILL(1)
