kill(1) kill(1)
NAME
kill - send signals to processes
SYNOPSIS
kill [-s signal] pid ... Format 1a
kill [-signalno] pid ... Format 1b
kill -s signal -- -pgid ... Format 2
kill -l [number] Format 3
DESCRIPTION
The kill command sends the specified signal to a set of processes
indicated by a process number (PID). The ps(1) command can be used to
find the process number of any process to which you want to send a
signal.
OPTIONS
Format 1a: Send signals to processes (Korn shell or XPG4 shell only)
kill [-s signal] pid ...
-s signal
Signal to be sent to the processes. This signal can be given in
the form of a number or a symbolic name. The symbolic signal name
is the name as it appears in the header file <sys/signal.h>,
without the SIG prefix. No distinction is made between uppercase
and lowercase letters. A list of these names can be printed with
the -l option.
Any signal defined in the header file <sys/signal.h> may be
specified. The signals below are significant on command level:
_______________________________________________________________
| Signal no. | Symbolic name | Meaning |
|____________|_________________|_______________________________|
| 1 | SIGHUP | Halt if the user hangs up |
|____________|_________________|_______________________________|
| 2 | SIGINT | Interrupt via <DEL> |
|____________|_________________|_______________________________|
| 3 | SIGQUIT | Quit |
|____________|_________________|_______________________________|
| 9 | SIGKILL | Kill, terminate process |
| | | unconditionally |
|____________|_________________|_______________________________|
| 15 | SIGTERM | Software termination, ter- |
| | | minate process gracefully |
|____________|_________________|_______________________________|
-s signal not specified:
kill sends the signal SIGTERM(15) to the specified processes.
Page 1 Reliant UNIX 5.44 Printed 11/98
kill(1) kill(1)
This will normally kill processes that do not catch or ignore the
signal.
-s signal is equivalent to the old Bourne shell option -signal
(cf. Format 1b and EXAMPLES), which will continue to be sup-
ported.
pid Number (ID) of the process to which a signal is to be sent.
Users without system administrator privileges may only send sig-
nals to their own processes.
The system administrator can send signals to all processes.
Current process IDs can be listed with the ps command.
A pid value of 0 has a special meaning: the signal is sent to all
processes in your process group.
Format 1b: Send signals to processes
kill [-signalno] pid ...
See Format 1a, whereby -signalno behaves like -s signal.
Caution:
The external /usr/bin/kill command is the same as the kill command in
the Bourne shell, i. e. it only recognizes the syntax specified under
Format 1b.
Format 2: Send signals to process groups
kill -s signal -- -pgid ...
-s signal
Signal to be sent to the processes of a process group. This sig-
nal can be given in the form of a number or a symbolic name. The
symbolic signal name is the name as it appears in the header file
<sys/signal.h>, without the SIG prefix. A list of these names can
be printed with the -l option (see also Format 1a).
-- End of the list of options. Must be specified so that -pgid is
not misinterpreted as an option.
-pgid
The signal is sent to all processes with process group ID pgid.
Users without system administrator privileges may only send sig-
nals to their own process groups.
The system administrator can send signals to all process groups.
Page 2 Reliant UNIX 5.44 Printed 11/98
kill(1) kill(1)
If you specify a value of 1 for pgid, the designated signal will
be sent to every process whose real user ID matches the effective
user ID of the kill command. As privileged user you send the sig-
nal to all processes, with the exception of a number of system
processes.
Format 3: List symbolic signal names
kill -l [number]
-l A list of all symbolic signal names is printed.
number
If number corresponds to the exit status of a process that was
aborted by a signal, kill outputs the symbolic name of this sig-
nal. If this is not the case, and number corresponds to a signal
number, kill outputs the symbolic name of the signal.
ERROR MESSAGES
no such process
You specified an invalid value for pid.
no such process group
You specified an invalid value for pgid.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
EXAMPLES
Example 1a (Korn shell or XPG4 shell only)
The signal SIGKILL(9) is used to terminate process number 312:
$ kill -s KILL 312 or $ kill -s 9 312
Example 1b
The signal SIGKILL(9) is used to terminate process number 312:
$ kill -9 312
Page 3 Reliant UNIX 5.44 Printed 11/98
kill(1) kill(1)
Example 2
The find commands running in the background are terminated by sending
the signal SIGTERM(15) to all processes with your process group ID.
The shell (sh) associated with the same process group by default
ignores SIGTERM.
$ ps
PID PGID SID TTY TIME COMD
13320 13278 13278 tty004 0:08 find
13324 13278 13278 tty004 0:00 ps
13278 13278 13278 tty004 0:01 sh
13322 13278 13278 tty004 0:04 find
$ kill -s TERM -- -13278
$ ps
PID PGID SID TTY TIME COMD
13336 13278 13278 tty004 0:00 ps
13278 13278 13278 tty004 0:01 sh
13320 Terminated
13322 Terminated
NOTES
kill exists both as an external command (/usr/bin/kill) and as a
built-in shell command, both in the Korn shell ksh(1) as well as in
the Bourne shell sh(1). The shell generates a new process to execute
/usr/bin/kill.
FILES
<sys/signal.h>
Header file in which the symbolic names of signals are defined.
SEE ALSO
ksh(1), ps(1), sh(1), trap(1), xpg4sh(1), kill(2), signal(2),
signal(5).
Page 4 Reliant UNIX 5.44 Printed 11/98