[BACK]Return to top.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Annotation of src/usr.bin/top/top.1, Revision 1.21

1.21    ! jmc         1: .\"    $OpenBSD: top.1,v 1.20 2003/06/03 21:09:02 deraadt 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.2       downsj     34: .Op Fl SbiInqu
                     35: .Op Fl d Ar count
                     36: .Op Fl s Ar time
1.4       kstailey   37: .Op Fl o Ar field
1.2       downsj     38: .Op Fl U Ar username
                     39: .Op Ar number
                     40: .Sh DESCRIPTION
                     41: .Nm
                     42: displays the top processes on the system and periodically updates this
1.13      aaron      43: information.
                     44: If standard output is an intelligent terminal (see below) then
1.1       downsj     45: as many processes as will fit on the terminal screen are displayed
1.13      aaron      46: by default.
                     47: Otherwise, a good number of them are shown (around 20).
                     48: Raw CPU percentage is used to rank the processes.
                     49: If
1.2       downsj     50: .Ar number
1.1       downsj     51: is given, then the top
1.2       downsj     52: .Ar number
1.1       downsj     53: processes will be displayed instead of the default.
1.2       downsj     54: .Pp
                     55: .Nm
1.1       downsj     56: makes a distinction between terminals that support advanced capabilities
1.13      aaron      57: and those that do not.
                     58: This distinction affects the choice of defaults for certain options.
                     59: In the remainder of this document, an
1.2       downsj     60: .Em intelligent
                     61: terminal is one that supports cursor addressing, clear screen, and clear
1.13      aaron      62: to end of line.
                     63: Conversely, a
                     64: .Dq dumb
                     65: terminal is one that does not support such features.
                     66: If the output of
1.2       downsj     67: .Nm
1.1       downsj     68: is redirected to a file, it acts as if it were being run on a dumb
                     69: terminal.
1.12      aaron      70: .Pp
                     71: The options are as follows:
1.15      aaron      72: .Bl -tag -width Ds
1.2       downsj     73: .It Fl S
1.13      aaron      74: Show system processes in the display.
                     75: Normally, system processes such as the pager and the swapper are not shown.
                     76: This option makes them visible.
1.2       downsj     77: .It Fl b
                     78: Use
                     79: .Em batch
1.13      aaron      80: mode.
                     81: In this mode, all input from the terminal is ignored.
                     82: Interrupt characters (such as
                     83: .Ql ^C
                     84: and
                     85: .Ql ^\e )
                     86: still have an effect.
1.1       downsj     87: This is the default on a dumb terminal, or when the output is not a terminal.
1.2       downsj     88: .It Fl i
                     89: Use
                     90: .Em interactive
1.13      aaron      91: mode.
                     92: In this mode, any input is immediately read for processing.
                     93: See the section on
1.2       downsj     94: .Sx INTERACTIVE MODE
1.13      aaron      95: for an explanation of which keys perform what functions.
                     96: After the command
1.2       downsj     97: is processed, the screen will immediately be updated, even if the command was
1.13      aaron      98: not understood.
                     99: This mode is the default when standard output is an intelligent terminal.
1.2       downsj    100: .It Fl I
1.1       downsj    101: Do not display idle processes.
                    102: By default, top displays both active and idle processes.
1.2       downsj    103: .It Fl n
1.10      aaron     104: Use
1.2       downsj    105: .Em non-interactive
1.13      aaron     106: mode.
                    107: This is identical to
1.2       downsj    108: .Em batch
1.1       downsj    109: mode.
1.2       downsj    110: .It Fl q
1.1       downsj    111: Renice
1.2       downsj    112: .Nm
1.13      aaron     113: to -20 so that it will run faster.
                    114: This can be used when the system is
1.1       downsj    115: being very sluggish to improve the possibility of discovering the problem.
                    116: This option can only be used by root.
1.2       downsj    117: .It Fl u
1.13      aaron     118: Do not take the time to map UID numbers to usernames.
                    119: Normally,
