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