Annotation of src/usr.bin/top/top.1, Revision 1.29
1.29 ! markus 1: .\" $OpenBSD: top.1,v 1.28 2005/05/25 02:19:43 jaredy Exp $
1.2 downsj 2: .\"
3: .\" Copyright (c) 1997, Jason Downs. All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\"
14: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
15: .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17: .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
18: .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19: .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20: .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21: .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24: .\" SUCH DAMAGE.
25: .\"
26: .Dd August 14, 1997
27: .Dt TOP 1
1.10 aaron 28: .Os
1.2 downsj 29: .Sh NAME
30: .Nm top
1.5 aaron 31: .Nd display and update information about the top CPU processes
1.2 downsj 32: .Sh SYNOPSIS
1.6 aaron 33: .Nm top
1.27 jmc 34: .Op Fl bIinqSu
1.2 downsj 35: .Op Fl d Ar count
1.23 jmc 36: .Op Fl o Ar field
1.25 otto 37: .Op Fl p Ar pid
1.2 downsj 38: .Op Fl s Ar time
39: .Op Fl U Ar username
40: .Op Ar number
41: .Sh DESCRIPTION
42: .Nm
43: displays the top processes on the system and periodically updates this
1.13 aaron 44: information.
45: If standard output is an intelligent terminal (see below) then
1.1 downsj 46: as many processes as will fit on the terminal screen are displayed
1.13 aaron 47: by default.
48: Otherwise, a good number of them are shown (around 20).
49: Raw CPU percentage is used to rank the processes.
50: If
1.2 downsj 51: .Ar number
1.1 downsj 52: is given, then the top
1.2 downsj 53: .Ar number
1.1 downsj 54: processes will be displayed instead of the default.
1.2 downsj 55: .Pp
56: .Nm
1.1 downsj 57: makes a distinction between terminals that support advanced capabilities
1.13 aaron 58: and those that do not.
59: This distinction affects the choice of defaults for certain options.
60: In the remainder of this document, an
1.2 downsj 61: .Em intelligent
62: terminal is one that supports cursor addressing, clear screen, and clear
1.13 aaron 63: to end of line.
64: Conversely, a
65: .Dq dumb
66: terminal is one that does not support such features.
67: If the output of
1.2 downsj 68: .Nm
1.1 downsj 69: is redirected to a file, it acts as if it were being run on a dumb
70: terminal.
1.12 aaron 71: .Pp
72: The options are as follows:
1.15 aaron 73: .Bl -tag -width Ds
1.2 downsj 74: .It Fl b
75: Use
76: .Em batch
1.13 aaron 77: mode.
78: In this mode, all input from the terminal is ignored.
79: Interrupt characters (such as
80: .Ql ^C
81: and
82: .Ql ^\e )
83: still have an effect.
1.1 downsj 84: This is the default on a dumb terminal, or when the output is not a terminal.
1.23 jmc 85: .It Fl d Ar count
86: Show only
87: .Ar count
88: displays, then exit.
89: A display is considered to be one update of the screen.
90: This option allows the user to select the number of displays
91: to be shown before
92: .Nm
93: automatically exits.
94: For intelligent terminals, no upper limit is set.
95: The default is 1 for dumb terminals.
1.27 jmc 96: .It Fl I
97: Do not display idle processes.
98: By default,
99: .Nm
100: displays both active and idle processes.
1.2 downsj 101: .It Fl i
102: Use
103: .Em interactive
1.13 aaron 104: mode.
105: In this mode, any input is immediately read for processing.
106: See the section on
1.2 downsj 107: .Sx INTERACTIVE MODE
1.13 aaron 108: for an explanation of which keys perform what functions.
109: After the command
1.2 downsj 110: is processed, the screen will immediately be updated, even if the command was
1.13 aaron 111: not understood.
112: This mode is the default when standard output is an intelligent terminal.
1.2 downsj 113: .It Fl n
1.10 aaron 114: Use
1.2 downsj 115: .Em non-interactive
1.13 aaron 116: mode.
117: This is identical to
1.2 downsj 118: .Em batch
1.1 downsj 119: mode.
1.23 jmc 120: .It Fl o Ar field
121: Sort the process display area using the specified field as the primary key.
122: The field name is the name of the column as seen in the output,
123: but in lower case.
124: The
125: .Ox
1.26 jaredy 126: version of
127: .Nm
128: supports
1.23 jmc 129: .Ar cpu ,
130: .Ar size ,
131: .Ar res ,
132: .Ar time ,
133: and
134: .Ar pri .
1.25 otto 135: .It Fl p Ar pid
136: Show only the process
137: .Ar pid .
1.2 downsj 138: .It Fl q
1.1 downsj 139: Renice
1.2 downsj 140: .Nm
1.26 jaredy 141: to \-20 so that it will run faster.
1.13 aaron 142: This can be used when the system is
1.1 downsj 143: being very sluggish to improve the possibility of discovering the problem.
144: This option can only be used by root.
1.27 jmc 145: .It Fl S
146: Show system processes in the display.
147: Normally, system processes such as the pager and the swapper are not shown.
148: This option makes them visible.
1.23 jmc 149: .It Fl s Ar time
150: Set the delay between screen updates to
151: .Ar time
152: seconds.
153: The value may be fractional, to permit delays of less than 1 second.
154: The default delay between updates is 5 seconds.
1.27 jmc 155: .It Fl U Ar username
156: Show only those processes owned by
157: .Ar username .
158: This option currently only accepts usernames and will not understand
159: UID numbers.
1.2 downsj 160: .It Fl u
1.13 aaron 161: Do not take the time to map UID numbers to usernames.
162: Normally,
1.2 downsj 163: .Nm
164: will read as much of the password database as is necessary to map
1.13 aaron 165: all the user ID numbers it encounters into login names.
166: This option
167: disables all that, while possibly decreasing execution time.
168: The UID numbers are displayed instead of the names.
1.2 downsj 169: .El
170: .Pp
1.1 downsj 171: Both
1.2 downsj 172: .Ar count
1.1 downsj 173: and
1.2 downsj 174: .Ar number
175: fields can be specified as
176: .Li infinite ,
1.13 aaron 177: indicating that they can stretch as far as possible.
178: This is accomplished by using any proper prefix of the keywords
1.2 downsj 179: .Li infinity ,
180: .Li maximum ,
1.1 downsj 181: or
1.2 downsj 182: .Li all .
1.1 downsj 183: The default for
1.2 downsj 184: .Ar count
1.1 downsj 185: on an intelligent terminal is, in fact,
1.2 downsj 186: .Li infinity .
187: .Pp
1.1 downsj 188: The environment variable
1.2 downsj 189: .Ev TOP
1.13 aaron 190: is examined for options before the command line is scanned.
191: This enables a user to set his or her own defaults.
192: The number of processes to display
1.1 downsj 193: can also be specified in the environment variable
1.2 downsj 194: .Ev TOP .
195: .Pp
1.1 downsj 196: The options
1.2 downsj 197: .Fl I ,
198: .Fl S ,
1.1 downsj 199: and
1.2 downsj 200: .Fl u
1.13 aaron 201: are actually toggles.
202: A second specification of any of these options
203: will negate the first.
204: Thus a user who has the environment variable
1.2 downsj 205: .Ev TOP
1.10 aaron 206: set to
1.5 aaron 207: .Dq -I
1.10 aaron 208: may use the command
1.5 aaron 209: .Dq top -I
1.2 downsj 210: to see idle processes.
211: .Sh INTERACTIVE MODE
1.1 downsj 212: When
1.2 downsj 213: .Nm
214: is running in
215: .Em interactive mode ,
1.13 aaron 216: it reads commands from the terminal and acts upon them accordingly.
217: In this mode, the terminal is put in
1.2 downsj 218: .Dv CBREAK ,
1.13 aaron 219: so that a character will be processed as soon as it is typed.
220: Almost always, a key will be pressed when
1.2 downsj 221: .Nm
1.1 downsj 222: is between displays; that is, while it is waiting for
1.2 downsj 223: .Ar time
1.13 aaron 224: seconds to elapse.
225: If this is the case, the command will be
1.1 downsj 226: processed and the display will be updated immediately thereafter
1.13 aaron 227: (reflecting any changes that the command may have specified).
228: This happens even if the command was incorrect.
229: If a key is pressed while
1.2 downsj 230: .Nm
1.1 downsj 231: is in the middle of updating the display, it will finish the update and
1.13 aaron 232: then process the command.
233: Some commands require additional information,
234: and the user will be prompted accordingly.
235: While typing this information
1.1 downsj 236: in, the user's erase and kill keys (as set up by the command
1.2 downsj 237: .Xr stty 1 )
1.1 downsj 238: are recognized, and a newline terminates the input.
1.2 downsj 239: .Pp
1.1 downsj 240: These commands are currently recognized (^L refers to control-L):
1.2 downsj 241: .Bl -tag -width XxXXXX
1.27 jmc 242: .It h or \&?
243: Display a summary of the commands (help screen).
1.2 downsj 244: .It ^L
1.1 downsj 245: Redraw the screen.
1.2 downsj 246: .It q
1.1 downsj 247: Quit
1.2 downsj 248: .Nm top .
1.23 jmc 249: .El
250: .Pp
251: The following commands may not be available with overstrike terminals:
252: .Bl -tag -width XxXXXX
1.29 ! markus 253: .It C
! 254: Toggle the display of process command line arguments.
1.2 downsj 255: .It d
1.1 downsj 256: Change the number of displays to show (prompt for new number).
257: Remember that the next display counts as one, so typing
1.5 aaron 258: .Dq d1
1.1 downsj 259: will make
1.2 downsj 260: .Nm
1.1 downsj 261: show one final display and then immediately exit.
1.23 jmc 262: .It e
263: Display a list of system errors (if any) generated by the last
264: .Li kill
265: or
266: .Li renice
267: command.
1.27 jmc 268: .It I or i
1.23 jmc 269: Toggle the display of idle processes.
1.2 downsj 270: .It k
271: Send a signal
1.21 jmc 272: .Pf ( Dv TERM
1.13 aaron 273: by default) to a list of processes.
274: This acts similarly to the command
1.2 downsj 275: .Xr kill 1 .
1.23 jmc 276: .It n or #
277: Change the number of processes to display (prompt for new number).
278: .It o
279: Change the sorting order of the processes
280: .Pq prompt for order .
281: Values are the same as for the
282: .Fl o
283: flag, as detailed above.
1.25 otto 284: .It p
1.26 jaredy 285: Display a specific process (prompt for PID).
286: If the PID specified is simply
1.25 otto 287: .Dq + ,
288: then processes belonging to all users will be displayed.
1.2 downsj 289: .It r
290: Change the priority (the
291: .Em nice )
1.26 jaredy 292: of a list of processes (prompt for the new nice value and the list of
293: PIDs, all separated by space).
1.13 aaron 294: This acts similarly to the command
1.2 downsj 295: .Xr renice 8 .
1.27 jmc 296: .It S
297: Toggle the display of system processes.
1.23 jmc 298: .It s
299: Change the number of seconds to delay between displays
300: (prompt for new number).
1.2 downsj 301: .It u
1.1 downsj 302: Display only processes owned by a specific username (prompt for username).
1.2 downsj 303: If the username specified is simply
304: .Dq + ,
305: then processes belonging to all users will be displayed.
306: .El
307: .Sh THE DISPLAY
308: .\" The actual display varies depending on the specific variant of Unix
309: .\" that the machine is running. This description may not exactly match
310: .\" what is seen by top running on this particular machine. Differences
311: .\" are listed at the end of this manual entry.
312: .\" .Pp
1.1 downsj 313: The top few lines of the display show general information
314: about the state of the system, including
1.11 millert 315: .\" the last process ID assigned to a process,
1.2 downsj 316: .\" (on most systems),
1.24 millert 317: the three load average numbers,
1.1 downsj 318: the current time,
319: the number of existing processes,
320: the number of processes in each state
1.26 jaredy 321: (starting, running, idle, stopped, zombie, dead, and on processor),
1.1 downsj 322: and a percentage of time spent in each of the processor states
1.26 jaredy 323: (user, nice, system, interrupt, and idle).
1.17 aaron 324: It also includes information about physical and virtual memory allocation.
1.24 millert 325: The load average numbers give the number of jobs in the run queue averaged
1.26 jaredy 326: over 1, 5, and 15 minutes.
1.2 downsj 327: .Pp
1.1 downsj 328: The remainder of the screen displays information about individual
1.13 aaron 329: processes.
330: This display is similar in spirit to
1.2 downsj 331: .Xr ps 1
1.13 aaron 332: but it is not exactly the same.
1.26 jaredy 333: The following fields are displayed:
334: .Bl -tag -width USERNAME -offset indent
335: .It PID
336: The process ID.
337: .It USERNAME
338: The name of the process's owner.
339: .It UID
340: Used instead of USERNAME if
1.2 downsj 341: .Fl u
1.26 jaredy 342: is specified.
343: .It PRI
344: The current priority of the process.
345: .It NICE
346: The nice amount (in the range \-20 to 20).
347: .It SIZE
348: The total size of the process (the text, data, and stack segments).
349: .It RES
350: The current amount of resident memory.
351: .It STATE
352: The current state (one of
353: .Li start ,
354: .Li run ,
1.2 downsj 355: .Li sleep ,
1.26 jaredy 356: .Li stop ,
357: .Li idle ,
1.2 downsj 358: .Li zomb ,
1.26 jaredy 359: .Li dead ,
1.2 downsj 360: or
1.26 jaredy 361: .Li onproc ) .
362: On multi-processor systems, this is followed by a slash and the CPU
363: number on which the process is bound.
364: .It WAIT
365: A description of the wait channel the process is sleeping on if it's
366: asleep.
367: .It TIME
368: The number of system and user CPU seconds that the process has used.
369: .It CPU
370: The raw percentage of CPU usage and the default field on which the
371: display is sorted.
372: .It COMMAND
373: The name of the command that the process is currently running.
374: (If the process is swapped out, this column is enclosed by angle
375: brackets.)
376: .El
1.2 downsj 377: .Sh ENVIRONMENT
1.26 jaredy 378: .Bl -tag -width Ev
1.2 downsj 379: .It Ev TOP
380: User-configurable defaults for options.
381: .El
382: .Sh FILES
1.26 jaredy 383: .Bl -tag -width Pa -compact
1.2 downsj 384: .It Pa /dev/kmem
385: kernel memory
386: .It Pa /dev/mem
387: physical memory
1.26 jaredy 388: .It Pa /etc/passwd
389: used to map user ID to name
1.2 downsj 390: .It Pa /bsd
391: kernel image
1.14 aaron 392: .El
1.13 aaron 393: .Sh SEE ALSO
394: .Xr kill 1 ,
395: .Xr ps 1 ,
396: .Xr stty 1 ,
397: .Xr systat 1 ,
398: .Xr mem 4 ,
399: .Xr renice 8
1.16 aaron 400: .Sh AUTHORS
401: William LeFebvre, EECS Department, Northwestern University
1.2 downsj 402: .Sh BUGS
1.1 downsj 403: As with
1.2 downsj 404: .Xr ps 1 ,
1.1 downsj 405: things can change while
1.2 downsj 406: .Nm
1.13 aaron 407: is collecting information for an update.
408: The picture it gives is only a
1.1 downsj 409: close approximation to reality.