Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

kill(1) [mojave man page]

KILL(1) 						    BSD General Commands Manual 						   KILL(1)

NAME
kill -- terminate or signal a process SYNOPSIS
kill [-s signal_name] pid ... kill -l [exit_status] kill -signal_name pid ... kill -signal_number pid ... DESCRIPTION
The kill utility sends a signal to the processes specified by the pid operands. Only the super-user may send signals to other users' processes. The options are as follows: -s signal_name A symbolic signal name specifying the signal to be sent instead of the default TERM. -l [exit_status] If no operand is given, list the signal names; otherwise, write the signal name corresponding to exit_status. -signal_name A symbolic signal name specifying the signal to be sent instead of the default TERM. -signal_number A non-negative decimal integer, specifying the signal to be sent instead of the default TERM. The following PIDs have special meanings: -1 If superuser, broadcast the signal to all processes; otherwise broadcast to all processes belonging to the user. Some of the more commonly used signals: 1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal) Some shells may provide a builtin kill command which is similar or identical to this utility. Consult the builtin(1) manual page. EXIT STATUS
The kill utility exits 0 on success, and >0 if an error occurs. EXAMPLES
Terminate the processes with PIDs 142 and 157: kill 142 157 Send the hangup signal (SIGHUP) to the process with PID 507: kill -s HUP 507 SEE ALSO
builtin(1), csh(1), killall(1), ps(1), sh(1), kill(2), sigaction(2) STANDARDS
The kill utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. HISTORY
A kill command appeared in Version 3 AT&T UNIX. BUGS
A replacement for the command ``kill 0'' for csh(1) users should be provided. BSD
April 28, 1995 BSD

Check Out this Related Man Page

kill(1) 							   User Commands							   kill(1)

NAME
kill - terminate or signal processes SYNOPSIS
/usr/bin/kill -s signal_name pid... /usr/bin/kill -l [exit_status] /usr/bin/kill [-signal_name] pid... /usr/bin/kill [-signal_number] pid... DESCRIPTION
The kill utility sends a signal to the process or processes specified by each pid operand. For each pid operand, the kill utility will perform actions equivalent to the kill(2) function called with the following arguments: 1. The value of the pid operand will be used as the pid argument. 2. The sig argument is the value specified by the -s option, the -signal_name option, or the -signal_number option, or, if none of these options is specified, by SIGTERM. The signaled process must belong to the current user unless the user is the super-user. See NOTES for descriptions of the shell built-in versions of kill. OPTIONS
The following options are supported: -l (The letter ell.) Writes all values of signal_name supported by the implementation, if no operand is given. If an exit_sta- tus operand is given and it is a value of the ? shell special parameter and wait corresponding to a process that was termi- nated by a signal, the signal_name corresponding to the signal that terminated the process will be written. If an exit_sta- tus operand is given and it is the unsigned decimal integer value of a signal number, the signal_name corresponding to that signal will be written. Otherwise, the results are unspecified. -s signal_name Specifies the signal to send, using one of the symbolic names defined in the <signal.h> description. Values of signal_name will be recognized in a case-independent fashion, without the SIG prefix. In addition, the symbolic name 0 will be recog- nized, representing the signal value zero. The corresponding signal will be sent instead of SIGTERM. -signal_name Equivalent to -s signal_name. -signal_number Specifies a non-negative decimal integer, signal_number, representing the signal to be used instead of SIGTERM, as the sig argument in the effective call to kill(2). OPERANDS
The following operands are supported: pid One of the following: 1. A decimal integer specifying a process or process group to be signaled. The process or processes selected by posi- tive, negative and zero values of the pid operand will be as described for the kill function. If process number 0 is specified, all processes in the process group are signaled. If the first pid operand is negative, it should be preceded by -- to keep it from being interpreted as an option. 2. A job control job ID that identifies a background process group to be signaled. The job control job ID notation is applicable only for invocations of kill in the current shell execution environment. Note: The job control job ID type of pid is available only on systems supporting the job control option. exit_status A decimal integer specifying a signal number or the exit status of a process terminated by a signal. USAGE
Process numbers can be found by using ps(1). The job control job ID notation is not required to work as expected when kill is operating in its own utility execution environment. In either of the following examples: example% nohup kill %1 & example% system( "kill %1"); kill operates in a different environment and will not share the shell's understanding of job numbers. OUTPUT
When the -l option is not specified, the standard output will not be used. When the -l option is specified, the symbolic name of each signal will be written in the following format: "%s%c", <signal_name>, <separator> where the <signal_name> is in upper-case, without the SIG prefix, and the <separator> will be either a newline character or a space charac- ter. For the last signal written, <separator> will be a newline character. When both the -l option and exit_status operand are specified, the symbolic name of the corresponding signal will be written in the follow- ing format: "%s ", <signal_name> EXAMPLES
Example 1: Sending the kill signal Any of the commands: example% kill -9 100 -165 example% kill -s kill 100 -165 example% kill -s KILL 100 -165 sends the SIGKILL signal to the process whose process ID is 100 and to all processes whose process group ID is 165, assuming the sending process has permission to send that signal to the specified processes, and that they exist. Example 2: Avoiding ambiguity with an initial negative number To avoid an ambiguity of an initial negative number argument specifying either a signal number or a process group, the former will always be the case. Therefore, to send the default signal to a process group (for example, 123), an application should use a command similar to one of the following: example% kill -TERM -123 example% kill -- -123 ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of kill: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 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. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), jobs(1), ksh(1), ps(1), sh(1), shell_builtins(1), wait(1), kill(2), signal(3C), signal.h(3HEAD), attributes(5), environ(5), stan- dards(5) NOTES
sh The Bourne shell, sh, has a built-in version of kill to provide the functionality of the kill command for processes identified with a jobid. The sh syntax is: kill [ -sig ] [ pid ] [ %job ]... kill -l csh The C-shell, csh, also has a built-in kill command, whose syntax is: kill [-sig][pid][%job]... kill -l The csh kill built-in sends the TERM (terminate) signal, by default, or the signal specified, to the specified process ID, the job indi- cated, or the current job. Signals are either given by number or by name. There is no default. Typing kill does not send a signal to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process is sent a CONT (continue) signal as well. -l Lists the signal names that can be sent. ksh The syntax of the ksh kill is: kill [-sig][pid][%job]... kill -l The ksh kill sends either the TERM (terminate) signal or the specified signal to the specified jobs or processes. Signals are either given by number or by names (as given in signal.h(3HEAD) stripped of the SIG prefix). If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process will be sent a CONT (continue) signal if it is stopped. The argument job can be the process id of a process that is not a member of one of the active jobs. In the second form, kill -l, the signal numbers and names are listed. SunOS 5.10 2 Oct 2001 kill(1)
Man Page