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