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