kill(1)
NAME
kill − terminate a process
SYNOPSIS
kill -s signal_name pid ...
kill -l
Obsolescent Versions:
kill - signal_number] pid ...
kill - signal_name] pid ...
DESCRIPTION
kill utility sends a signal to the process(es) specified by each pid operand.
By default, kill sends signal SIGTERM to the specified processes. This normally kills processes that do not catch or ignore the signal.
The process number of each asynchronous process started with & is reported by the shell (unless more than one process is started in a pipeline, in which case the number of the last process in the pipeline is reported). Process numbers can also be found by using the ps command (see ps(1)).
The killed process must belong to the current user unless the current user is a user with appropriate privileges.
If a signal number or a signal name preceded by - is given as the first argument, that signal is sent instead of SIGTERM (see signal(5)). In particular, kill -KILL ... is a sure kill. If the first argument is a negative integer, it is interpreted as a signal number, not as a negative pid (process group).
A signal name can be any of the signal names listed in signal(5) with or without the SIG prefix. In addition, SIGNULL is recognized and represents the signal value 0. Uppercase and lowercase letters in signal names are treated as equivalent.
For each pid operand, kill performs actions equivalent to the kill() function called with the following arguments:
• The pid argument to the kill() function is taken from the pid argument to the kill command. For example, if pid 0 is specified, all processes in the process group are signaled.
• The sig argument to kill() is the value specified by the -s option, -signal_number option, the -signal_name option, or by SIGTERM if none of these options is specified.
OPTIONS
kill recognizes the following options:
-l (ell) Write all values of signal_name supported by the implementation. No signals are sent with this option. When -l option is specified, the symbolic name of each signal is written in the following format:
%s%c,signal_name,separator
where signal_name is in uppercase without the SIG prefix, and the separator is either a new-line or a space character. For the last signal written, separator is a new-line character.
-ssignal_name Specify the signal to send. Values of signal_name are recognized in a uppercase/lowercase-independent fashion, without the SIG prefix. These values can be obtained by using the -l option. In addition, the symbolic name 0 is recognized, representing the signal value zero. The corresponding signal is sent instead of SIGTERM.
-signal_name (Obsolescent) Equivalent to -ssignal_name.
-signal_number (Obsolescent) Specify a non-negative decimal integer, signal_number, representing the signal to be used instead of SIGTERM, as the sig argument in the effective call to kill():
signal_number sig Value
0
SIGHUP
SIGINT
SIGQUIT
SIGABRT
SIGKILL
SIGALRM
SIGTERM
RETURN VALUE
Upon completion, kill returns with one of the following values:
0 At least one matching process was found for each pid operand, and the specified signal was successfully processed for at least one matching process.
>0 An error occurred.
EXAMPLES
The command:
kill 6135
signals process number 6135 to terminate (assuming you own the process). This gives the process an opportunity to exit gracefully (removing temporary files, etc.).
The commands:
kill -9 6135
kill -SIGKILL 6135
kill -KILL 6135
kill -s KILL 6135
kill -s kill 6135
terminate process number 6135 by sending a SIGKILL signal to the process (assuming you own the process). This tells the kernel to remove the process immediately.
WARNINGS
If a process hangs during some operation (such as I/O ) so that it is never scheduled, it cannot die until it is allowed to run. Thus, such a process may never go away after the kill. Similarly, defunct processes (see ps(1)) may have already finished executing, but remain on the system until their parent reaps them (see wait(2)). Using kill to send signals to them has no effect.
Some non- HP-UX implementations provide kill only as a shell built-in utility.
SEE ALSO
csh(1), ksh(1), ps(1), sh-posix(1), sh(1), kill(2), wait(2), signal(5).
STANDARDS CONFORMANCE
kill: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company — HP-UX Release 9.0: August 1992