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