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

1.58    ! jmc         1: .\"    $OpenBSD: top.1,v 1.57 2010/08/10 20:34:16 sobrado 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: .\"
1.58    ! jmc        26: .Dd $Mdocdate: August 10 2010 $
1.2       downsj     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.45      jmc        34: .Bk -words
1.51      tedu       35: .Op Fl 1bCIinqSTu
1.2       downsj     36: .Op Fl d Ar count
1.45      jmc        37: .Op Fl g Ar string
1.23      jmc        38: .Op Fl o Ar field
1.25      otto       39: .Op Fl p Ar pid
1.2       downsj     40: .Op Fl s Ar time
1.45      jmc        41: .Op Fl U Ar user
1.2       downsj     42: .Op Ar number
1.45      jmc        43: .Ek
1.2       downsj     44: .Sh DESCRIPTION
                     45: .Nm
                     46: displays the top processes on the system and periodically updates this
1.13      aaron      47: information.
                     48: If standard output is an intelligent terminal (see below) then
1.1       downsj     49: as many processes as will fit on the terminal screen are displayed
1.13      aaron      50: by default.
                     51: Otherwise, a good number of them are shown (around 20).
                     52: Raw CPU percentage is used to rank the processes.
                     53: If
1.2       downsj     54: .Ar number
1.1       downsj     55: is given, then the top
1.2       downsj     56: .Ar number
1.1       downsj     57: processes will be displayed instead of the default.
1.2       downsj     58: .Pp
                     59: .Nm
1.1       downsj     60: makes a distinction between terminals that support advanced capabilities
1.13      aaron      61: and those that do not.
                     62: This distinction affects the choice of defaults for certain options.
                     63: In the remainder of this document, an
1.2       downsj     64: .Em intelligent
                     65: terminal is one that supports cursor addressing, clear screen, and clear
1.13      aaron      66: to end of line.
                     67: Conversely, a
1.43      jmc        68: .Em dumb
1.13      aaron      69: terminal is one that does not support such features.
                     70: If the output of
1.2       downsj     71: .Nm
1.1       downsj     72: is redirected to a file, it acts as if it were being run on a dumb
                     73: terminal.
1.12      aaron      74: .Pp
                     75: The options are as follows:
1.15      aaron      76: .Bl -tag -width Ds
1.51      tedu       77: .It Fl 1
1.58    ! jmc        78: Display combined CPU statistics for all processors on a single line
        !            79: instead of one line per CPU.
1.2       downsj     80: .It Fl b
                     81: Use
                     82: .Em batch
1.13      aaron      83: mode.
                     84: In this mode, all input from the terminal is ignored.
                     85: Interrupt characters (such as
                     86: .Ql ^C
                     87: and
                     88: .Ql ^\e )
                     89: still have an effect.
1.1       downsj     90: This is the default on a dumb terminal, or when the output is not a terminal.
1.34      otto       91: .It Fl C
1.42      jmc        92: Show command line arguments
                     93: as well as the process itself.
1.23      jmc        94: .It Fl d Ar count
                     95: Show only
                     96: .Ar count
                     97: displays, then exit.
                     98: A display is considered to be one update of the screen.
                     99: This option allows the user to select the number of displays
                    100: to be shown before
                    101: .Nm
                    102: automatically exits.
                    103: For intelligent terminals, no upper limit is set.
                    104: The default is 1 for dumb terminals.
1.45      jmc       105: .It Fl g Ar string
                    106: Display only processes that contain
                    107: .Ar string
1.35      otto      108: in their command name.
1.27      jmc       109: .It Fl I
                    110: Do not display idle processes.
                    111: By default,
                    112: .Nm
                    113: displays both active and idle processes.
1.2       downsj    114: .It Fl i
                    115: Use
                    116: .Em interactive
1.13      aaron     117: mode.
                    118: In this mode, any input is immediately read for processing.
                    119: See the section on
1.2       downsj    120: .Sx INTERACTIVE MODE
1.13      aaron     121: for an explanation of which keys perform what functions.
                    122: After the command
1.2       downsj    123: is processed, the screen will immediately be updated, even if the command was
1.13      aaron     124: not understood.
                    125: This mode is the default when standard output is an intelligent terminal.
1.2       downsj    126: .It Fl n
1.10      aaron     127: Use
1.2       downsj    128: .Em non-interactive
1.13      aaron     129: mode.
                    130: This is identical to
1.2       downsj    131: .Em batch
1.1       downsj    132: mode.
1.23      jmc       133: .It Fl o Ar field
1.45      jmc       134: Sort the process display area using the specified
                    135: .Ar field
                    136: as the primary key.
