kill command (sends a signal)
- Organization of this page
Format
kill [-s {signame|signum}] {pid|-pid}... kill [-signame|-signum] {pid|-pid}...
Description
This command sends a signal to one or more processes. The specified signal it is sent to one or more specified processes. If no signal to be sent is specified, SIGTERM is sent. When you specify by name the signal that is to be sent, specify its name without the leading characters SIG (for example, specify INT for SIGINT). For the specification for each signal, see the documentation for the OS being used.
Arguments
- -s
-
Specifies that a signal to be sent is being specified by its signal number or signal name.
- signame|-signame
-
Specifies the signal name of the signal that is to be sent.
- signum|-signum
-
Specifies the signal number of the signal that is to be sent.
- pid
-
Specifies the process ID of a process that is to receive the signal.
- -pid
-
Specifies the process ID of a process when the signal is to be sent to all processes that belong to the specified process's process group. In Windows, you must specify a value greater than 0 to send the signal to multiple processes.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
1 |
Error termination |
Notes
-
In Windows, an error results if you specify any signal other than SIGKILL.
-
In Windows, when SIGKILL is specified, TerminateProcess() is used to forcibly terminate the process.
-
Even if the command syntax of this regular built-in command is invalid, it does not exit the shell that is executing the command.
-
To send the default signal (SIGTERM) in the -signame or -signum format to a process group (-pid), you must specify -- as the signal. If you do not specify --, the process group (-pid) will be interpreted as -signum. An example follows:
This example sends the default signal (SIGTERM) to process group 14588:
kill -- -14588
Usage examples
-
In UNIX, send SIGINT to process ID 4725.
kill -INT 4725
-
In Windows, forcibly terminate process ID 4725.
kill -KILL 4725