Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > K

kill(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

kill — send a signal to a process; terminate a process

SYNOPSIS

kill [-s signame] pid ...

kill [-s signum] pid ...

kill -l

Obsolescent Versions:

kill -signame pid ...

kill -signum pid ...

DESCRIPTION

The kill command sends a signal to each process specified by a pid process identifier. The default signal is SIGTERM, which normally terminates processes that do not trap or ignore the signal.

Options

kill recognizes the following options:

-l (ell)

List all values of signame supported by the implementation. No signals are sent with this option. The symbolic names of the signals (without the SIG prefix) are written to standard output, separated by spaces and newlines.

-s signame

Send the specified signal name. The default is SIGTERM, number 15. signame can be specified in upper- and/or lowercase, with or without the SIG prefix. These values can be obtained by using the -l option. The symbolic name SIGNULL represents signal value zero. See "Signal Names and Numbers" below.

-s signum

Send the specified decimal signal number. The default is 15, SIGTERM. See "Signal Names and Numbers" below.

-signame

(Obsolescent.) Equivalent to -s signame.

-signum

(Obsolescent.) Equivalent to -s signum.

Operands

pid is a process identifier, an unsigned or negative integer that can be one of the following:

> 0

The number of a process.

= 0

All processes, except special system processes, whose process group ID is equal to the process group ID of the sender.

=-1

All processes, except special system processes, if the user has appropriate privileges. Otherwise, all processes, except special system processes, whose real or effective user ID is the same as the user ID of the sending process.

<-1

All processes, except special system processes, whose process group ID is equal to the absolute value of pid and whose real or effective user ID is the same as the user of the sending process.

Process numbers can be found with the ps command (see ps(1)) and with the built-in jobs command available in some shells.

Signal Names and Numbers

The following table describes a few of the more common signals that can be useful from a terminal. For a complete list and a full description, see the header file <signal.h> and the manual entry signal(5).

signumsignameNameDescription
0SIGNULLNullCheck access to pid
1SIGHUPHangupTerminate; can be trapped
2SIGINTInterruptTerminate; can be trapped
3SIGQUITQuitTerminate with core dump; can be trapped
9SIGKILLKillForced termination; cannot be trapped
15SIGTERMTerminateTerminate; can be trapped
24SIGSTOPStopPause the process; cannot be trapped
25SIGTSTPTerminal stopPause the process; can be trapped
26SIGCONTContinueRun a stopped process

SIGNULL (0), the null signal, invokes error checking but no signal is actually sent. This can be used to test the validity or existence of pid.

SIGTERM (15), the (default) terminate signal, can be trapped by the receiving process, allowing the receiver to execute an orderly shutdown or to ignore the signal entirely. For orderly operations, this is the preferred choice.

SIGKILL (9), the kill signal, forces a process to terminate immediately. Since SIGKILL cannot be trapped or ignored, it is useful for terminating a process that does not respond to SIGTERM.

The receiving process must belong to the user of the sending process, unless the user has appropriate privileges.

As a single special case, the continue signal SIGCONT can be sent to any process that is a member of the same session as the sending process.

RETURN VALUE

Upon completion, kill returns with one of the following values:

0

At least one matching process was found for each pid operand, and the specified signal was successfully processed for at least one matching process.

>0

An error occurred.

EXAMPLES

The command:

kill 6135

signals process number 6135 to terminate. This gives the process an opportunity to exit gracefully (removing temporary files, etc.).

The following equivalent commands:

kill -s SIGKILL 6135 kill -s KILL 6135 kill -s 9 6135 kill -SIGKILL 6135 kill -KILL 6135 kill -9 6135

terminate process number 6135 abruptly by sending a SIGKILL signal to the process. This tells the kernel to remove the process immediately.

WARNINGS

If a process hangs during some operation (such as I/O) so that it is never scheduled, it cannot die until it is allowed to run. Thus, such a process may never go away after the kill. Similarly, defunct processes (see ps(1)) may have already finished executing, but remain on the system until their parent reaps them (see wait(2)). Using kill to send signals to them has no effect.

Some non-HP-UX implementations provide kill only as a shell built-in command.

DEPENDENCIES

This manual entry describes the external command /usr/bin/kill and the built-in kill command of the POSIX shell (see sh-posix(1)). Other shells, such as C and Korn (see csh(1) and ksh(1) respectively), also provide kill as a built-in command. The syntax for and output from these built-ins may be different.

STANDARDS CONFORMANCE

kill: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.