1.23      jmc       137: The field name is the name of the column as seen in the output,
                    138: but in lower case.
                    139: The
                    140: .Ox
1.26      jaredy    141: version of
                    142: .Nm
                    143: supports
1.23      jmc       144: .Ar cpu ,
                    145: .Ar size ,
                    146: .Ar res ,
                    147: .Ar time ,
1.54      tedu      148: .Ar pri ,
                    149: .Ar pid ,
1.23      jmc       150: and
1.54      tedu      151: .Ar command .
1.25      otto      152: .It Fl p Ar pid
                    153: Show only the process
                    154: .Ar pid .
1.2       downsj    155: .It Fl q
1.1       downsj    156: Renice
1.2       downsj    157: .Nm
1.26      jaredy    158: to \-20 so that it will run faster.
1.13      aaron     159: This can be used when the system is
1.1       downsj    160: being very sluggish to improve the possibility of discovering the problem.
                    161: This option can only be used by root.
1.27      jmc       162: .It Fl S
                    163: Show system processes in the display.
                    164: Normally, system processes such as the pager and the swapper are not shown.
                    165: This option makes them visible.
1.23      jmc       166: .It Fl s Ar time
                    167: Set the delay between screen updates to
                    168: .Ar time
                    169: seconds.
                    170: The value may be fractional, to permit delays of less than 1 second.
                    171: The default delay between updates is 5 seconds.
1.32      tedu      172: .It Fl T
                    173: Show process threads in the display.
                    174: Normally, only the main process is shown.
                    175: This option makes all threads visible.
1.45      jmc       176: .It Fl U Ar user
1.27      jmc       177: Show only those processes owned by
1.45      jmc       178: .Ar user .
1.27      jmc       179: This option currently only accepts usernames and will not understand
                    180: UID numbers.
1.2       downsj    181: .It Fl u
1.13      aaron     182: Do not take the time to map UID numbers to usernames.
                    183: Normally,
1.2       downsj    184: .Nm
                    185: will read as much of the password database as is necessary to map
1.13      aaron     186: all the user ID numbers it encounters into login names.
                    187: This option
                    188: disables all that, while possibly decreasing execution time.
                    189: The UID numbers are displayed instead of the names.
1.2       downsj    190: .El
                    191: .Pp
1.1       downsj    192: Both
1.2       downsj    193: .Ar count
1.1       downsj    194: and
1.2       downsj    195: .Ar number
                    196: fields can be specified as
                    197: .Li infinite ,
1.13      aaron     198: indicating that they can stretch as far as possible.
                    199: This is accomplished by using any proper prefix of the keywords
1.2       downsj    200: .Li infinity ,
                    201: .Li maximum ,
1.1       downsj    202: or
1.2       downsj    203: .Li all .
1.1       downsj    204: The default for
1.2       downsj    205: .Ar count
1.1       downsj    206: on an intelligent terminal is, in fact,
1.2       downsj    207: .Li infinity .
                    208: .Pp
1.1       downsj    209: The environment variable
1.2       downsj    210: .Ev TOP
1.13      aaron     211: is examined for options before the command line is scanned.
                    212: This enables a user to set his or her own defaults.
                    213: The number of processes to display
1.1       downsj    214: can also be specified in the environment variable
1.2       downsj    215: .Ev TOP .
                    216: .Pp
1.1       downsj    217: The options
1.2       downsj    218: .Fl I ,
                    219: .Fl S ,
1.1       downsj    220: and
1.2       downsj    221: .Fl u
1.13      aaron     222: are actually toggles.
                    223: A second specification of any of these options
                    224: will negate the first.
                    225: Thus a user who has the environment variable
1.2       downsj    226: .Ev TOP
1.10      aaron     227: set to
1.5       aaron     228: .Dq -I
1.10      aaron     229: may use the command
1.5       aaron     230: .Dq top -I
1.2       downsj    231: to see idle processes.
                    232: .Sh INTERACTIVE MODE
1.1       downsj    233: When
1.2       downsj    234: .Nm
                    235: is running in
                    236: .Em interactive mode ,
1.13      aaron     237: it reads commands from the terminal and acts upon them accordingly.
                    238: In this mode, the terminal is put in
1.2       downsj    239: .Dv CBREAK ,
1.13      aaron     240: so that a character will be processed as soon as it is typed.
                    241: Almost always, a key will be pressed when
1.2       downsj    242: .Nm
1.1       downsj    243: is between displays; that is, while it is waiting for
1.2       downsj    244: .Ar time
1.13      aaron     245: seconds to elapse.
                    246: If this is the case, the command will be