1.2       downsj    120: .Nm
                    121: will read as much of the password database as is necessary to map
1.13      aaron     122: all the user ID numbers it encounters into login names.
                    123: This option
                    124: disables all that, while possibly decreasing execution time.
                    125: The UID numbers are displayed instead of the names.
1.2       downsj    126: .It Fl d Ar count
1.1       downsj    127: Show only
1.2       downsj    128: .Ar count
1.13      aaron     129: displays, then exit.
                    130: A display is considered to be one update of the screen.
                    131: This option allows the user to select the number of displays
1.8       pjanzen   132: to be shown before
1.2       downsj    133: .Nm
1.13      aaron     134: automatically exits.
                    135: For intelligent terminals, no upper limit is set.
                    136: The default is 1 for dumb terminals.
1.2       downsj    137: .It Fl s Ar time
1.1       downsj    138: Set the delay between screen updates to
1.2       downsj    139: .Ar time
1.13      aaron     140: seconds.
1.19      hugh      141: The value may be fractional, to permit delays of less than 1 second.
1.13      aaron     142: The default delay between updates is 5 seconds.
1.4       kstailey  143: .It Fl o Ar field
1.13      aaron     144: Sort the process display area using the specified field as the primary key.
                    145: The field name is the name of the column as seen in the output,
                    146: but in lower case.
                    147: The
1.4       kstailey  148: .Ox
                    149: version of top supports
                    150: .Ar cpu ,
                    151: .Ar size ,
                    152: .Ar res ,
                    153: .Ar time ,
                    154: and
1.5       aaron     155: .Ar pri .
1.2       downsj    156: .It Fl U Ar username
1.1       downsj    157: Show only those processes owned by
1.2       downsj    158: .Ar username .
1.1       downsj    159: This option currently only accepts usernames and will not understand
1.5       aaron     160: UID numbers.
1.2       downsj    161: .El
                    162: .Pp
1.1       downsj    163: Both
1.2       downsj    164: .Ar count
1.1       downsj    165: and
1.2       downsj    166: .Ar number
                    167: fields can be specified as
                    168: .Li infinite ,
1.13      aaron     169: indicating that they can stretch as far as possible.
                    170: This is accomplished by using any proper prefix of the keywords
1.2       downsj    171: .Li infinity ,
                    172: .Li maximum ,
1.1       downsj    173: or
1.2       downsj    174: .Li all .
1.1       downsj    175: The default for
1.2       downsj    176: .Ar count
1.1       downsj    177: on an intelligent terminal is, in fact,
1.2       downsj    178: .Li infinity .
                    179: .Pp
1.1       downsj    180: The environment variable
1.2       downsj    181: .Ev TOP
1.13      aaron     182: is examined for options before the command line is scanned.
                    183: This enables a user to set his or her own defaults.
                    184: The number of processes to display
1.1       downsj    185: can also be specified in the environment variable
1.2       downsj    186: .Ev TOP .
                    187: .Pp
1.1       downsj    188: The options
1.2       downsj    189: .Fl I ,
                    190: .Fl S ,
1.1       downsj    191: and
1.2       downsj    192: .Fl u
1.13      aaron     193: are actually toggles.
                    194: A second specification of any of these options
                    195: will negate the first.
                    196: Thus a user who has the environment variable
1.2       downsj    197: .Ev TOP
1.10      aaron     198: set to
1.5       aaron     199: .Dq -I
1.10      aaron     200: may use the command
1.5       aaron     201: .Dq top -I
1.2       downsj    202: to see idle processes.
                    203: .Sh INTERACTIVE MODE
1.1       downsj    204: When
1.2       downsj    205: .Nm
                    206: is running in
                    207: .Em interactive mode ,
1.13      aaron     208: it reads commands from the terminal and acts upon them accordingly.
                    209: In this mode, the terminal is put in
1.2       downsj    210: .Dv CBREAK ,
1.13      aaron     211: so that a character will be processed as soon as it is typed.
                    212: Almost always, a key will be pressed when
