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

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