Name

kill

Synopsis

kill [options] ID

Description

Terminate each specified process ID or job ID. You must own the process or be a privileged user. This built-in is similar to /bin/kill described in Chapter 3 but also allows symbolic job names. Stubborn processes can be killed using signal 9.

Options

-l

List the signal names. (Used by itself.)

-signal

The signal number or name, without the SIG prefix (e.g., HUP, not SIGHUP). The command kill -l prints a list of the available signal names. The list varies by system architecture; for a PC-based system, it looks like this:

% kill -l
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2
PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG 
XCPU XFSZ VTALRM PROF WINCH POLL PWR UNUSED

The signals and their numbers are defined in /usr/include/asm/signal.h; look in that file to find the signals that apply to your system.

Examples

If you’ve issued the following command:

44% nroff -ms report &

you can terminate it in any of the following ways:

45% kill 19536     
                     Process ID
45% kill %         
                     Current job
45% kill %1        
                     Job number 1
45% kill %nr       
                     Initial string
45% kill %?report  
                     Matching string

Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.