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