[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.18

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