1.1       downsj    247: processed and the display will be updated immediately thereafter
1.13      aaron     248: (reflecting any changes that the command may have specified).
                    249: This happens even if the command was incorrect.
                    250: If a key is pressed while
1.2       downsj    251: .Nm
1.1       downsj    252: is in the middle of updating the display, it will finish the update and
1.13      aaron     253: then process the command.
                    254: Some commands require additional information,
                    255: and the user will be prompted accordingly.
                    256: While typing this information
1.1       downsj    257: in, the user's erase and kill keys (as set up by the command
1.2       downsj    258: .Xr stty 1 )
1.1       downsj    259: are recognized, and a newline terminates the input.
1.2       downsj    260: .Pp
1.1       downsj    261: These commands are currently recognized (^L refers to control-L):
1.2       downsj    262: .Bl -tag -width XxXXXX
1.40      jmc       263: .It h \*(Ba \&?
1.27      jmc       264: Display a summary of the commands (help screen).
1.2       downsj    265: .It ^L
1.1       downsj    266: Redraw the screen.
1.55      lum       267: .It <space>
                    268: Update the screen.
1.2       downsj    269: .It q
1.1       downsj    270: Quit
1.40      jmc       271: .Nm .
1.23      jmc       272: .El
                    273: .Bl -tag -width XxXXXX
1.38      otto      274: .It +
1.39      jmc       275: Reset any filters put in place by the
                    276: .Sq g ,
                    277: .Sq p ,
                    278: and
                    279: .Sq u
                    280: interactive commands,
1.48      jmc       281: or their command line equivalents,
                    282: or any process highlighting put in place by the
                    283: .Sq P
                    284: interactive command.
1.53      jmc       285: .It 1
1.58    ! jmc       286: Toggle the display of CPU statistics.
1.29      markus    287: .It C
                    288: Toggle the display of process command line arguments.
1.44      jmc       289: .It d Ar count
                    290: Show only
                    291: .Ar count
                    292: displays,
                    293: then exit.
1.23      jmc       294: .It e
                    295: Display a list of system errors (if any) generated by the last
                    296: .Li kill
                    297: or
                    298: .Li renice
                    299: command.
1.40      jmc       300: .It g Ar string
                    301: Display only processes that contain
                    302: .Ar string
                    303: in their command name.
                    304: .Sq g+
                    305: shows all processes.
                    306: .It I \*(Ba i
1.23      jmc       307: Toggle the display of idle processes.
1.41      jmc       308: .It Xo k
                    309: .Op - Ns Ar sig
                    310: .Ar pid
                    311: .Xc
                    312: Send signal
                    313: .No - Ns Ar sig
1.21      jmc       314: .Pf ( Dv TERM
1.41      jmc       315: by default) to process
                    316: .Ar pid .
1.13      aaron     317: This acts similarly to the command
1.2       downsj    318: .Xr kill 1 .
1.44      jmc       319: .It n\*(Ba# Ar count
                    320: Show
                    321: .Ar count
1.40      jmc       322: processes.
                    323: .It o Ar field
1.45      jmc       324: Sort the process display area using the specified
                    325: .Ar field
                    326: as the primary key.
1.23      jmc       327: Values are the same as for the
                    328: .Fl o
                    329: flag, as detailed above.
1.46      otto      330: .It P Ar pid
                    331: Highlight a specific process, selected by
                    332: .Ar pid .
1.48      jmc       333: .Sq P+
                    334: removes process highlighting.
1.40      jmc       335: .It p Ar pid
1.45      jmc       336: Show only the process
1.40      jmc       337: .Ar pid .
                    338: .Sq p+
                    339: shows all processes.
1.44      jmc       340: .It r Ar count pid
1.2       downsj    341: Change the priority (the
                    342: .Em nice )
1.44      jmc       343: of a list of processes to
                    344: .Ar count
1.40      jmc       345: for process
                    346: .Ar pid .
1.13      aaron     347: This acts similarly to the command
1.2       downsj    348: .Xr renice 8 .
1.27      jmc       349: .It S
                    350: Toggle the display of system processes.
1.44      jmc       351: .It s Ar time
                    352: Set the delay between screen updates to
                    353: .Ar time
1.40      jmc       354: seconds.
1.36      otto      355: .It T
                    356: Toggle the display of process threads.
1.40      jmc       357: .It u Ar user
1.45      jmc       358: Show only those processes owned by
1.40      jmc       359: .Ar user .
                    360: .Sq u+
                    361: shows processes belonging to all users.
1.2       downsj    362: .El
                    363: .Sh THE DISPLAY
                    364: .\" The actual display varies depending on the specific variant of Unix
                    365: .\" that the machine is running.  This description may not exactly match
                    366: .\" what is seen by top running on this particular machine.  Differences
                    367: .\" are listed at the end of this manual entry.
                    368: .\" .Pp
1.1       downsj    369: The top few lines of the display show general information
                    370: about the state of the system, including
1.11      millert   371: .\" the last process ID assigned to a process,
1.2       downsj    372: .\" (on most systems),
1.24      millert   373: the three load average numbers,
1.56      otto      374: the hostname,
1.1       downsj    375: the current time,
                    376: the number of existing processes,
                    377: the number of processes in each state
1.26      jaredy    378: (starting, running, idle, stopped, zombie, dead, and on processor),
1.1       downsj    379: and a percentage of time spent in each of the processor states
1.26      jaredy    380: (user, nice, system, interrupt, and idle).
1.17      aaron     381: It also includes information about physical and virtual memory allocation.
1.24      millert   382: The load average numbers give the number of jobs in the run queue averaged
1.26      jaredy    383: over 1, 5, and 15 minutes.
1.2       downsj    384: .Pp
1.1       downsj    385: The remainder of the screen displays information about individual
1.13      aaron     386: processes.
                    387: This display is similar in spirit to
1.2       downsj    388: .Xr ps 1
1.13      aaron     389: but it is not exactly the same.
1.26      jaredy    390: The following fields are displayed:
                    391: .Bl -tag -width USERNAME -offset indent
                    392: .It PID
                    393: The process ID.
                    394: .It USERNAME
                    395: The name of the process's owner.
                    396: .It UID
                    397: Used instead of USERNAME if
1.2       downsj    398: .Fl u
1.26      jaredy    399: is specified.
                    400: .It PRI
                    401: The current priority of the process.
                    402: .It NICE
                    403: The nice amount (in the range \-20 to 20).
                    404: .It SIZE
                    405: The total size of the process (the text, data, and stack segments).
                    406: .It RES
                    407: The current amount of resident memory.
                    408: .It STATE
                    409: The current state (one of
                    410: .Li start ,
                    411: .Li run ,
1.2       downsj    412: .Li sleep ,
1.26      jaredy    413: .Li stop ,
                    414: .Li idle ,
1.2       downsj    415: .Li zomb ,
1.26      jaredy    416: .Li dead ,
1.2       downsj    417: or
1.26      jaredy    418: .Li onproc ) .
1.57      sobrado   419: On multiprocessor systems, this is followed by a slash and the CPU
1.26      jaredy    420: number on which the process is bound.
                    421: .It WAIT
                    422: A description of the wait channel the process is sleeping on if it's
                    423: asleep.
                    424: .It TIME
                    425: The number of system and user CPU seconds that the process has used.
                    426: .It CPU
                    427: The raw percentage of CPU usage and the default field on which the
                    428: display is sorted.
                    429: .It COMMAND
                    430: The name of the command that the process is currently running.
                    431: (If the process is swapped out, this column is enclosed by angle
                    432: brackets.)
                    433: .El
1.2       downsj    434: .Sh ENVIRONMENT
1.26      jaredy    435: .Bl -tag -width Ev
1.2       downsj    436: .It Ev TOP
                    437: User-configurable defaults for options.
                    438: .El
                    439: .Sh FILES
1.50      jmc       440: .Bl -tag -width "/etc/passwdXXX" -compact
1.2       downsj    441: .It Pa /dev/kmem
                    442: kernel memory
                    443: .It Pa /dev/mem
                    444: physical memory
1.26      jaredy    445: .It Pa /etc/passwd
1.49      jmc       446: used to map user ID to user
1.2       downsj    447: .It Pa /bsd
                    448: kernel image
1.14      aaron     449: .El
1.13      aaron     450: .Sh SEE ALSO
1.30      jmc       451: .Xr fstat 1 ,
1.13      aaron     452: .Xr kill 1 ,
1.30      jmc       453: .Xr netstat 1 ,
1.13      aaron     454: .Xr ps 1 ,
                    455: .Xr stty 1 ,
                    456: .Xr systat 1 ,
                    457: .Xr mem 4 ,
1.30      jmc       458: .Xr iostat 8 ,
                    459: .Xr pstat 8 ,
                    460: .Xr renice 8 ,
1.31      jmc       461: .Xr vmstat 8
1.16      aaron     462: .Sh AUTHORS
                    463: William LeFebvre, EECS Department, Northwestern University
1.2       downsj    464: .Sh BUGS
1.1       downsj    465: As with
1.2       downsj    466: .Xr ps 1 ,
1.1       downsj    467: things can change while
1.2       downsj    468: .Nm
1.13      aaron     469: is collecting information for an update.
                    470: The picture it gives is only a
1.1       downsj    471: close approximation to reality.