Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kill(1) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

killall(8)

ksh(1)

ps(1)

sh(1)

kill(2)

sigaction(2)

kill(1)  —  Commands

OSF

NAME

kill − Sends a signal to a running process

SYNOPSIS

kill −l [exit_status]

kill −s signal_name process_ID ... 

kill [−signal_name | −signal_number] process_ID ... 

The kill command sends a signal to one or more running processes, by default the SIGTERM signal (signal number 15). 

DESCRIPTION

SIGTERM normally terminates processes that do not ignore or catch the signal. 

Specify the processes to be signaled by giving their process identification numbers (also known as process IDs or PIDs).  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 of commands. 

Specify the signal to send with −s signal_name.  In particular, SIGKILL (specified as −s KILL) terminates all running processes, including those not terminated by the default SIGTERM. Note that all numeric signal specifications except for 0 (zero) are obsolescent. 

Unless you are are operating with superuser authority, the process you wish to signal must belong to you.  When operating with superuser authority, you can signal any process. 

See the kill() system call for a complete discussion of kill.  (Note that the csh command contains a built-in subcommand named kill, but the command and subcommand do not necessarily work in the same way. For information on the subcommand, see csh.) 

Special Process IDs

There are several special process IDs you can specify to cause the following special actions:

0The signal is sent to all processes having a process group ID equal to the process group ID of the sender, except those with PIDs 0 and 1. 

−1If the effective user ID of the sender is not 0 (root), the signal is sent to all processes with a process group ID equal to the effective user ID of the sender, except those with PIDs 0 and 1.  If the effective user ID of the sender is 0 (root), the signal is sent to all processes, excluding numbers 0 and 1.

−PIDThe signal is sent to all processes whose process group number is equal to the absolute value of PID. 

Note that when you specify any negative PID, you must also specify the signal to be sent, even the default signal SIGTERM. 

FLAGS

−l [exit_status]
Lists signal names. If you specify an exit status (a numeric value) or the shell special parameter $?, which expands to the exit status of the most recent pipeline, kill prints the name of the terminating signal. 

−s signal_name
Specifies the signal to send, using one of the symbolic names defined for required signals or job control signals. Values of signal_name are recognized in both uppercase or lowercase letters, and without the SIG prefix. The symbolic name 0 (zero), which represents the value 0 (zero), is also recognized. The corresponding signal is sent instead of SIGTERM. 

−signal_name

−signal_number
Specifies the signal to send to the process. You can specify either a name, stripped of the SIG prefix (such as KILL), or a number (such as 9). For information about signal names and numbers, see the sigaction() system call. (Obsolescent)

EXAMPLES

     1.To terminate a given process, enter:

kill 1095

This terminates process 1095 by sending it the default SIGTERM signal. Note that process 1095 might not actually terminate if it has made special arrangements to ignore or catch the SIGTERM signal. 

     2.To terminate several processes that ignore the default signal, enter:

kill −s KILL 17285 15692

This sends SIGKILL to processes 17285 and 15692.  SIGKILL is a special signal that normally cannot be ignored or caught. 

     3.To terminate all of your background processes, enter:

kill 0

This sends the SIGTERM signal to all members of the shell process group.  This includes all background processes started with &.  Although the signal is sent to the shell, it has no effect because the shell ignores the default signal 15. 

     4.To terminate all your processes and log yourself out, enter:

kill −s KILL 0

This sends SIGKILL to all members of the shell process group. Because the shell cannot ignore SIGKILL, this also terminates the login shell and logs you out.  If you are using multiple windows, this closes the active window. 

     5.To terminate all processes that you own, enter:

kill −s KILL −1

This sends SIGKILL to all processes owned by you, even those that belong to other process groups. If you are using multiple windows, this closes all the windows. 

     6.To send the default signal SIGTERM with a negative PID such as −1, you must specify the signal explicitly:

kill −s TERM −1

     7.To send a different signal to a process, enter:

kill −s USR1 1103

This sends the SIGUSR1 signal to process 1103. The action taken on the SIGUSR1 signal is defined by the particular application you are running. (The name of the kill command is misleading because many signals, including SIGUSR1, do not terminate processes.) 

     8.To list the signal names in numerical order, stripped of the SIG prefix, enter:

kill −l

This results in the following:

HUPKILLSTOPXFSZ
INTBUSTSTPVTALRM
QUITSEGVCONTPROF
ILLSYSCHLDWINCH
TRAPPIPETTINUSR1
IOTALRMTTOUUSR2
EMTTERMIO
FPEURGXCPU

This list may vary from system to system.

FILES

/usr/include/signal.hSpecifies signal names. 

RELATED INFORMATION

Commands: csh(1), killall(8), ksh(1), ps(1), sh(1). 

Functions: kill(2), sigaction(2). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026