Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

kill

Sends a signal to one or more processes or process groups.

The first argument is the signal, specified either as a name ('TERM', 'HUP', with or without SIG prefix) or as a number. The remaining arguments are PIDs to signal.

If the signal is negative, the absolute value is sent to the process group identified by each PID (using kill(-sig, -abs(pid))).

Signal 0 does not actually send a signal but checks whether the process exists and is reachable (permission check).

Returns the number of processes successfully signaled.

Synopsis

kill 'TERM', $pid;                # send SIGTERM by name
kill 15, $pid;                    # send SIGTERM by number
kill 'TERM', $pid1, $pid2;        # signal multiple processes
kill 0, $pid;                     # check if process exists
kill -15, $pgrp;                  # signal a process group

See Also

%SIG, POSIX signals, fork, waitpid