kill
Send a signal to a process by PID.
Description
Sends a signal to one or more processes (or process groups) identified
by PID. Without a signal flag, sends SIGTERM. Also exposes the
canonical signal table via -l and -L, so it can be used to convert
between signal names and numbers without sending anything.
Inputs
kill(2)syscall vialibc::killfor delivery.- No
/procaccess; PIDs are passed straight through to the kernel.
Synopses
kill [options] <pid> [<pid> ...]
kill -l [<signal> ...]
kill -L
Arguments
| Flag | Description |
|---|---|
-s, --signal SIG | Signal to send – name or number. Default: TERM |
-<SIG> (e.g. -9, -KILL, -SIGKILL) | Same as -s SIG. Equivalent forms; the leading - plus signal spec is consumed if -s was not given |
-l, --list [SIG ...] | List signal names. With no arguments, prints all signal names separated by spaces. With arguments, converts each from name to number or number to name (one per line) |
-L, --table | Print the signal table – number and name pairs, eight per line |
--help | Print help |
-V, --version | Print version |
-- | End of options; subsequent arguments are PIDs even if they start with - |
<pid> | One or more PIDs to signal (see semantics below) |
PID semantics
Following kill(2):
| PID | Effect |
|---|---|
> 0 | Signal the process with that PID |
0 | Signal every process in the caller’s process group |
-1 | Signal every process the caller is permitted to signal, except init |
< -1 | Signal every process in the process group with PID |pid| |
A negative PID that follows -- is parsed as a PID. Without --, a
leading negative argument is consumed as the signal spec when -s was
not given.
Behavior
Signal selection precedence
-s SIG/--signal SIG- A leading
-Nor-NAMEargument (e.g.kill -9 1234,kill -KILL 1234) - Default:
TERM
Signal 0 is the null signal – delivery is checked but no signal is
sent. kill -0 PID is the standard way to test whether a process
exists and is signalable by the caller.
-l / --list
| Invocation | Output |
|---|---|
kill -l | All signal names (no SIG prefix), space-separated, one line |
kill -l N | Name for signal number N |
kill -l NAME | Number for signal name (with or without SIG prefix) |
kill -l N1 N2 ... | Each conversion on its own line |
-L / --table
Prints the signal table eight pairs per line, formatted as:
1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS 8 FPE
9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM 15 TERM 16 STKFLT
...
Supported signals
Standard signals 1–31 (HUP, INT, QUIT, ILL, TRAP, ABRT/IOT, BUS, FPE,
KILL, USR1, SEGV, USR2, PIPE, ALRM, TERM, STKFLT, CHLD/CLD, CONT, STOP,
TSTP, TTIN, TTOU, URG, XCPU, XFSZ, VTALRM, PROF, WINCH, IO/POLL, PWR,
SYS). Real-time signals (SIGRTMIN..SIGRTMAX) are not yet listed by -l
or -L but can still be sent by number.
Exit codes
| Code | Meaning |
|---|---|
| 0 | All signals delivered successfully (or a successful list/table operation) |
| 1 | At least one signal delivery failed (no such process, permission denied, etc.) |
| 2 | Usage error (unknown signal, no PIDs given, invalid PID) |