Greater grokking of pgrep
Using the pkill Command
A common reason for locating a process is that it is misbehaving or not responding and needs to be shut down. Pkill [2], which originated in Solaris just as pgrep did, simplifies this set of tasks by using options and extended regular expressions in the same way as pgrep. However, as with kill
or killall
, pkill includes the option to terminate results with SIGKILL (2)
, so that one command does the job of two.
Entered without any options, pkill
closes all processes that match results. Used carelessly, the pkill
command can easily crash a system by closing a core process, meaning that, the more precise the pattern in the command, the less likely something unexpected will happen.
Unlike pgrep, pkill also includes the option --signal SIGNAL
, which allows the sending of any other signal [3]. Most users will probably have few uses for this option, although on a network, a system administrator might use SIGINT (15)
to close down the terminal of a misbehaving process or SIGCHILD (17)
to close down a child of a parent process.
For most users, pkill is an extra with limited use. But, whether you administer one computer or thousands, pgrep is a much-needed addition to your toolkit. Learn even a handful of its basic options and tracking down processes becomes far easier.
Infos
« Previous 1 2 Next »
Buy this article as PDF
Pages: 4
(incl. VAT)