kill
PURPOSE
Sends a signal to a running process.
SYNOPSIS
kill [ -signo ] process-id ...
DESCRIPTION
The kill command sends a signal to a running process, by
default signal 15 (Software Terminate). This default
action normally kills processes that do not catch or
ignore the signal. You specify a process by giving its
process-ID (process identification number, or PID). The
shell reports the PID of each process that is running in
the background (unless you start more than one process in
a pipeline, in which case the shell reports the number of
the last process). You can also use the ps command to
find the process ID number of commands.
In addition, there are special process-IDs that cause the
following special actions:
0 The signal is sent to all processes having a
process-group ID equal to the process-group
ID of the sender (except those with PID's 0
and 1).
-1 If the effective user ID of the sender is
not 0 (root), signal is sent to all proc-
esses with a process-group ID equal to the
effective user ID of the sender. (except
those with PID's 0 and 1).
If the effective user ID of the sender is 0
(root), signal is sent to all processes,
excluding numbers 0 and 1.
-process-ID The signal is sent to all processes whose
process-group number is equal to the abso-
lute value of process-ID. Note that when
you specify a minus PID, you must also
specify the signal to be sent, even signal
15.
See the kill system call in AIX Operating System Tech-
nical Reference for a complete discussion of kill. For a
list of signal numbers, see the signal systems call in
AIX Operating System Technical Reference.
Unless you are are operating with superuser authority,
the process you wish to stop must belong to you. When
operating with superuser authority, you can stop any
process.
EXAMPLES
1. To stop a given process:
kill 1095
This stops process "1095" by sending it the default
signal, 15 (also called SIGTERM). Note that process
"1095" might not actually stop if it has made special
arrangements to ignore or override signal 15.
2. To stop several processes that ignore the default
signal:
kill -9 1034 1095
This sends signal "9" (SIGKILL) to processes "1034"
and "1095". Signal 9 is a special signal that
normally cannot be ignored or overridden.
3. To stop all of your background processes:
kill 0
This sends signal 15 to all members of the shell
process group. This includes all background proc-
esses started with "&". (See page about running
background processes.) Although the signal is sent
to the shell, it has no effect because the shell
ignores signal 15.
4. To stop all of your processes and log yourself out:
kill -9 0
This sends signal "9" to all members of the shell
process group. Because the shell cannot ignore
signal 9, this also stops the login shell and logs
you out. If you are using multiple windows on a
high-function terminal, then this closes the active
window.
5. To stop all processes that you own:
kill -9 -1
This sends signal "9" to all processes owned by the
effective user, even those started at other work
stations and that belong to other process groups. If
you are using multiple windows on a high-function
terminal, then this closes all of the windows. If a
listing that you requested is being printed, then it
is also stopped.
Note: To send signal 15 with this form of the kill
command, you must specify "-15" explicitly:
kill -15 -1
6. To send a different signal code to a process:
kill -16 1103
This sends signal "16" (SIGUSR1) to process "1103".
The name of the kill command is misleading because
many signals, including "16", do not stop processes.
The action taken on signal "16" is defined by the
particular application you are running.
RELATED INFORMATION
The following commands: "csh," "ps," and "sh."
Note: The csh command contains a built-in subcommand
named kill. The command and subcommand do not neces-
sarily work the same way. For information on the subcom-
mand, see the csh command.
The kill and signal system calls in AIX Operating System
Technical Reference.