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