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