NAME [Toc] [Back]
kill - send a signal to a process; terminate a process
SYNOPSIS [Toc] [Back]
kill [-s signame] pid ...
kill [-s signum] pid ...
kill -signame pid ...
kill -signum pid ...
DESCRIPTION [Toc] [Back]
The kill command sends a signal to each process specified by a pid
process identifier. The default signal is SIGTERM, which normally
terminates processes that do not trap or ignore the signal.
Options [Toc] [Back]
kill recognizes the following options:
-l (ell) List all values of signame supported by the
implementation. No signals are sent with this
option. The symbolic names of the signals
(without the SIG prefix) are written to
standard output, separated by spaces and
-s signame Send the specified signal name. The default is
SIGTERM, number 15. signame can be specified
in upper- and/or lowercase, with or without the
SIG prefix. These values can be obtained by
using the -l option. The symbolic name SIGNULL
represents signal value zero. See "Signal
Names and Numbers" below.
-s signum Send the specified decimal signal number. The
default is 15, SIGTERM. See "Signal Names and
-signame (Obsolescent.) Equivalent to -s signame.
-signum (Obsolescent.) Equivalent to -s signum.
Operands [Toc] [Back]
pid is a process identifier, an unsigned or negative integer that can
be one of the following:
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
> 0 The number of a process.
= 0 All processes, except special system processes, whose
process group ID is equal to the process group ID of the
=-1 All processes, except special system processes, if the user
has appropriate privileges. Otherwise, all processes,
except special system processes, whose real or effective
user ID is the same as the user ID of the sending process.
<-1 All processes, except special system processes, whose
process group ID is equal to the absolute value of pid and
whose real or effective user ID is the same as the user of
the sending process.
Process numbers can be found with the ps command (see ps(1)) and with
the built-in jobs command available in some shells.
Signal Names and Numbers [Toc] [Back]
The following table describes a few of the more common signals that
can be useful from a terminal. For a complete list and a full
description, see the header file <signal.h> and the manual entry
signum signame Name Description
0 SIGNULL Null Check access to pid
1 SIGHUP Hangup Terminate; can be trapped
2 SIGINT Interrupt Terminate; can be trapped
3 SIGQUIT Quit Terminate with core dump; can be trapped
9 SIGKILL Kill Forced termination; cannot be trapped
15 SIGTERM Terminate Terminate; can be trapped
24 SIGSTOP Stop Pause the process; cannot be trapped
25 SIGTSTP Terminal stop Pause the process; can be trapped
26 SIGCONT Continue Run a stopped process
SIGNULL (0), the null signal, invokes error checking but no signal is
actually sent. This can be used to test the validity or existence of
SIGTERM (15), the (default) terminate signal, can be trapped by the
receiving process, allowing the receiver to execute an orderly
shutdown or to ignore the signal entirely. For orderly operations,
this is the preferred choice.
SIGKILL (9), the kill signal, forces a process to terminate
immediately. Since SIGKILL cannot be trapped or ignored, it is useful
for terminating a process that does not respond to SIGTERM.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
The receiving process must belong to the user of the sending process,
unless the user has appropriate privileges.
As a single special case, the continue signal SIGCONT can be sent to
any process that is a member of the same session as the sending
RETURN VALUE [Toc] [Back]
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 [Toc] [Back]
signals process number 6135 to terminate. This gives the process an
opportunity to exit gracefully (removing temporary files, etc.).
The following equivalent commands:
kill -s SIGKILL 6135
kill -s KILL 6135
kill -s 9 6135
kill -SIGKILL 6135
kill -KILL 6135
kill -9 6135
terminate process number 6135 abruptly by sending a SIGKILL signal to
the process. This tells the kernel to remove the process immediately.
WARNINGS [Toc] [Back]
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
DEPENDENCIES [Toc] [Back]
This manual entry describes the external command /usr/bin/kill and the
built-in kill command of the POSIX shell (see sh-posix(1)). Other
shells, such as C and Korn (see cs
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
provide kill as a built-in command. The syntax for and output from
these built-ins may be different.
SEE ALSO [Toc] [Back]
csh(1), ksh(1), ps(1), sh(1), sh-posix(1), kill(2), wait(2),
STANDARDS CONFORMANCE [Toc] [Back]
kill: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003 [ Back ]