1 | .\" NOTE: changes to the manual page for "top" should be made in the |
---|
2 | .\" file "top.X" and NOT in the file "top.1". |
---|
3 | .nr N %topn% |
---|
4 | .nr D %delay% |
---|
5 | .TH TOP 1 Local |
---|
6 | .UC 4 |
---|
7 | .SH NAME |
---|
8 | top \- display and update information about the top cpu processes |
---|
9 | .SH SYNOPSIS |
---|
10 | .B top |
---|
11 | [ |
---|
12 | .B \-SbiInqu |
---|
13 | ] [ |
---|
14 | .BI \-d count |
---|
15 | ] [ |
---|
16 | .BI \-s time |
---|
17 | ] [ |
---|
18 | .BI \-o field |
---|
19 | ] [ |
---|
20 | .BI \-U username |
---|
21 | ] [ |
---|
22 | .I number |
---|
23 | ] |
---|
24 | .SH DESCRIPTION |
---|
25 | .\" This defines appropriate quote strings for nroff and troff |
---|
26 | .ds lq \&" |
---|
27 | .ds rq \&" |
---|
28 | .if t .ds lq `` |
---|
29 | .if t .ds rq '' |
---|
30 | .\" Just in case these number registers aren't set yet... |
---|
31 | .if \nN==0 .nr N 10 |
---|
32 | .if \nD==0 .nr D 5 |
---|
33 | .I Top |
---|
34 | displays the top |
---|
35 | .if !\nN==-1 \nN |
---|
36 | processes on the system and periodically updates this information. |
---|
37 | .if \nN==-1 \ |
---|
38 | \{\ |
---|
39 | If standard output is an intelligent terminal (see below) then |
---|
40 | as many processes as will fit on the terminal screen are displayed |
---|
41 | by default. Otherwise, a good number of them are shown (around 20). |
---|
42 | .\} |
---|
43 | Raw cpu percentage is used to rank the processes. If |
---|
44 | .I number |
---|
45 | is given, then the top |
---|
46 | .I number |
---|
47 | processes will be displayed instead of the default. |
---|
48 | .PP |
---|
49 | .I Top |
---|
50 | makes a distinction between terminals that support advanced capabilities |
---|
51 | and those that do not. This |
---|
52 | distinction affects the choice of defaults for certain options. In the |
---|
53 | remainder of this document, an \*(lqintelligent\*(rq terminal is one that |
---|
54 | supports cursor addressing, clear screen, and clear to end of line. |
---|
55 | Conversely, a \*(lqdumb\*(rq terminal is one that does not support such |
---|
56 | features. If the output of |
---|
57 | .I top |
---|
58 | is redirected to a file, it acts as if it were being run on a dumb |
---|
59 | terminal. |
---|
60 | .SH OPTIONS |
---|
61 | .TP |
---|
62 | .B \-S |
---|
63 | Show system processes in the display. Normally, system processes such as |
---|
64 | the pager and the swapper are not shown. This option makes them visible. |
---|
65 | .TP |
---|
66 | .B \-b |
---|
67 | Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is |
---|
68 | ignored. Interrupt characters (such as ^C and ^\e) still have an effect. |
---|
69 | This is the default on a dumb terminal, or when the output is not a terminal. |
---|
70 | .TP |
---|
71 | .B \-i |
---|
72 | Use \*(lqinteractive\*(rq mode. In this mode, any input is immediately |
---|
73 | read for processing. See the section on \*(lqInteractive Mode\*(rq |
---|
74 | for an explanation of |
---|
75 | which keys perform what functions. After the command is processed, the |
---|
76 | screen will immediately be updated, even if the command was not |
---|
77 | understood. This mode is the default when standard output is an |
---|
78 | intelligent terminal. |
---|
79 | .TP |
---|
80 | .B \-I |
---|
81 | Do not display idle processes. |
---|
82 | By default, top displays both active and idle processes. |
---|
83 | .TP |
---|
84 | .B \-n |
---|
85 | Use \*(lqnon-interactive\*(rq mode. This is indentical to \*(lqbatch\*(rq |
---|
86 | mode. |
---|
87 | .TP |
---|
88 | .B \-q |
---|
89 | Renice |
---|
90 | .I top |
---|
91 | to -20 so that it will run faster. This can be used when the system is |
---|
92 | being very sluggish to improve the possibility of discovering the problem. |
---|
93 | This option can only be used by root. |
---|
94 | .TP |
---|
95 | .B \-u |
---|
96 | Do not take the time to map uid numbers to usernames. Normally, |
---|
97 | .I top |
---|
98 | will read as much of the file \*(lq/etc/passwd\*(rq as is necessary to map |
---|
99 | all the user id numbers it encounters into login names. This option |
---|
100 | disables all that, while possibly decreasing execution time. The uid |
---|
101 | numbers are displayed instead of the names. |
---|
102 | .TP |
---|
103 | .BI \-d count |
---|
104 | Show only |
---|
105 | .I count |
---|
106 | displays, then exit. A display is considered to be one update of the |
---|
107 | screen. This option allows the user to select the number of displays he |
---|
108 | wants to see before |
---|
109 | .I top |
---|
110 | automatically exits. For intelligent terminals, no upper limit |
---|
111 | is set. The default is 1 for dumb terminals. |
---|
112 | .TP |
---|
113 | .BI \-s time |
---|
114 | Set the delay between screen updates to |
---|
115 | .I time |
---|
116 | seconds. The default delay between updates is \nD seconds. |
---|
117 | .TP |
---|
118 | .BI \-o field |
---|
119 | Sort the process display area on the specified field. The field name is |
---|
120 | the name of the column as seen in the output, but in lower case. Likely |
---|
121 | values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq, |
---|
122 | but may vary on different operating systems. Note that |
---|
123 | not all operating systems support this option. |
---|
124 | .TP |
---|
125 | .BI \-U username |
---|
126 | Show only those processes owned by |
---|
127 | .IR username . |
---|
128 | This option currently only accepts usernames and will not understand |
---|
129 | uid numbers. |
---|
130 | .PP |
---|
131 | Both |
---|
132 | .I count |
---|
133 | and |
---|
134 | .I number |
---|
135 | fields can be specified as \*(lqinfinite\*(rq, indicating that they can |
---|
136 | stretch as far as possible. This is accomplished by using any proper |
---|
137 | prefix of the keywords |
---|
138 | \*(lqinfinity\*(rq, |
---|
139 | \*(lqmaximum\*(rq, |
---|
140 | or |
---|
141 | \*(lqall\*(rq. |
---|
142 | The default for |
---|
143 | .I count |
---|
144 | on an intelligent terminal is, in fact, |
---|
145 | .BI infinity . |
---|
146 | .PP |
---|
147 | The environment variable |
---|
148 | .B TOP |
---|
149 | is examined for options before the command line is scanned. This enables |
---|
150 | a user to set his or her own defaults. The number of processes to display |
---|
151 | can also be specified in the environment variable |
---|
152 | .BR TOP . |
---|
153 | The options |
---|
154 | .BR \-I , |
---|
155 | .BR \-S , |
---|
156 | and |
---|
157 | .B \-u |
---|
158 | are actually toggles. A second specification of any of these options |
---|
159 | will negate the first. Thus a user who has the environment variable |
---|
160 | .B TOP |
---|
161 | set to \*(lq\-I\*(rq may use the command \*(lqtop \-I\*(rq to see idle processes. |
---|
162 | .SH "INTERACTIVE MODE" |
---|
163 | When |
---|
164 | .I top |
---|
165 | is running in \*(lqinteractive mode\*(rq, it reads commands from the |
---|
166 | terminal and acts upon them accordingly. In this mode, the terminal is |
---|
167 | put in \*(lqCBREAK\*(rq, so that a character will be |
---|
168 | processed as soon as it is typed. Almost always, a key will be |
---|
169 | pressed when |
---|
170 | .I top |
---|
171 | is between displays; that is, while it is waiting for |
---|
172 | .I time |
---|
173 | seconds to elapse. If this is the case, the command will be |
---|
174 | processed and the display will be updated immediately thereafter |
---|
175 | (reflecting any changes that the command may have specified). This |
---|
176 | happens even if the command was incorrect. If a key is pressed while |
---|
177 | .I top |
---|
178 | is in the middle of updating the display, it will finish the update and |
---|
179 | then process the command. Some commands require additional information, |
---|
180 | and the user will be prompted accordingly. While typing this information |
---|
181 | in, the user's erase and kill keys (as set up by the command |
---|
182 | .IR stty ) |
---|
183 | are recognized, and a newline terminates the input. |
---|
184 | .PP |
---|
185 | These commands are currently recognized (^L refers to control-L): |
---|
186 | .TP |
---|
187 | .B ^L |
---|
188 | Redraw the screen. |
---|
189 | .IP "\fBh\fP\ or\ \fB?\fP" |
---|
190 | Display a summary of the commands (help screen). |
---|
191 | .TP |
---|
192 | .B q |
---|
193 | Quit |
---|
194 | .IR top. |
---|
195 | .TP |
---|
196 | .B d |
---|
197 | Change the number of displays to show (prompt for new number). |
---|
198 | Remember that the next display counts as one, so typing |
---|
199 | .B d1 |
---|
200 | will make |
---|
201 | .I top |
---|
202 | show one final display and then immediately exit. |
---|
203 | .TP |
---|
204 | .B n or # |
---|
205 | Change the number of processes to display (prompt for new number). |
---|
206 | .TP |
---|
207 | .B s |
---|
208 | Change the number of seconds to delay between displays |
---|
209 | (prompt for new number). |
---|
210 | .TP |
---|
211 | .B k |
---|
212 | Send a signal (\*(lqkill\*(rq by default) to a list of processes. This |
---|
213 | acts similarly to the command |
---|
214 | .IR kill (1)). |
---|
215 | .TP |
---|
216 | .B r |
---|
217 | Change the priority (the \*(lqnice\*(rq) of a list of processes. |
---|
218 | This acts similarly to the command |
---|
219 | .IR renice (8)). |
---|
220 | .TP |
---|
221 | .B u |
---|
222 | Display only processes owned by a specific username (prompt for username). |
---|
223 | If the username specified is simply \*(lq+\*(rq, then processes belonging |
---|
224 | to all users will be displayed. |
---|
225 | .TP |
---|
226 | .B e |
---|
227 | Display a list of system errors (if any) generated by the last |
---|
228 | .BR k ill |
---|
229 | or |
---|
230 | .BR r enice |
---|
231 | command. |
---|
232 | .TP |
---|
233 | .B i |
---|
234 | (or |
---|
235 | .BR I) |
---|
236 | Toggle the display of idle processes. |
---|
237 | .SH "THE DISPLAY" |
---|
238 | The actual display varies depending on the specific variant of Unix |
---|
239 | that the machine is running. This description may not exactly match |
---|
240 | what is seen by top running on this particular machine. Differences |
---|
241 | are listed at the end of this manual entry. |
---|
242 | .PP |
---|
243 | The top few lines of the display show general information |
---|
244 | about the state of the system, including |
---|
245 | the last process id assigned to a process (on most systems), |
---|
246 | the three load averages, |
---|
247 | the current time, |
---|
248 | the number of existing processes, |
---|
249 | the number of processes in each state |
---|
250 | (sleeping, running, starting, zombies, and stopped), |
---|
251 | and a percentage of time spent in each of the processor states |
---|
252 | (user, nice, system, and idle). |
---|
253 | It also includes information about physial and virtual memory allocation. |
---|
254 | .PP |
---|
255 | The remainder of the screen displays information about individual |
---|
256 | processes. This display is similar in spirit to |
---|
257 | .IR ps (1) |
---|
258 | but it is not exactly the same. PID is the process id, USERNAME is the name |
---|
259 | of the process's owner (if |
---|
260 | .B \-u |
---|
261 | is specified, a UID column will be substituted for USERNAME), |
---|
262 | PRI is the current priority of the process, |
---|
263 | NICE is the nice amount (in the range \-20 to 20), |
---|
264 | SIZE is the total size of the process (text, data, and stack), |
---|
265 | RES is the current amount of resident memory (both SIZE and RES are |
---|
266 | given in kilobytes), |
---|
267 | STATE is the current state (one of \*(lqsleep\*(rq, \*(lqWAIT\*(rq, |
---|
268 | \*(lqrun\*(rq, \*(lqidl\*(rq, \*(lqzomb\*(rq, or \*(lqstop\*(rq), |
---|
269 | TIME is the number of system and user cpu seconds that the process has used, |
---|
270 | WCPU, when displayed, is the weighted cpu percentage (this is the same |
---|
271 | value that |
---|
272 | .IR ps (1) |
---|
273 | displays as CPU), |
---|
274 | CPU is the raw percentage and is the field that is sorted to determine |
---|
275 | the order of the processes, and |
---|
276 | COMMAND is the name of the command that the process is currently running |
---|
277 | (if the process is swapped out, this column is marked \*(lq<swapped>\*(rq). |
---|
278 | .SH NOTES |
---|
279 | The \*(lqABANDONED\*(rq state (known in the kernel as \*(lqSWAIT\*(rq) was |
---|
280 | abandoned, thus the name. A process should never end up in this state. |
---|
281 | .SH AUTHOR |
---|
282 | William LeFebvre, EECS Department, Northwestern University |
---|
283 | .SH ENVIRONMENT |
---|
284 | .DT |
---|
285 | TOP user-configurable defaults for options. |
---|
286 | .SH FILES |
---|
287 | .DT |
---|
288 | /dev/kmem kernel memory |
---|
289 | .br |
---|
290 | /dev/mem physical memory |
---|
291 | .br |
---|
292 | /etc/passwd used to map uid numbers to user names |
---|
293 | .br |
---|
294 | /vmunix system image |
---|
295 | .SH BUGS |
---|
296 | Don't shoot me, but the default for |
---|
297 | .B \-I |
---|
298 | has changed once again. So many people were confused by the fact that |
---|
299 | .I top |
---|
300 | wasn't showing them all the processes that I have decided to make the |
---|
301 | default behavior show idle processes, just like it did in version 2. |
---|
302 | But to appease folks who can't stand that behavior, I have added the |
---|
303 | ability to set \*(lqdefault\*(rq options in the environment variable |
---|
304 | .B TOP |
---|
305 | (see the OPTIONS section). Those who want the behavior that version |
---|
306 | 3.0 had need only set the environment variable |
---|
307 | .B TOP |
---|
308 | to \*(lq\-I\*(rq. |
---|
309 | .PP |
---|
310 | The command name for swapped processes should be tracked down, but this |
---|
311 | would make the program run slower. |
---|
312 | .PP |
---|
313 | As with |
---|
314 | .IR ps (1), |
---|
315 | things can change while |
---|
316 | .I top |
---|
317 | is collecting information for an update. The picture it gives is only a |
---|
318 | close approximation to reality. |
---|
319 | .SH "SEE ALSO" |
---|
320 | kill(1), |
---|
321 | ps(1), |
---|
322 | stty(1), |
---|
323 | mem(4), |
---|
324 | renice(8) |
---|