1.Dd June 9, 2025 2.Dt TOP 1 3.Os 4.Sh NAME 5.Nm top 6.Nd display and update information about the top cpu processes 7.Sh SYNOPSIS 8.Nm 9.Op Fl abCHIijnPqSTtuvwz 10.Op Fl d Ar count 11.Op Fl J Ar jail 12.Op Fl m Ar cpu | io 13.Op Fl o Ar field 14.Op Fl p Ar pid 15.Op Fl s Ar time 16.Op Fl U Ar username 17.Op Ar number 18.Sh DESCRIPTION 19.Nm 20displays the top 21processes on the system and periodically updates this information. 22If standard output is an intelligent terminal (see below) then 23as many processes as will fit on the terminal screen are displayed 24by default. 25Otherwise, a good number of them are shown (around 20). 26Raw cpu percentage is used to rank the processes. 27If 28.Ar number 29is given, then the top 30.Ar number 31processes will be displayed instead of the default. 32.Pp 33.Nm 34makes a distinction between terminals that support advanced capabilities 35and those that do not. 36This distinction affects the choice of defaults for certain options. 37In the remainder of this document, an 38.Dq intelligent 39terminal is one that 40supports cursor addressing, clear screen, and clear to end of line. 41Conversely, a 42.Dq dumb 43terminal is one that does not support such 44features. 45If the output of 46.Nm 47is redirected to a file, it acts as if it were being run on a dumb 48terminal. 49.Pp 50The options are as follows: 51.Bl -tag -width indent 52.It Fl a 53Display command names derived from the argv[] vector, rather than real 54executable name. 55It it useful when you want to watch applications, that 56puts their status information there. 57If the real name differs from argv[0], 58it will be displayed in parenthesis. 59Non-printable characters in the command line are 60encoded in C-style backslash sequences or 61a three digit octal sequences. 62.It Fl b 63Use 64.Dq batch 65mode. 66In this mode, all input from the terminal is 67ignored. 68Interrupt characters (such as ^C and ^\e) still have an effect. 69This is the default on a dumb terminal, or when the output is not a terminal. 70.It Fl C 71Toggle CPU display mode. 72By default top displays the weighted CPU percentage in the WCPU column 73(this is the same value that 74.Xr ps 1 75displays as CPU). 76Each time 77.Fl C 78flag is passed it toggles between 79.Dq raw cpu 80mode and 81.Dq weighted cpu 82mode, showing the 83.Dq CPU 84or the 85.Dq WCPU 86column respectively. 87.It Fl d Ar count 88Show only 89.Ar count 90displays, then exit. 91A display is considered to be one update of the 92screen. 93The default is 1 for dumb terminals. 94Note that for 95.Ar count 96= 1 97no information is available about the percentage of time spent by the CPU in every state. 98.It Fl H 99Display each thread for a multithreaded process individually. 100By default a single summary line is displayed for each process. 101.It Fl I 102Do not display idle processes. 103By default, top displays both active and idle processes. 104.It Fl i 105Use 106.Dq interactive 107mode. 108In this mode, any input is immediately 109read for processing. 110See the section on 111.Dq Interactive Mode 112for an explanation of 113which keys perform what functions. 114After the command is processed, the 115screen will immediately be updated, even if the command was not 116understood. 117This mode is the default when standard output is an 118intelligent terminal. 119.It Fl J Ar jail 120Show only those processes owned by 121.Ar jail . 122This may be either the 123.Ar jid 124or 125.Ar name 126of the jail. 127Use 1280 129to limit to host processes. 130Using this option implies 131.Fl j . 132.It Fl j 133Display the 134.Xr jail 8 135ID. 136.It Fl m Ar mode 137Display statistics in the specified 138.Ar mode . 139Available modes are 140.Cm cpu 141and 142.Cm io . 143Default is 144.Cm cpu . 145.It Fl n 146Use 147.Dq non-interactive 148mode. 149This is identical to 150.Dq batch 151mode. 152.It Fl o Ar field 153Sort the process display area on the specified field. 154The field name 155is the name of the column as seen in the output, but in lower case: 156.Dq cpu , 157.Dq size , 158.Dq res , 159.Dq time , 160.Dq pri , 161.Dq threads , 162.Dq total , 163.Dq read , 164.Dq write , 165.Dq fault , 166.Dq vcsw , 167.Dq ivcsw , 168.Dq jid , 169.Dq swap , 170or 171.Dq pid . 172.It Fl P 173Display per-cpu CPU usage statistics. 174.It Fl p Ar pid 175Show only the process 176.Ar pid . 177.It Fl q 178Renice 179.Nm 180to -20 so that it will run faster. 181This can be used when the system is 182being very sluggish to improve the possibility of discovering the problem. 183This option can only be used by root. 184.It Fl S 185Show system processes in the display. 186Normally, system processes such as the pager and the swapper are not shown. 187This option makes them visible. 188.It Fl s Ar time 189Set the delay between screen updates to 190.Ar time 191seconds, which may be fractional. 192The default delay between updates is 2 seconds. 193.It Fl T 194Toggle displaying thread ID (tid) instead of process id (pid). 195.It Fl t 196Do not display the 197.Nm 198process itself. 199.It Fl U Ar username 200Show only those processes owned by 201.Ar username . 202This option currently only accepts usernames and will not understand 203uid numbers. 204.It Fl u 205Do not map uid numbers to usernames. 206Normally, 207.Nm 208will read as much of the file 209.Pa /etc/passwd 210as is necessary to map 211all the user id numbers it encounters into login names. 212This option disables all that, while possibly decreasing execution time. 213The uid numbers are displayed instead of the names. 214.It Fl v 215Write version number information to stderr then exit immediately. 216.It Fl w 217Display approximate swap usage for each process. 218.It Fl z 219Do not display the system idle process. 220.El 221.Pp 222Both 223.Ar count 224and 225.Ar number 226fields can be specified as 227.Dq infinite , 228indicating that they can 229stretch as far as possible. 230This is accomplished by using any proper 231prefix of the keywords 232.Dq infinity , 233.Dq maximum , 234or 235.Dq all . 236Boolean flags are toggles. 237A second specification of any of these options will negate the first. 238.Sh INTERACTIVE MODE 239When 240.Nm 241is running in 242.Dq interactive mode , 243it reads commands from the 244terminal and acts upon them accordingly. 245In this mode, the terminal is 246put in 247.Dq CBREAK , 248so that a character will be 249processed as soon as it is typed. 250Almost always, a key will be 251pressed when 252.Nm 253is between displays; that is, while it is waiting for 254.Ar time 255seconds to elapse. 256If this is the case, the command will be 257processed and the display will be updated immediately thereafter 258.Pq reflecting any changes that the command may have specified . 259This happens even if the command was incorrect. 260If a key is pressed while 261.Nm 262is in the middle of updating the display, it will finish the update and 263then process the command. 264Some commands require additional information, 265and the user will be prompted accordingly. 266While typing this information 267in, the user's erase and kill keys (as set up by the command 268.Xr stty 1 ) 269are recognized, and a newline terminates the input. 270.Pp 271The bindings are as follows: 272.Bl -tag -width indent 273.It Ic space 274Update the display. 275.It Ic / 276Filter by command name. 277Prompt for 278.Ar string 279or 280.Ql Ic + 281to show all processes. 282.It Ic a 283Toggle display of process titles. 284.It Ic C 285Toggle display of raw or weighted CPU percentage. 286.It Ic d 287Change the number of remaining displays to show before exit. 288Prompt for new number. 289.It Ic e 290Display a list of system errors (if any) generated by the last command. 291.It Ic H 292Toggle display of threads. 293.It Ic h No or Ic \&? 294Display a summary of the commands (help screen) and version information. 295.It Ic i No or Ic I 296Toggle display of idle processes. 297.It Ic J 298Filter processes owned by a specific jail. 299Prompt for jail name or 300.Ql Ic + 301for all processes belonging to all jails and the host. 302This will also enable the display of JID. 303.It Ic j 304Toggle display of 305.Xr jail 8 306ID. 307.It Ic k 308Send a signal 309.Pq SIGKILL by default 310to a list of processes. 311This acts similarly to the command 312.Xr kill 1 . 313.It Ic m 314Toggle the display between 'cpu' and 'io' modes. 315.It Ic n No or Ic # 316Change the number of processes to display. 317Prompt for new number. 318.It Ic o 319Change the order in which the display is sorted. 320The sort key names include 321.Dq cpu , 322.Dq res , 323.Dq size , 324and 325.Dq time. 326The default is cpu. 327.It Ic P 328Toggle display of per-CPU statistics. 329.It Ic p 330Filter by exact process ID. 331Prompt for 332.Ar PID 333or 334.Ql Ic + 335to show all processes. 336.It Ic q 337Quit 338.Nm . 339.It Ic r 340Change the priority 341.Pq the Dq nice 342of a list of processes. 343This acts similarly to 344.Xr renice 8 . 345.It Ic S 346Toggle the display of system processes. 347.It Ic s 348Change the number of seconds to delay between displays. 349Prompt for new number. 350.It Ic T 351Toggle display between thread ID and process ID. 352.It Ic t 353Toggle display of the 354.Nm 355process. 356.It Ic u 357Filter by exact process owner username. 358Prompt for 359.Ar username 360or 361.Ql Ic - Ns 362.No / Ns 363.Ql Ic + 364for all users. 365Usernames can be added 366to and removed from the set by prepending them with 367.Ql + 368and 369.Ql - , 370respectively. 371.It Ic w 372Toggle display of swap usage. 373.It Ic z 374Toggle display of the system idle process. 375.El 376.Sh "THE DISPLAY" 377The top few lines of the display show general information 378about the state of the system, including 379the last process id assigned to a process (on most systems), 380the three load averages, 381the current time, 382the number of existing processes, 383the number of processes in each state 384(sleeping, running, starting, zombies, and stopped), 385and a percentage of time spent in each of the processor states 386(user, nice, system, and idle). 387It also includes information about physical and virtual memory allocation. 388.Pp 389The remainder of the screen displays information about individual 390processes. 391This display is similar in spirit to 392.Xr ps 1 393but it is not exactly the same. 394PID is the process id, 395JID, when displayed, is the 396.Xr jail 8 397ID corresponding to the process, 398USERNAME is the name of the process's owner (if 399.Fl u 400is specified, a UID column will be substituted for USERNAME), 401THR is the thread count, showing the number of threads a process has, 402PRI is the current priority of the process, 403NICE is the 404.Xr nice 1 405amount, 406SIZE is the total size of the process (text, data, and stack), 407RES is the current amount of resident memory, 408SWAP is the approximate amount of swap, if enabled 409(SIZE, RES and SWAP are given in kilobytes), 410STATE is the current state (one of 411.Dq START , 412.Dq RUN 413(shown as 414.Dq CPUn 415on SMP systems), 416.Dq SLEEP , 417.Dq STOP , 418.Dq ZOMB , 419.Dq WAIT , 420.Dq LOCK , 421or the event on which the process waits), 422C is the processor number on which the process is executing 423(visible only on SMP systems), 424TIME is the number of system and user cpu seconds that the process has used, 425WCPU, when displayed, is the weighted cpu percentage (this is the same 426value that 427.Xr ps 1 428displays as CPU), 429CPU is the raw percentage and is the field that is sorted to determine 430the order of the processes, and 431COMMAND is the name of the command that the process is currently running 432(if the process is swapped out, this column is marked 433.Dq <swapped> ) . 434.Pp 435If a process is in the 436.Dq SLEEP 437or 438.Dq LOCK 439state, 440the state column will report the name of the event or lock on which the 441process is waiting. 442Lock names are prefixed with an asterisk 443.Dq * 444while sleep events 445are not. 446.Sh DESCRIPTION OF MEMORY 447.Bd -literal 448Mem: 61M Active, 86M Inact, 368K Laundry, 22G Wired, 102G Free 449ARC: 15G Total, 9303M MFU, 6155M MRU, 1464K Anon, 98M Header, 35M Other 450 15G Compressed, 27G Uncompressed, 1.75:1 Ratio, 174M Overhead 451Swap: 4096M Total, 532M Free, 13% Inuse, 80K In, 104K Out 452.Ed 453.Ss Physical Memory Stats 454.Bl -tag -width "Uncompressed" -compact 455.It Em Active 456number of bytes active 457.It Em Inact 458number of clean bytes inactive 459.It Em Laundry 460number of dirty bytes queued for laundering 461.It Em Wired 462number of bytes wired down, including IO-level cached file data pages 463.It Em Buf 464number of bytes used for IO-level disk caching 465.It Em Free 466number of bytes free 467.El 468.Ss ZFS ARC Stats 469These stats are only displayed when the ARC is in use. 470.Pp 471.Bl -tag -width "Uncompressed" -compact 472.It Em Total 473number of wired bytes used for the ZFS ARC 474.It Em MRU 475number of ARC bytes holding most recently used data 476.It Em MFU 477number of ARC bytes holding most frequently used data 478.It Em Anon 479number of ARC bytes holding in flight data 480.It Em Header 481number of ARC bytes holding headers 482.It Em Other 483miscellaneous ARC bytes 484.It Em Compressed 485bytes of memory used by ARC caches 486.It Em Uncompressed 487bytes of data stored in ARC caches before compression 488.It Em Ratio 489compression ratio of data cached in the ARC 490.El 491.Ss Swap Stats 492.Bl -tag -width "Uncompressed" -compact 493.It Em Total 494total available swap usage 495.It Em Free 496total free swap usage 497.It Em Inuse 498swap usage 499.It Em \&In 500bytes paged in from swap devices (last interval) 501.It Em Out 502bytes paged out to swap devices (last interval) 503.El 504.Sh ENVIRONMENT 505.Bl -tag -width "Uncompressed" 506.It Ev TOP 507Default set of arguments to 508.Nm . 509.It Ev LC_CTYPE 510The locale to use when displaying the 511.Va argv 512vector when 513.Fl a 514flag is specified. 515.El 516.Sh SEE ALSO 517.Xr kill 1 , 518.Xr ps 1 , 519.Xr stty 1 , 520.Xr getrusage 2 , 521.Xr humanize_number 3 , 522.Xr mem 4 , 523.Xr renice 8 524.Sh HISTORY 525.Nm 526first appeared in 527.Fx 2.2.2 . 528.Sh AUTHORS 529.An William LeFebvre, EECS Department, Northwestern University 530.Sh BUGS 531The command name for swapped processes should be tracked down, but this 532would make the program run slower. 533.Pp 534As with 535.Xr ps 1 , 536things can change while 537.Nm 538is collecting information for an update. 539The picture it gives is only a close approximation to reality. 540