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

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