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