kill(1)kill(1)NAMEkill - send a signal to a process; terminate a process
SYNOPSIS
signame] pid ...
signum] pid ...
Obsolescent Versions:
DESCRIPTION
The command sends a signal to each process specified by a pid process
identifier. The default signal is which normally terminates processes
that do not trap or ignore the signal.
Options
recognizes the following options:
List all values of
signame supported by the implementation. No
signals are sent with this option. The sym‐
bolic names of the signals (without the pre‐
fix) are written to standard output, separated
by spaces and newlines.
Send the specified signal name.
The default is number signame can be specified
in upper- and/or lowercase, with or without
the prefix. These values can be obtained by
using the option. The symbolic name repre‐
sents signal value zero. See "Signal Names
and Numbers" below.
Send the specified decimal signal number.
The default is See "Signal Names and Numbers"
below.
(Obsolescent.) Equivalent to
(Obsolescent.) Equivalent to
Operands
pid is a process identifier, an unsigned or negative integer that can
be one of the following:
The number of a process.
All processes, except special system processes, whose process
group
ID is equal to the process group ID of the sender.
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 send‐
ing process.
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 send‐
ing process.
Process numbers can be found with the command (see ps(1)) and with the
built-in command available in some shells.
Signal Names and Numbers
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 and the manual entry signal(5).
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
the null signal, invokes error checking but no signal is actually sent.
This can be used to test the validity or existence of pid.
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 pre‐
ferred choice.
the kill signal, forces a process to terminate immediately. Since can‐
not be trapped or ignored, it is useful for terminating a process that
does not respond to
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
process.
RETURN VALUE
Upon completion, returns with one of the following values:
At least one matching process was found for each
pid operand, and the specified signal was successfully pro‐
cessed for at least one matching process.
An error occurred.
EXAMPLES
The command:
signals process number 6135 to terminate. This gives the process an
opportunity to exit gracefully (removing temporary files, etc.).
The following equivalent commands:
terminate process number 6135 abruptly by sending a signal to 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 pro‐
cesses (see ps(1)) may have already finished executing, but remain on
the system until their parent reaps them (see wait(2)). Using to send
signals to them has no effect.
Some non-HP-UX implementations provide only as a shell built-in com‐
mand.
DEPENDENCIES
This manual entry describes the external command and the built-in com‐
mand of the POSIX shell (see sh-posix(1)). Other shells, such as C and
Korn (see csh(1) and ksh(1) respectively), also provide as a built-in
command. The syntax for and output from these built-ins may be differ‐
ent.
SEE ALSOcsh(1), ksh(1), ps(1), sh(1), sh-posix(1), kill(2), wait(2), signal(5).
STANDARDS CONFORMANCEkill(1)