Information Technology Reference
In-Depth Information
Table 5.2
The prstat Command-Line Arguments
(continued)
Argument
Description
-S
key
Sorts report in ascending order based on key (
cpu
,
time
,
size
,
rss
, or
pri
).
-t
Reports total usage summary for each user.
-u
euids
Reports only processes whose effective UID is listed in
euids
.
-U
uids
Reports only processes whose real UID is listed in
uids
.
-v
Reports using verbose mode, which includes percentage of time in user
mode and system mode.
The following example shows the
prstat
command listing the processes
associated with the
ambro
account:
$ prstat -c -u ambro
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
9830 ambro 812K 696K cpu0 48 0 0:00.00 0.2% prstat/1
9789 ambro 2960K 2136K sleep 59 0 0:00.00 0.1% xterm/1
9790 ambro 808K 628K sleep 48 0 0:00.00 0.0% sh/1
Total: 3 processes, 3 lwps, load averages: 0.00, 0.00, 0.01
$
Be sure to understand that both
ps
and
prstat
provide information about active
processes. The
ps
command provides more user-oriented information (Parent PID,
TTY, start date, and so on), whereas the
prstat
command provides more system-
oriented information (process size, priority, CPU utilization, and so on).
The kill Command
The
kill(1)
command is used to terminate a process by sending a signal to
it that will cause it to exit. Many types of signals exist. The signals that are
typically used to terminate a process are listed in Table 5.3, and a complete
listing of base signals can be found in
signal(3HEAD)
.
Table 5.3
Signals Used to Terminate Processes
Symbolic Name
Value
Description
SIGHUP
1
Hangup
SIGINT
2
Interrupt
SIGKILL
9
Kill
SIGTERM
15
Terminate (default signal for the
kill
and
pkill
commands)
SIGUSR1
16
User signal 1
SIGUSR2
17
User signal 2