1.\" NOTE: changes to the manual page for "top" should be made in the 2.\" file "top.X" and NOT in the file "top.1". 3.\" $FreeBSD: releng/11.0/contrib/top/top.xs 284165 2015-06-08 19:45:24Z marcel $ 4.nr N %topn% 5.nr D %delay% 6.TH TOP 1 Local 7.UC 4 8.SH NAME 9top \- display and update information about the top cpu processes 10.SH SYNOPSIS 11.B top 12[ 13.B \-abCHIijnPqStuvz 14] [ 15.BI \-d count 16] [ 17.BI \-m io | cpu 18] [ 19.BI \-o field 20] [ 21.BI \-s time 22] [ 23.BI \-J jail 24] [ 25.BI \-U username 26] [ 27.I number 28] 29.SH DESCRIPTION 30.\" This defines appropriate quote strings for nroff and troff 31.ds lq \&" 32.ds rq \&" 33.if t .ds lq `` 34.if t .ds rq '' 35.\" Just in case these number registers aren't set yet... 36.if \nN==0 .nr N 10 37.if \nD==0 .nr D 2 38.I Top 39displays the top 40.if !\nN==-1 \nN 41processes on the system and periodically updates this information. 42.if \nN==-1 \ 43\{\ 44If standard output is an intelligent terminal (see below) then 45as many processes as will fit on the terminal screen are displayed 46by default. Otherwise, a good number of them are shown (around 20). 47.\} 48Raw cpu percentage is used to rank the processes. If 49.I number 50is given, then the top 51.I number 52processes will be displayed instead of the default. 53.PP 54.I Top 55makes a distinction between terminals that support advanced capabilities 56and those that do not. This 57distinction affects the choice of defaults for certain options. In the 58remainder of this document, an \*(lqintelligent\*(rq terminal is one that 59supports cursor addressing, clear screen, and clear to end of line. 60Conversely, a \*(lqdumb\*(rq terminal is one that does not support such 61features. If the output of 62.I top 63is redirected to a file, it acts as if it were being run on a dumb 64terminal. 65.SH OPTIONS 66.TP 67.B \-C 68Toggle CPU display mode. 69By default top displays the weighted CPU percentage in the WCPU column 70(this is the same value that 71.IR ps (1) 72displays as CPU). 73Each time 74.B \-C 75flag is passed it toggles between \*(lqraw cpu\*(rq mode 76and \*(lqweighted cpu\*(rq mode, showing the \*(lqCPU\*(rq or 77the \*(lqWCPU\*(rq column respectively. 78.TP 79.B \-S 80Show system processes in the display. Normally, system processes such as 81the pager and the swapper are not shown. This option makes them visible. 82.TP 83.B \-a 84Display command names derived from the argv[] vector, rather than real 85executable name. It's useful when you want to watch applications, that 86puts their status information there. If the real name differs from argv[0], 87it will be displayed in parenthesis. 88.TP 89.B \-b 90Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is 91ignored. Interrupt characters (such as ^C and ^\e) still have an effect. 92This is the default on a dumb terminal, or when the output is not a terminal. 93.TP 94.B \-H 95Display each thread for a multithreaded process individually. 96By default a single summary line is displayed for each process. 97.TP 98.B \-i 99Use \*(lqinteractive\*(rq mode. In this mode, any input is immediately 100read for processing. See the section on \*(lqInteractive Mode\*(rq 101for an explanation of 102which keys perform what functions. After the command is processed, the 103screen will immediately be updated, even if the command was not 104understood. This mode is the default when standard output is an 105intelligent terminal. 106.TP 107.B \-I 108Do not display idle processes. 109By default, top displays both active and idle processes. 110.TP 111.B \-j 112Display the 113.IR jail (8) 114ID. 115.TP 116.B \-t 117Do not display the 118.I top 119process. 120.TP 121.BI \-m display 122Display either 'cpu' or 'io' statistics. Default is 'cpu'. 123.TP 124.B \-n 125Use \*(lqnon-interactive\*(rq mode. This is identical to \*(lqbatch\*(rq 126mode. 127.TP 128.B \-P 129Display per-cpu CPU usage statistics. 130.TP 131.B \-q 132Renice 133.I top 134to -20 so that it will run faster. This can be used when the system is 135being very sluggish to improve the possibility of discovering the problem. 136This option can only be used by root. 137.TP 138.B \-u 139Do not take the time to map uid numbers to usernames. Normally, 140.I top 141will read as much of the file \*(lq/etc/passwd\*(rq as is necessary to map 142all the user id numbers it encounters into login names. This option 143disables all that, while possibly decreasing execution time. The uid 144numbers are displayed instead of the names. 145.TP 146.B \-v 147Write version number information to stderr then exit immediately. 148No other processing takes place when this option is used. To see current 149revision information while top is running, use the help command \*(lq?\*(rq. 150.TP 151.B \-z 152Do not display the system idle process. 153.TP 154.BI \-d count 155Show only 156.I count 157displays, then exit. A display is considered to be one update of the 158screen. This option allows the user to select the number of displays he 159wants to see before 160.I top 161automatically exits. For intelligent terminals, no upper limit 162is set. The default is 1 for dumb terminals. 163.TP 164.BI \-s time 165Set the delay between screen updates to 166.I time 167seconds. The default delay between updates is \nD seconds. 168.TP 169.BI \-o field 170Sort the process display area on the specified field. The field name is 171the name of the column as seen in the output, but in lower case. Likely 172values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq, 173but may vary on different operating systems. Note that 174not all operating systems support this option. 175.TP 176.BI \-J jail 177Show only those processes owned by 178.IR jail . 179This may be either the 180.B jid 181or 182.B name 183of the jail. 184Use 185.B 0 186to limit to host processes. 187Using this option implies the 188.B \-j 189flag. 190.PP 191.BI \-U username 192Show only those processes owned by 193.IR username . 194This option currently only accepts usernames and will not understand 195uid numbers. 196.PP 197Both 198.I count 199and 200.I number 201fields can be specified as \*(lqinfinite\*(rq, indicating that they can 202stretch as far as possible. This is accomplished by using any proper 203prefix of the keywords 204\*(lqinfinity\*(rq, 205\*(lqmaximum\*(rq, 206or 207\*(lqall\*(rq. 208The default for 209.I count 210on an intelligent terminal is, in fact, 211.BI infinity . 212.PP 213The environment variable 214.B TOP 215is examined for options before the command line is scanned. This enables 216a user to set his or her own defaults. The number of processes to display 217can also be specified in the environment variable 218.BR TOP . 219The options 220.BR \-a , 221.BR \-C , 222.BR \-H , 223.BR \-I , 224.BR \-j , 225.BR \-P , 226.BR \-S , 227.BR \-t , 228.BR \-u , 229and 230.B \-z 231are actually toggles. A second specification of any of these options 232will negate the first. Thus a user who has the environment variable 233.B TOP 234set to \*(lq\-I\*(rq may use the command \*(lqtop \-I\*(rq to see idle processes. 235.SH "INTERACTIVE MODE" 236When 237.I top 238is running in \*(lqinteractive mode\*(rq, it reads commands from the 239terminal and acts upon them accordingly. In this mode, the terminal is 240put in \*(lqCBREAK\*(rq, so that a character will be 241processed as soon as it is typed. Almost always, a key will be 242pressed when 243.I top 244is between displays; that is, while it is waiting for 245.I time 246seconds to elapse. If this is the case, the command will be 247processed and the display will be updated immediately thereafter 248(reflecting any changes that the command may have specified). This 249happens even if the command was incorrect. If a key is pressed while 250.I top 251is in the middle of updating the display, it will finish the update and 252then process the command. Some commands require additional information, 253and the user will be prompted accordingly. While typing this information 254in, the user's erase and kill keys (as set up by the command 255.IR stty ) 256are recognized, and a newline terminates the input. 257.PP 258These commands are currently recognized (^L refers to control-L): 259.TP 260.B ^L 261Redraw the screen. 262.IP "\fBh\fP\ or\ \fB?\fP" 263Display a summary of the commands (help screen). Version information 264is included in this display. 265.TP 266.B q 267Quit 268.IR top. 269.TP 270.B d 271Change the number of displays to show (prompt for new number). 272Remember that the next display counts as one, so typing 273.B d1 274will make 275.I top 276show one final display and then immediately exit. 277.TP 278.B m 279Toggle the display between 'cpu' and 'io' modes. 280.TP 281.B n or # 282Change the number of processes to display (prompt for new number). 283.TP 284.B s 285Change the number of seconds to delay between displays 286(prompt for new number). 287.TP 288.B S 289Toggle the display of system processes. 290.TP 291.B a 292Toggle the display of process titles. 293.TP 294.B k 295Send a signal (\*(lqkill\*(rq by default) to a list of processes. This 296acts similarly to the command 297.IR kill (1)). 298.TP 299.B r 300Change the priority (the \*(lqnice\*(rq) of a list of processes. 301This acts similarly to the command 302.IR renice (8)). 303.TP 304.B u 305Display only processes owned by a specific username (prompt for username). 306If the username specified is simply \*(lq+\*(rq, then processes belonging 307to all users will be displayed. 308.TP 309.B o 310Change the order in which the display is sorted. This command is not 311available on all systems. The sort key names vary from system to system 312but usually include: \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq, 313\*(lqtime\*(rq. The default is cpu. 314.TP 315.B e 316Display a list of system errors (if any) generated by the last 317.BR k ill 318or 319.BR r enice 320command. 321.TP 322.B H 323Toggle the display of threads. 324.TP 325.B i 326(or 327.BR I ) 328Toggle the display of idle processes. 329.TP 330.B j 331Toggle the display of 332.IR jail (8) 333ID. 334.TP 335.B J 336Display only processes owned by a specific jail (prompt for jail). 337If the jail specified is simply \*(lq+\*(rq, then processes belonging 338to all jails and the host will be displayed. 339This will also enable the display of JID. 340.TP 341.B P 342Toggle the display of per-CPU statistics. 343.TP 344.B t 345Toggle the display of the 346.I top 347process. 348.TP 349.B z 350Toggle the display of the system idle process. 351.SH "THE DISPLAY" 352The actual display varies depending on the specific variant of Unix 353that the machine is running. This description may not exactly match 354what is seen by top running on this particular machine. Differences 355are listed at the end of this manual entry. 356.PP 357The top few lines of the display show general information 358about the state of the system, including 359the last process id assigned to a process (on most systems), 360the three load averages, 361the current time, 362the number of existing processes, 363the number of processes in each state 364(sleeping, running, starting, zombies, and stopped), 365and a percentage of time spent in each of the processor states 366(user, nice, system, and idle). 367It also includes information about physical and virtual memory allocation. 368.PP 369The remainder of the screen displays information about individual 370processes. This display is similar in spirit to 371.IR ps (1) 372but it is not exactly the same. PID is the process id, 373JID, when displayed, is the 374.IR jail (8) 375ID corresponding to the process, 376USERNAME is the name of the process's owner (if 377.B \-u 378is specified, a UID column will be substituted for USERNAME), 379PRI is the current priority of the process, 380NICE is the nice amount (in the range \-20 to 20), 381SIZE is the total size of the process (text, data, and stack), 382RES is the current amount of resident memory (both SIZE and RES are 383given in kilobytes), 384STATE is the current state (one of \*(lqSTART\*(rq, \*(lqRUN\*(rq 385(shown as \*(lqCPUn\*(rq on SMP systems), \*(lqSLEEP\*(rq, \*(lqSTOP\*(rq, 386\*(lqZOMB\*(rq, \*(lqWAIT\*(rq, \*(lqLOCK\*(rq or the event on which the 387process waits), 388C is the processor number on which the process is executing 389(visible only on SMP systems), 390TIME is the number of system and user cpu seconds that the process has used, 391WCPU, when displayed, is the weighted cpu percentage (this is the same 392value that 393.IR ps (1) 394displays as CPU), 395CPU is the raw percentage and is the field that is sorted to determine 396the order of the processes, and 397COMMAND is the name of the command that the process is currently running 398(if the process is swapped out, this column is marked \*(lq<swapped>\*(rq). 399.SH NOTES 400If a process is in the \*(lqSLEEP\*(rq or \*(lqLOCK\*(rq state, 401the state column will report the name of the event or lock on which the 402process is waiting. 403Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events 404are not. 405.SH AUTHOR 406William LeFebvre, EECS Department, Northwestern University 407.SH ENVIRONMENT 408.DT 409TOP user-configurable defaults for options. 410.SH FILES 411.DT 412/dev/kmem kernel memory 413.br 414/dev/mem physical memory 415.br 416/etc/passwd used to map uid numbers to user names 417.br 418/boot/kernel/kernel system image 419.SH BUGS 420Don't shoot me, but the default for 421.B \-I 422has changed once again. So many people were confused by the fact that 423.I top 424wasn't showing them all the processes that I have decided to make the 425default behavior show idle processes, just like it did in version 2. 426But to appease folks who can't stand that behavior, I have added the 427ability to set \*(lqdefault\*(rq options in the environment variable 428.B TOP 429(see the OPTIONS section). Those who want the behavior that version 4303.0 had need only set the environment variable 431.B TOP 432to \*(lq\-I\*(rq. 433.PP 434The command name for swapped processes should be tracked down, but this 435would make the program run slower. 436.PP 437As with 438.IR ps (1), 439things can change while 440.I top 441is collecting information for an update. The picture it gives is only a 442close approximation to reality. 443.SH "SEE ALSO" 444kill(1), 445ps(1), 446stty(1), 447mem(4), 448renice(8) 449