Sends a signal to running processes.
kill [ -s { SignalName | SignalNumber } ] ProcessID ...
kill [ - SignalName | - SignalNumber ] ProcessID ...
kill -l [ ExitStatus ]
The kill command sends a signal (by default, the SIGTERM signal) to a running process. This default action normally stops processes. If you want to stop a process, specify the process ID (PID) in the ProcessID variable. 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.
A root user can stop any process with the kill command. If you are not a root user, you must have initiated the process you want to stop.
SignalName is recognized in a case-independent fashion, without the SIG prefix.
If the specified SignalNumber is 0, the kill command checks the validity of the specified PID.
This command returns the following exit values:
0 | At least one matching process was found for each ProcessID operand, and the specified signal was successfully processed for at least one matching process. |
>0 | An error occurred. |
kill 1095This stops process 1095 by sending it the default SIGTERM signal. Note that process 1095 might not actually stop if it has made special arrangements to ignore or override the SIGTERM signal.
kill -kill 2098 1569This sends signal 9, the SIGKILL signal, to processes 2098 and 1569. The SIGKILL signal is a special signal that normally cannot be ignored or overridden.
kill -kill 0This sends signal 9, the SIGKILL signal, to all processes having a process group ID equal to the senders process group ID. Because the shell cannot ignore the SIGKILL signal, this also stops the login shell and logs you off.
kill -9 -1This sends signal 9, the SIGKILL signal, to all processes owned by the effective user, even those started at other work stations and that belong to other process groups. If a listing that you requested is being printed, it is also stopped.
kill -USR1 1103The name of the kill command is misleading because many signals, including SIGUSR1, do not stop processes. The action taken on SIGUSR1 is defined by the particular application you are running.
Note: To send signal 15, the SIGTERM signal with this form of the kill command, you must explicitly specify -15 or SIGTERM.
/usr/include/sys/signal.h | Specifies signal names. |
The csh command, ksh command, ps command, sh command.
The kill subroutine, sigaction subroutine.