]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/top/top.X
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 \-abCHIijnPqStuvz
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 \-H
93 Display each thread for a multithreaded process individually.
94 By default a single summary line is displayed for each process.
95 .TP
96 .B \-i
97 Use \*(lqinteractive\*(rq mode.  In this mode, any input is immediately
98 read for processing.  See the section on \*(lqInteractive Mode\*(rq
99 for an explanation of
100 which keys perform what functions.  After the command is processed, the
101 screen will immediately be updated, even if the command was not
102 understood.  This mode is the default when standard output is an
103 intelligent terminal.
104 .TP
105 .B \-I
106 Do not display idle processes.
107 By default, top displays both active and idle processes.
108 .TP
109 .B \-j
110 Display the
111 .IR jail (8)
112 ID.
113 .TP
114 .B \-t
115 Do not display the
116 .I top
117 process.
118 .TP
119 .BI \-m display
120 Display either 'cpu' or 'io' statistics.  Default is 'cpu'.
121 .TP
122 .B \-n
123 Use \*(lqnon-interactive\*(rq mode.  This is identical to \*(lqbatch\*(rq
124 mode.
125 .TP
126 .B \-P
127 Display per-cpu CPU usage statistics.
128 .TP
129 .B \-q
130 Renice
131 .I top
132 to -20 so that it will run faster.  This can be used when the system is
133 being very sluggish to improve the possibility of discovering the problem.
134 This option can only be used by root.
135 .TP
136 .B \-u
137 Do not take the time to map uid numbers to usernames.  Normally,
138 .I top
139 will read as much of the file \*(lq/etc/passwd\*(rq as is necessary to map
140 all the user id numbers it encounters into login names.  This option
141 disables all that, while possibly decreasing execution time.  The uid
142 numbers are displayed instead of the names.
143 .TP
144 .B \-v
145 Write version number information to stderr then exit immediately.
146 No other processing takes place when this option is used.  To see current
147 revision information while top is running, use the help command \*(lq?\*(rq.
148 .TP
149 .B \-z
150 Do not display the system idle process.
151 .TP
152 .BI \-d count
153 Show only
154 .I count
155 displays, then exit.  A display is considered to be one update of the
156 screen.  This option allows the user to select the number of displays he
157 wants to see before
158 .I top
159 automatically exits.  For intelligent terminals, no upper limit
160 is set.  The default is 1 for dumb terminals.
161 .TP
162 .BI \-s time
163 Set the delay between screen updates to
164 .I time
165 seconds.  The default delay between updates is \nD seconds.
166 .TP
167 .BI \-o field
168 Sort the process display area on the specified field.  The field name is
169 the name of the column as seen in the output, but in lower case.  Likely
170 values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq,
171 but may vary on different operating systems.  Note that
172 not all operating systems support this option.
173 .TP
174 .BI \-U username
175 Show only those processes owned by
176 .IR username .
177 This option currently only accepts usernames and will not understand
178 uid numbers.
179 .PP
180 Both
181 .I count
182 and
183 .I number
184 fields can be specified as \*(lqinfinite\*(rq, indicating that they can
185 stretch as far as possible.  This is accomplished by using any proper
186 prefix of the keywords
187 \*(lqinfinity\*(rq,
188 \*(lqmaximum\*(rq,
189 or
190 \*(lqall\*(rq.
191 The default for
192 .I count
193 on an intelligent terminal is, in fact,
194 .BI infinity .
195 .PP
196 The environment variable
197 .B TOP
198 is examined for options before the command line is scanned.  This enables
199 a user to set his or her own defaults.  The number of processes to display
200 can also be specified in the environment variable
201 .BR TOP .
202 The options
203 .BR \-a ,
204 .BR \-C ,
205 .BR \-H ,
206 .BR \-I ,
207 .BR \-j ,
208 .BR \-P ,
209 .BR \-S ,
210 .BR \-t ,
211 .BR \-u ,
212 and
213 .B \-z
214 are actually toggles.  A second specification of any of these options
215 will negate the first.  Thus a user who has the environment variable
216 .B TOP
217 set to \*(lq\-I\*(rq may use the command \*(lqtop \-I\*(rq to see idle processes.
218 .SH "INTERACTIVE MODE"
219 When
220 .I top
221 is running in \*(lqinteractive mode\*(rq, it reads commands from the
222 terminal and acts upon them accordingly.  In this mode, the terminal is
223 put in \*(lqCBREAK\*(rq, so that a character will be
224 processed as soon as it is typed.  Almost always, a key will be
225 pressed when
226 .I top
227 is between displays; that is, while it is waiting for
228 .I time
229 seconds to elapse.  If this is the case, the command will be
230 processed and the display will be updated immediately thereafter
231 (reflecting any changes that the command may have specified).  This
232 happens even if the command was incorrect.  If a key is pressed while 
233 .I top
234 is in the middle of updating the display, it will finish the update and
235 then process the command.  Some commands require additional information,
236 and the user will be prompted accordingly.  While typing this information
237 in, the user's erase and kill keys (as set up by the command
238 .IR stty )
239 are recognized, and a newline terminates the input.
240 .PP
241 These commands are currently recognized (^L refers to control-L):
242 .TP
243 .B ^L
244 Redraw the screen.
245 .IP "\fBh\fP\ or\ \fB?\fP"
246 Display a summary of the commands (help screen).  Version information
247 is included in this display.
248 .TP
249 .B q
250 Quit
251 .IR top.
252 .TP
253 .B d
254 Change the number of displays to show (prompt for new number).
255 Remember that the next display counts as one, so typing
256 .B d1
257 will make
258 .I top
259 show one final display and then immediately exit.
260 .TP
261 .B m
262 Toggle the display between 'cpu' and 'io' modes.
263 .TP
264 .B n or #
265 Change the number of processes to display (prompt for new number).
266 .TP
267 .B s
268 Change the number of seconds to delay between displays
269 (prompt for new number).
270 .TP
271 .B S
272 Toggle the display of system processes.
273 .TP
274 .B a
275 Toggle the display of process titles.
276 .TP
277 .B k
278 Send a signal (\*(lqkill\*(rq by default) to a list of processes.  This
279 acts similarly to the command
280 .IR kill (1)).
281 .TP
282 .B r
283 Change the priority (the \*(lqnice\*(rq) of a list of processes.
284 This acts similarly to the command
285 .IR renice (8)).
286 .TP
287 .B u
288 Display only processes owned by a specific username (prompt for username).
289 If the username specified is simply \*(lq+\*(rq, then processes belonging
290 to all users will be displayed.
291 .TP
292 .B o
293 Change the order in which the display is sorted.  This command is not
294 available on all systems.  The sort key names vary from system to system
295 but usually include:  \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq,
296 \*(lqtime\*(rq.  The default is cpu.
297 .TP
298 .B e
299 Display a list of system errors (if any) generated by the last
300 .BR k ill
301 or
302 .BR r enice
303 command.
304 .TP
305 .B H
306 Toggle the display of threads.
307 .TP
308 .B i
309 (or
310 .BR I )
311 Toggle the display of idle processes.
312 .TP
313 .B j
314 Toggle the display of
315 .IR jail (8)
316 ID.
317 .TP
318 .B P
319 Toggle the display of per-CPU statistics.
320 .TP
321 .B t
322 Toggle the display of the
323 .I top
324 process.
325 .TP
326 .B z
327 Toggle the display of the system idle process.
328 .SH "THE DISPLAY"
329 The actual display varies depending on the specific variant of Unix
330 that the machine is running.  This description may not exactly match
331 what is seen by top running on this particular machine.  Differences
332 are listed at the end of this manual entry.
333 .PP
334 The top few lines of the display show general information
335 about the state of the system, including
336 the last process id assigned to a process (on most systems),
337 the three load averages,
338 the current time,
339 the number of existing processes,
340 the number of processes in each state
341 (sleeping, running, starting, zombies, and stopped),
342 and a percentage of time spent in each of the processor states
343 (user, nice, system, and idle).
344 It also includes information about physical and virtual memory allocation.
345 .PP
346 The remainder of the screen displays information about individual
347 processes.  This display is similar in spirit to
348 .IR ps (1)
349 but it is not exactly the same.  PID is the process id, 
350 JID, when displayed, is the 
351 .IR jail (8)
352 ID corresponding to the process,
353 USERNAME is the name of the process's owner (if
354 .B \-u
355 is specified, a UID column will be substituted for USERNAME),
356 PRI is the current priority of the process,
357 NICE is the nice amount (in the range \-20 to 20),
358 SIZE is the total size of the process (text, data, and stack),
359 RES is the current amount of resident memory (both SIZE and RES are
360 given in kilobytes),
361 STATE is the current state (one of \*(lqSTART\*(rq, \*(lqRUN\*(rq
362 (shown as \*(lqCPUn\*(rq on SMP systems), \*(lqSLEEP\*(rq, \*(lqSTOP\*(rq,
363 \*(lqZOMB\*(rq, \*(lqWAIT\*(rq, \*(lqLOCK\*(rq or the event on which the
364 process waits),
365 C is the processor number on which the process is executing
366 (visible only on SMP systems),
367 TIME is the number of system and user cpu seconds that the process has used,
368 WCPU, when displayed, is the weighted cpu percentage (this is the same
369 value that
370 .IR ps (1)
371 displays as CPU),
372 CPU is the raw percentage and is the field that is sorted to determine
373 the order of the processes, and
374 COMMAND is the name of the command that the process is currently running
375 (if the process is swapped out, this column is marked \*(lq<swapped>\*(rq).
376 .SH NOTES
377 If a process is in the \*(lqSLEEP\*(rq or \*(lqLOCK\*(rq state,
378 the state column will report the name of the event or lock on which the
379 process is waiting.
380 Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events
381 are not.
382 .SH AUTHOR
383 William LeFebvre, EECS Department, Northwestern University
384 .SH ENVIRONMENT
385 .DT
386 TOP     user-configurable defaults for options.
387 .SH FILES
388 .DT
389 /dev/kmem               kernel memory
390 .br
391 /dev/mem                physical memory
392 .br
393 /etc/passwd             used to map uid numbers to user names
394 .br
395 /boot/kernel/kernel     system image
396 .SH BUGS
397 Don't shoot me, but the default for
398 .B \-I
399 has changed once again.  So many people were confused by the fact that
400 .I top
401 wasn't showing them all the processes that I have decided to make the
402 default behavior show idle processes, just like it did in version 2.
403 But to appease folks who can't stand that behavior, I have added the
404 ability to set \*(lqdefault\*(rq options in the environment variable
405 .B TOP
406 (see the OPTIONS section).  Those who want the behavior that version
407 3.0 had need only set the environment variable
408 .B TOP
409 to \*(lq\-I\*(rq.
410 .PP
411 The command name for swapped processes should be tracked down, but this
412 would make the program run slower.
413 .PP
414 As with
415 .IR ps (1),
416 things can change while
417 .I top
418 is collecting information for an update.  The picture it gives is only a
419 close approximation to reality.
420 .SH "SEE ALSO"
421 kill(1),
422 ps(1),
423 stty(1),
424 mem(4),
425 renice(8)