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

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