1.2       downsj    213: .Nm
1.1       downsj    214: is between displays; that is, while it is waiting for
1.2       downsj    215: .Ar time
1.13      aaron     216: seconds to elapse.
                    217: If this is the case, the command will be
1.1       downsj    218: processed and the display will be updated immediately thereafter
1.13      aaron     219: (reflecting any changes that the command may have specified).
                    220: This happens even if the command was incorrect.
                    221: If a key is pressed while
1.2       downsj    222: .Nm
1.1       downsj    223: is in the middle of updating the display, it will finish the update and
1.13      aaron     224: then process the command.
                    225: Some commands require additional information,
                    226: and the user will be prompted accordingly.
                    227: While typing this information
1.1       downsj    228: in, the user's erase and kill keys (as set up by the command
1.2       downsj    229: .Xr stty 1 )
1.1       downsj    230: are recognized, and a newline terminates the input.
1.2       downsj    231: .Pp
1.1       downsj    232: These commands are currently recognized (^L refers to control-L):
1.2       downsj    233: .Bl -tag -width XxXXXX
                    234: .It ^L
1.1       downsj    235: Redraw the screen.
1.2       downsj    236: .It h or ?
1.1       downsj    237: Display a summary of the commands (help screen).
1.2       downsj    238: .It q
1.1       downsj    239: Quit
1.2       downsj    240: .Nm top .
                    241: .It d
1.1       downsj    242: Change the number of displays to show (prompt for new number).
                    243: Remember that the next display counts as one, so typing
1.5       aaron     244: .Dq d1
1.1       downsj    245: will make
1.2       downsj    246: .Nm
1.1       downsj    247: show one final display and then immediately exit.
1.2       downsj    248: .It n or #
1.1       downsj    249: Change the number of processes to display (prompt for new number).
1.2       downsj    250: .It s
1.1       downsj    251: Change the number of seconds to delay between displays
                    252: (prompt for new number).
1.2       downsj    253: .It k
                    254: Send a signal
1.21    ! jmc       255: .Pf ( Dv TERM
1.13      aaron     256: by default) to a list of processes.
                    257: This acts similarly to the command
1.2       downsj    258: .Xr kill 1 .
                    259: .It r
                    260: Change the priority (the
                    261: .Em nice )
1.13      aaron     262: of a list of processes.
                    263: This acts similarly to the command
1.2       downsj    264: .Xr renice 8 .
                    265: .It u
1.1       downsj    266: Display only processes owned by a specific username (prompt for username).
1.2       downsj    267: If the username specified is simply
                    268: .Dq + ,
                    269: then processes belonging to all users will be displayed.
                    270: .It e
1.1       downsj    271: Display a list of system errors (if any) generated by the last
1.2       downsj    272: .Li kill
1.1       downsj    273: or
1.2       downsj    274: .Li renice
1.1       downsj    275: command.
1.2       downsj    276: .It i or I
1.1       downsj    277: Toggle the display of idle processes.
1.18      fgsch     278: .It S
                    279: Toggle the display of system processes.
1.2       downsj    280: .El
                    281: .Sh THE DISPLAY
                    282: .\" The actual display varies depending on the specific variant of Unix
                    283: .\" that the machine is running.  This description may not exactly match
                    284: .\" what is seen by top running on this particular machine.  Differences
                    285: .\" are listed at the end of this manual entry.
                    286: .\" .Pp
1.1       downsj    287: The top few lines of the display show general information
                    288: about the state of the system, including
1.11      millert   289: .\" the last process ID assigned to a process,
1.2       downsj    290: .\" (on most systems),
1.1       downsj    291: the three load averages,
                    292: the current time,
                    293: the number of existing processes,
                    294: the number of processes in each state
                    295: (sleeping, running, starting, zombies, and stopped),
                    296: and a percentage of time spent in each of the processor states
                    297: (user, nice, system, and idle).
1.17      aaron     298: It also includes information about physical and virtual memory allocation.
1.2       downsj    299: .Pp
1.1       downsj    300: The remainder of the screen displays information about individual
1.13      aaron     301: processes.
                    302: This display is similar in spirit to
