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