Information Technology Reference
In-Depth Information
The default response of processes that receive these signals is to terminate,
but this behavior can be changed on a process-by-process basis.
The signal can be specified using either its symbolic name (excluding the SIG
prefix) or its numeric value. If a signal is not specified, SIGTERM (15) is sent
by default. The PIDs of the processes to be terminated must be known. The
following listing shows the KILL signal (9) sent to several processes using the
kill command:
# kill -KILL 4220 4224 4229
#
4229 Killed
4224 Killed
4220 Killed
# kill -9 4247
#
4247 Killed
A PID preceded by a minus sign is interpreted as a process group ID, and the
signal is sent to all processes in that process group.
The pgrep and pkill Commands
The pgrep(1) and pkill(1) commands support viewing and terminating
processes by name or other attributes, such as UID, GID, and so on. Table
5.4 lists the command-line arguments supported by both the pgrep and the
pkill commands.
Table 5.4
Common pgrep and pkill Command-Line Arguments
Argument
Description
pattern
Regular expression to match against program name and/or
arguments
-f
Matches pattern against full arguments instead of program
name
-g Process Group ID
Matches processes with the specified process group ID
-G Real Group ID
Matches processes with the specified real group ID
-n
Matches only the newest process that meets the specified
criteria
-P Parent Process ID
Matches processes with the specified parent process ID
-s Process Session ID
Matches processes with the specified process session ID
-t Terminal Device Path
Matches processes associated with the specified terminal
device path
-u Effective User ID
Matches processes with the specified effective user ID
(continued)
Search WWH ::




Custom Search