slackware-current/slackbook/html/process-control-top.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

168 lines
7.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>top</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Process Control" href="process-control.html" />
<link rel="PREVIOUS" title="kill" href="process-control-kill.html" />
<link rel="NEXT" title="Essential System Administration"
href="essential-sysadmin.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href="process-control-kill.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 11 Process Control</td>
<td width="10%" align="right" valign="bottom"><a href="essential-sysadmin.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="PROCESS-CONTROL-TOP" name="PROCESS-CONTROL-TOP">11.5 <tt
class="COMMAND">top</tt></a></h1>
<p>Finally, there's a command you can use to display updating information about the
processes running on the system. This command is called <tt class="COMMAND">top</tt>(1),
and is started like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">top</kbd>
</pre>
</td>
</tr>
</table>
<p>This will display a full screen of information about the processes running on the
system, as well as some overall information about the system. This includes load average,
number of processes, the CPU status, free memory information, and details about processes
including PID, user, priority, CPU and memory usage information, running time, and
program name.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
6:47pm up 1 day, 18:01, 1 user, load average: 0.02, 0.07, 0.02
61 processes: 59 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 2.8% user, 3.1% system, 0.0% nice, 93.9% idle
Mem: 257992K av, 249672K used, 8320K free, 51628K shrd, 78248K buff
Swap: 32764K av, 136K used, 32628K free, 82600K cached
<span class="emphasis"><i
class="EMPHASIS">PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND</i></span>
112 root 12 0 19376 18M 2468 R 0 3.7 7.5 55:53 X
4947 david 15 0 2136 2136 1748 S 0 2.3 0.8 0:00 screenshot
3398 david 7 0 20544 20M 3000 S 0 1.5 7.9 0:14 gimp
4946 root 12 0 1040 1040 836 R 0 1.5 0.4 0:00 top
121 david 4 0 796 796 644 S 0 1.1 0.3 25:37 wmSMPmon
115 david 3 0 2180 2180 1452 S 0 0.3 0.8 1:35 wmaker
4948 david 16 0 776 776 648 S 0 0.3 0.3 0:00 xwd
1 root 1 0 176 176 148 S 0 0.1 0.0 0:13 init
189 david 1 0 6256 6156 4352 S 0 0.1 2.4 3:16 licq
4734 david 0 0 1164 1164 916 S 0 0.1 0.4 0:00 rxvt
2 root 0 0 0 0 0 SW 0 0.0 0.0 0:08 kflushd
3 root 0 0 0 0 0 SW 0 0.0 0.0 0:06 kupdate
4 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kpiod
5 root 0 0 0 0 0 SW 0 0.0 0.0 0:04 kswapd
31 root 0 0 340 340 248 S 0 0.0 0.1 0:00 kerneld
51 root 0 0 48 48 32 S 0 0.0 0.0 0:00 dhcpcd
53 bin 0 0 316 316 236 S 0 0.0 0.1 0:00 rpc.portmap
57 root 0 0 588 588 488 S 0 0.0 0.2 0:01 syslogd
</pre>
</td>
</tr>
</table>
<p>It's called <tt class="COMMAND">top</tt> because the most CPU intensive programs will
be listed at the top. An interesting note is that top will be listed first on most
inactive (and some active) systems because of its CPU utilization. However, <tt
class="COMMAND">top</tt> is quite useful for determining what program is misbehaving and
needs to be killed off.</p>
<p>But suppose you only want a list of your own processes, or the processes of some other
user. The processes you want to see might not be among the most CPU intensive programs
currently running. The <var class="OPTION">-u</var> option allows you to specify a
username or UID and monitor only those processes owned by that UID.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">top -u alan</kbd>
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3622 alan 13 0 11012 10m 6956 S 1.0 2.1 0:03.66 gnome-terminal
3739 alan 13 0 1012 1012 804 R 0.3 0.2 0:00.06 top
3518 alan 9 0 1312 1312 1032 S 0.0 0.3 0:00.09 bash
3529 alan 9 0 984 984 848 S 0.0 0.2 0:00.00 startx
3544 alan 9 0 640 640 568 S 0.0 0.1 0:00.00 xinit
3548 alan 9 0 8324 8320 6044 S 0.0 1.6 0:00.30 gnome-session
3551 alan 9 0 7084 7084 1968 S 0.0 1.4 0:00.50 gconfd-2
3553 alan 9 0 2232 2232 380 S 0.0 0.4 0:00.05 esd
3555 alan 9 0 2552 2552 1948 S 0.0 0.5 0:00.10 bonobo-activati
3557 alan 9 0 2740 2740 2224 S 0.0 0.5 0:00.05 gnome-smproxy
3559 alan 9 0 6496 6492 5004 S 0.0 1.3 0:00.31 gnome-settings-
3565 alan 9 0 1740 1740 1440 S 0.0 0.3 0:00.28 xscreensaver
3568 alan 9 0 7052 7052 4960 S 0.0 1.4 0:02.28 metacity
3572 alan 9 0 11412 11m 7992 S 0.0 2.2 0:01.58 gnome-panel
3574 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.64 nautilus
3575 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.00 nautilus
3576 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.00 nautilus
</pre>
</td>
</tr>
</table>
<p>As you can see, I'm currently running <tt class="COMMAND">X</tt>, <tt
class="COMMAND">top</tt>, a <tt class="COMMAND">gnome-terminal</tt> (in which I'm writing
this) and many other X-related processes which take up the most CPU time for me. This is
a good way to monitor how hard your users are working your system.</p>
<p><tt class="COMMAND">top</tt> also supports monitoring processes by their PID, ignoring
idle and zombied processes, and many other options. The best place to get a handle on
these options is the man page for <tt class="COMMAND">top</tt>.</p>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="process-control-kill.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="essential-sysadmin.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top"><tt class="COMMAND">kill</tt></td>
<td width="34%" align="center" valign="top"><a href="process-control.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Essential System Administration</td>
</tr>
</table>
</div>
</body>
</html>