manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.1 kill: Send a signal to processes

The kill command sends a signal to processes, causing them to terminate or otherwise act upon receiving the signal in some way. Alternatively, it lists information about signals. Synopses:

 
kill [-s signal | --signal signal | -signal] pid…
kill [-l | --list | -t | --table] [signal]…

The first form of the kill command sends a signal to all pid arguments. The default signal to send if none is specified is ‘TERM’. The special signal number ‘0’ does not denote a valid signal, but can be used to test whether the pid arguments specify processes to which a signal could be sent.

If pid is positive, the signal is sent to the process with the process ID pid. If pid is zero, the signal is sent to all processes in the process group of the current process. If pid is -1, the signal is sent to all processes for which the user has permission to send a signal. If pid is less than -1, the signal is sent to all processes in the process group that equals the absolute value of pid.

If pid is not positive, a system-dependent set of system processes is excluded from the list of processes to which the signal is sent.

If a negative PID argument is desired as the first one, it should be preceded by ‘--’. However, as a common extension to POSIX, ‘--’ is not required with ‘kill -signal -pid’. The following commands are equivalent:

 
kill -15 -1
kill -TERM -1
kill -s TERM -- -1
kill -- -1

The first form of the kill command succeeds if every pid argument specifies at least one process that the signal was sent to.

The second form of the kill command lists signal information. Either the ‘-l’ or ‘--list’ option, or the ‘-t’ or ‘--table’ option must be specified. Without any signal argument, all supported signals are listed. The output of ‘-l’ or ‘--list’ is a list of the signal names, one per line; if signal is already a name, the signal number is printed instead. The output of ‘-t’ or ‘--table’ is a table of signal numbers, names, and descriptions. This form of the kill command succeeds if all signal arguments are valid and if there is no output error.

The kill command also supports the ‘--help’ and ‘--version’ options. See section Common options.

A signal may be a signal name like ‘HUP’, or a signal number like ‘1’, or an exit status of a process terminated by the signal. A signal name can be given in canonical form or prefixed by ‘SIG’. The case of the letters is ignored, except for the ‘-signal’ option which must use upper case to avoid ambiguity with lower case option letters. The following signal names and numbers are supported on all POSIX compliant systems:

HUP

1. Hangup.

INT

2. Terminal interrupt.

QUIT

3. Terminal quit.

ABRT

6. Process abort.

KILL

9. Kill (cannot be caught or ignored).

ALRM

14. Alarm Clock.

TERM

15. Termination.

Other supported signal names have system-dependent corresponding numbers. All systems conforming to POSIX 1003.1-2001 also support the following signals:

BUS

Access to an undefined portion of a memory object.

CHLD

Child process terminated, stopped, or continued.

CONT

Continue executing, if stopped.

FPE

Erroneous arithmetic operation.

ILL

Illegal Instruction.

PIPE

Write on a pipe with no one to read it.

SEGV

Invalid memory reference.

STOP

Stop executing (cannot be caught or ignored).

TSTP

Terminal stop.

TTIN

Background process attempting read.

TTOU

Background process attempting write.

URG

High bandwidth data is available at a socket.

USR1

User-defined signal 1.

USR2

User-defined signal 2.

POSIX 1003.1-2001 systems that support the XSI extension also support the following signals:

POLL

Pollable event.

PROF

Profiling timer expired.

SYS

Bad system call.

TRAP

Trace/breakpoint trap.

VTALRM

Virtual timer expired.

XCPU

CPU time limit exceeded.

XFSZ

File size limit exceeded.

POSIX 1003.1-2001 systems that support the XRT extension also support at least eight real-time signals called ‘RTMIN’, ‘RTMIN+1’, …, ‘RTMAX-1’, ‘RTMAX’.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.