1.2       downsj    303: .Xr ps 1
1.13      aaron     304: but it is not exactly the same.
                    305: PID is the process ID, USERNAME is the name
1.1       downsj    306: of the process's owner (if
1.2       downsj    307: .Fl u
1.1       downsj    308: is specified, a UID column will be substituted for USERNAME),
                    309: PRI is the current priority of the process,
1.2       downsj    310: NICE is the nice amount (in the range -20 to 20),
1.1       downsj    311: SIZE is the total size of the process (text, data, and stack),
                    312: RES is the current amount of resident memory (both SIZE and RES are
                    313: given in kilobytes),
1.2       downsj    314: STATE is the current state (one of
                    315: .Li sleep ,
                    316: .Li WAIT ,
                    317: .Li run ,
                    318: .Li idl ,
                    319: .Li zomb ,
                    320: or
                    321: .Li stop ) ,
1.5       aaron     322: TIME is the number of system and user CPU seconds that the process has used,
                    323: WCPU, when displayed, is the weighted CPU percentage (this is the same
1.1       downsj    324: value that
1.2       downsj    325: .Xr ps 1
1.1       downsj    326: displays as CPU),
                    327: CPU is the raw percentage and is the field that is sorted to determine
                    328: the order of the processes, and
                    329: COMMAND is the name of the command that the process is currently running
1.2       downsj    330: (if the process is swapped out, this column is marked
                    331: .Li <swapped> ) .
                    332: .Sh NOTES
                    333: The
                    334: .Em ABANDONED
                    335: state (known in the kernel as
1.21    ! jmc       336: .Em SWAIT )
1.13      aaron     337: was abandoned, thus the name.
                    338: A process should never end up in this state.
1.2       downsj    339: .Sh ENVIRONMENT
                    340: .Bl -tag -width XxXXXX
                    341: .It Ev TOP
                    342: User-configurable defaults for options.
                    343: .El
                    344: .Sh FILES
                    345: .Bl -tag -width XxXXXXXXX -compact
                    346: .It Pa /dev/kmem
                    347: kernel memory
                    348: .It Pa /dev/mem
                    349: physical memory
                    350: .It Pa /bsd
                    351: kernel image
1.14      aaron     352: .El
1.13      aaron     353: .Sh SEE ALSO
                    354: .Xr kill 1 ,
                    355: .Xr ps 1 ,
                    356: .Xr stty 1 ,
                    357: .Xr systat 1 ,
                    358: .Xr mem 4 ,
                    359: .Xr renice 8
1.16      aaron     360: .Sh AUTHORS
                    361: William LeFebvre, EECS Department, Northwestern University
1.2       downsj    362: .Sh BUGS
1.1       downsj    363: Don't shoot me, but the default for
1.2       downsj    364: .Fl I
1.13      aaron     365: has changed once again.
                    366: So many people were confused by the fact that
1.2       downsj    367: .Nm
1.1       downsj    368: wasn't showing them all the processes that I have decided to make the
                    369: default behavior show idle processes, just like it did in version 2.
                    370: But to appease folks who can't stand that behavior, I have added the
1.2       downsj    371: ability to set
                    372: .Li default
                    373: options in the environment variable
                    374: .Ev TOP
                    375: (see the
                    376: .Sx OPTIONS
1.13      aaron     377: section).
                    378: Those who want the behavior that version 3.0 had need only set
1.2       downsj    379: the environment variable
                    380: .Ev TOP
                    381: to
                    382: .Li -I .
                    383: .Pp
1.1       downsj    384: The command name for swapped processes should be tracked down, but this
                    385: would make the program run slower.
1.2       downsj    386: .Pp
1.1       downsj    387: As with
1.2       downsj    388: .Xr ps 1 ,
1.1       downsj    389: things can change while
1.2       downsj    390: .Nm
1.13      aaron     391: is collecting information for an update.
                    392: The picture it gives is only a
1.1       downsj    393: close approximation to reality.