1TOP(1) User Commands TOP(1)
2
3
4
6 top - display Linux processes
7
8
10 top [options]
11
12
14 The top program provides a dynamic real-time view of a running system.
15 It can display system summary information as well as a list of
16 processes or threads currently being managed by the Linux kernel. The
17 types of system summary information shown and the types, order and size
18 of information displayed for processes are all user configurable and
19 that configuration can be made persistent across restarts.
20
21 The program provides a limited interactive interface for process
22 manipulation as well as a much more extensive interface for personal
23 configuration -- encompassing every aspect of its operation. And
24 while top is referred to throughout this document, you are free to name
25 the program anything you wish. That new name, possibly an alias, will
26 then be reflected on top's display and used when reading and writing a
27 configuration file.
28
29
31 Documentation
32 The remaining Table of Contents
33
34 OVERVIEW
35 Operation
36 Linux Memory Types
37 1. COMMAND-LINE Options
38 2. SUMMARY Display
39 a. UPTIME and LOAD Averages
40 b. TASK and CPU States
41 c. MEMORY Usage
42 3. FIELDS / Columns Display
43 a. DESCRIPTIONS of Fields
44 b. MANAGING Fields
45 4. INTERACTIVE Commands
46 a. GLOBAL Commands
47 b. SUMMARY AREA Commands
48 c. TASK AREA Commands
49 1. Appearance
50 2. Content
51 3. Size
52 4. Sorting
53 d. COLOR Mapping
54 5. ALTERNATE-DISPLAY Provisions
55 a. WINDOWS Overview
56 b. COMMANDS for Windows
57 c. SCROLLING a Window
58 d. SEARCHING in a Window
59 e. FILTERING in a Window
60 6. FILES
61 a. PERSONAL Configuration File
62 b. ADDING INSPECT Entries
63 c. SYSTEM Configuration File
64 d. SYSTEM Restrictions File
65 7. ENVIRONMENT VARIABLE(S)
66 8. STUPID TRICKS Sampler
67 a. Kernel Magic
68 b. Bouncing Windows
69 c. The Big Bird Window
70 d. The Ol' Switcheroo
71 9. BUGS, 10. SEE Also
72
73
74 Operation
75 When operating top, the two most important keys are the help (h or ?)
76 key and quit (`q') key. Alternatively, you could simply use the
77 traditional interrupt key (^C) when you're done.
78
79 When started for the first time, you'll be presented with these
80 traditional elements on the main top screen: 1) Summary Area; 2)
81 Fields/Columns Header; 3) Task Area. Each of these will be explored in
82 the sections that follow. There is also an Input/Message line between
83 the Summary Area and Columns Header which needs no further explanation.
84
85 The main top screen is generally quite adaptive to changes in terminal
86 dimensions under X-Windows. Other top screens may be less so,
87 especially those with static text. It ultimately depends, however, on
88 your particular window manager and terminal emulator. There may be
89 occasions when their view of terminal size and current contents differs
90 from top's view, which is always based on operating system calls.
91
92 Following any re-size operation, if a top screen is corrupted, appears
93 incomplete or disordered, simply typing something innocuous like a
94 punctuation character or cursor motion key will usually restore it. In
95 extreme cases, the following sequence almost certainly will:
96 key/cmd objective
97 ^Z suspend top
98 fg resume top
99 <Left> force a screen redraw (if necessary)
100
101 But if the display is still corrupted, there is one more step you could
102 try. Insert this command after top has been suspended but before
103 resuming it.
104 key/cmd objective
105 reset restore your terminal settings
106
107 Note: the width of top's display will be limited to 512 positions.
108 Displaying all fields requires approximately 250 characters. Remaining
109 screen width is usually allocated to any variable width columns
110 currently visible. The variable width columns, such as COMMAND, are
111 noted in topic 3a. DESCRIPTIONS of Fields. Actual output width may
112 also be influenced by the -w switch, which is discussed in topic 1.
113 COMMAND-LINE Options.
114
115 Lastly, some of top's screens or functions require the use of cursor
116 motion keys like the standard arrow keys plus the Home, End, PgUp and
117 PgDn keys. If your terminal or emulator does not provide those keys,
118 the following combinations are accepted as alternatives:
119 key equivalent-keys
120 Left alt + h
121 Down alt + j
122 Up alt + k
123 Right alt + l
124 Home alt + ctrl + h
125 PgDn alt + ctrl + j
126 PgUp alt + ctrl + k
127 End alt + ctrl + l
128
129 The Up and Down arrow keys have special significance when prompted for
130 line input terminated with the <Enter> key. Those keys, or their
131 aliases, can be used to retrieve previous input lines which can then be
132 edited and re-input. And there are four additional keys available with
133 line oriented input.
134 key special-significance
135 Up recall older strings for re-editing
136 Down recall newer strings or erase entire line
137 Insert toggle between insert and overtype modes
138 Delete character removed at cursor, moving others left
139 Home jump to beginning of input line
140 End jump to end of input line
141
142
143 Linux Memory Types
144 For our purposes there are three types of memory, and one is optional.
145 First is physical memory, a limited resource where code and data must
146 reside when executed or referenced. Next is the optional swap file,
147 where modified (dirty) memory can be saved and later retrieved if too
148 many demands are made on physical memory. Lastly we have virtual
149 memory, a nearly unlimited resource serving the following goals:
150
151 1. abstraction, free from physical memory addresses/limits
152 2. isolation, every process in a separate address space
153 3. sharing, a single mapping can serve multiple needs
154 4. flexibility, assign a virtual address to a file
155
156 Regardless of which of these forms memory may take, all are managed as
157 pages (typically 4096 bytes) but expressed by default in top as KiB
158 (kibibyte). The memory discussed under topic `2c. MEMORY Usage' deals
159 with physical memory and the swap file for the system as a whole. The
160 memory reviewed in topic `3. FIELDS / Columns Display' embraces all
161 three memory types, but for individual processes.
162
163 For each such process, every memory page is restricted to a single
164 quadrant from the table below. Both physical memory and virtual memory
165 can include any of the four, while the swap file only includes #1
166 through #3. The memory in quadrant #4, when modified, acts as its own
167 dedicated swap file.
168
169 Private | Shared
170 1 | 2
171 Anonymous . stack |
172 . malloc() |
173 . brk()/sbrk() | . POSIX shm*
174 . mmap(PRIVATE, ANON) | . mmap(SHARED, ANON)
175 -----------------------+----------------------
176 . mmap(PRIVATE, fd) | . mmap(SHARED, fd)
177 File-backed . pgms/shared libs |
178 3 | 4
179
180 The following may help in interpreting process level memory values
181 displayed as scalable columns and discussed under topic `3a.
182 DESCRIPTIONS of Fields'.
183
184 %MEM - simply RES divided by total physical memory
185 CODE - the `pgms' portion of quadrant 3
186 DATA - the entire quadrant 1 portion of VIRT plus all
187 explicit mmap file-backed pages of quadrant 3
188 RES - anything occupying physical memory which, beginning with
189 Linux-4.5, is the sum of the following three fields:
190 RSan - quadrant 1 pages, which include any
191 former quadrant 3 pages if modified
192 RSfd - quadrant 3 and quadrant 4 pages
193 RSsh - quadrant 2 pages
194 RSlk - subset of RES which cannot be swapped out (any quadrant)
195 SHR - subset of RES (excludes 1, includes all 2 & 4, some 3)
196 SWAP - potentially any quadrant except 4
197 USED - simply the sum of RES and SWAP
198 VIRT - everything in-use and/or reserved (all quadrants)
199
200 Note: Even though program images and shared libraries are considered
201 private to a process, they will be accounted for as shared (SHR) by the
202 kernel.
203
204
206 Mandatory arguments to long options are mandatory for short options
207 too.
208
209 Although not required, the equals sign can be used with either option
210 form and whitespace before and/or after the `=' is permitted.
211
212
213 -b, --batch
214 Starts top in Batch mode, which could be useful for sending output
215 from top to other programs or to a file. In this mode, top will not
216 accept input and runs until the iterations limit you've set with the
217 `-n' command-line option or until killed.
218
219
220 -c, --cmdline-toggle
221 Starts top with the last remembered `c' state reversed. Thus, if
222 top was displaying command lines, now that field will show program
223 names, and vice versa. See the `c' interactive command for
224 additional information.
225
226
227 -d, --delay = SECS [.TENTHS]
228 Specifies the delay between screen updates, and overrides the
229 corresponding value in one's personal configuration file or the
230 startup default. Later this can be changed with the `d' or `s'
231 interactive commands.
232
233 Fractional seconds are honored, but a negative number is not
234 allowed. In all cases, however, such changes are prohibited if top
235 is running in Secure mode, except for root (unless the `s'
236 command-line option was used). For additional information on Secure
237 mode see topic 6d. SYSTEM Restrictions File.
238
239
240 -E, --scale-summary-mem = k | m | g | t | p | e
241 Instructs top to force summary area memory to be scaled as:
242 k - kibibytes
243 m - mebibytes
244 g - gibibytes
245 t - tebibytes
246 p - pebibytes
247 e - exbibytes
248
249 Later this can be changed with the `E' command toggle.
250
251
252 -e, --scale-task-mem = k | m | g | t | p
253 Instructs top to force task area memory to be scaled as:
254 k - kibibytes
255 m - mebibytes
256 g - gibibytes
257 t - tebibytes
258 p - pebibytes
259
260 Later this can be changed with the `e' command toggle.
261
262
263 -H, --threads-show
264 Instructs top to display individual threads. Without this
265 command-line option a summation of all threads in each process is
266 shown. Later this can be changed with the `H' interactive command.
267
268
269 -h, --help
270 Display usage help text, then quit.
271
272
273 -i, --idle-toggle
274 Starts top with the last remembered `i' state reversed. When this
275 toggle is Off, tasks that have not used any CPU since the last
276 update will not be displayed. For additional information regarding
277 this toggle see topic 4c. TASK AREA Commands, SIZE.
278
279
280 -n, --iterations = NUMBER
281 Specifies the maximum number of iterations, or frames, top should
282 produce before ending.
283
284
285 -O, --list-fields
286 This option acts as a form of help for the -o option shown below.
287 It will cause top to print each of the available field names on a
288 separate line, then quit. Such names are subject to NLS (National
289 Language Support) translation.
290
291
292 -o, --sort-override = FIELDNAME
293 Specifies the name of the field on which tasks will be sorted,
294 independent of what is reflected in the configuration file. You can
295 prepend a `+' or `-' to the field name to also override the sort
296 direction. A leading `+' will force sorting high to low, whereas a
297 `-' will ensure a low to high ordering.
298
299 This option exists primarily to support automated/scripted batch
300 mode operation.
301
302
303 -p, --pid = PIDLIST (as: 1,2,3, ... or -p1 -p2 -p3 ...)
304 Monitor only processes with specified process IDs. However, when
305 combined with Threads mode (`H'), all processes in the thread group
306 (see TGID) of each monitored PID will also be shown.
307
308 This option can be given up to 20 times, or you can provide a comma
309 delimited list with up to 20 pids. Co-mingling both approaches is
310 permitted.
311
312 A pid value of zero will be treated as the process id of the top
313 program itself once it is running.
314
315 This is a command-line option only and should you wish to return to
316 normal operation, it is not necessary to quit and restart top --
317 just issue any of these interactive commands: `=', `u' or `U'.
318
319 The `p', `u' and `U' command-line options are mutually exclusive.
320
321
322 -S, --accum-time-toggle
323 Starts top with the last remembered `S' state reversed. When
324 Cumulative time mode is On, each process is listed with the cpu time
325 that it and its dead children have used. See the `S' interactive
326 command for additional information regarding this mode.
327
328
329 -s, --secure-mode
330 Starts top with secure mode forced, even for root. This mode is far
331 better controlled through a system configuration file (see topic 6.
332 FILES).
333
334
335 -U, --filter-any-user = USER (as: number or name)
336 Display only processes with a user id or user name matching that
337 given. This option matches on any user (real, effective, saved, or
338 filesystem).
339
340 Prepending an exclamation point (`!') to the user id or name
341 instructs top to display only processes with users not matching the
342 one provided.
343
344 The `p', `U' and `u' command-line options are mutually exclusive.
345
346
347 -u, --filter-only-euser = USER (as: number or name)
348 Display only processes with a user id or user name matching that
349 given. This option matches on the effective user id only.
350
351 Prepending an exclamation point (`!') to the user id or name
352 instructs top to display only processes with users not matching the
353 one provided.
354
355 The `p', `U' and `u' command-line options are mutually exclusive.
356
357
358 -V, --version
359 Display version information, then quit.
360
361
362 -w, --width [=COLUMNS]
363 In Batch mode, when used without an argument top will format output
364 using the COLUMNS= and LINES= environment variables, if set.
365 Otherwise, width will be fixed at the maximum 512 columns. With an
366 argument, output width can be decreased or increased (up to 512) but
367 the number of rows is considered unlimited.
368
369 In normal display mode, when used without an argument top will
370 attempt to format output using the COLUMNS= and LINES= environment
371 variables, if set. With an argument, output width can only be
372 decreased, not increased. Whether using environment variables or an
373 argument with -w, when not in Batch mode actual terminal dimensions
374 can never be exceeded.
375
376 Note: Without the use of this command-line option, output width is
377 always based on the terminal at which top was invoked whether or not
378 in Batch mode.
379
380
381 -1, --single-cpu-toggle
382 Starts top with the last remembered Cpu States portion of the
383 summary area reversed. Either all cpu information will be displayed
384 in a single line or each cpu will be displayed separately, depending
385 on the state of the NUMA Node command toggle (`2').
386
387 See the `1' and `2' interactive commands for additional information.
388
389
391 Each of the following three areas are individually controlled through
392 one or more interactive commands. See topic 4b. SUMMARY AREA Commands
393 for additional information regarding these provisions.
394
395
396 2a. UPTIME and LOAD Averages
397 This portion consists of a single line containing:
398 program or window name, depending on display mode
399 current time and length of time since last boot
400 total number of users
401 system load avg over the last 1, 5 and 15 minutes
402
403
404 2b. TASK and CPU States
405 This portion consists of a minimum of two lines. In an SMP
406 environment, additional lines can reflect individual CPU state
407 percentages.
408
409 Line 1 shows total tasks or threads, depending on the state of the
410 Threads-mode toggle. That total is further classified as:
411 running; sleeping; stopped; zombie
412
413 Line 2 shows CPU state percentages based on the interval since the last
414 refresh.
415
416 As a default, percentages for these individual categories are
417 displayed. Depending on your kernel version, the st field may not be
418 shown.
419 us : time running un-niced user processes
420 sy : time running kernel processes
421 ni : time running niced user processes
422 id : time spent in the kernel idle handler
423 wa : time waiting for I/O completion
424 hi : time spent servicing hardware interrupts
425 si : time spent servicing software interrupts
426 st : time stolen from this vm by the hypervisor
427
428 Beyond the first tasks/threads line, there are alternate CPU display
429 modes available via the 4-way `t' command toggle. They show an
430 abbreviated summary consisting of these elements:
431 a b c d
432 %Cpu(s): 75.0/25.0 100[ ... ]
433
434
435 Where: a) is the `user' (us + ni) percentage; b) is the `system' (sy +
436 hi + si) percentage; c) is the total percentage; and d) is one of two
437 visual graphs of those representations. Such graphs also reflect
438 separate `user' and `system' portions.
439
440 If the `4' command toggle is used to yield more than two cpus per line,
441 results will be further abridged eliminating the a) and b) elements.
442 However, that information is still reflected in the graph itself
443 assuming color is active or, if not, bars vs. blocks are being shown.
444
445 See topic 4b. SUMMARY AREA Commands for additional information on the
446 `t' and `4' command toggles.
447
448
449 2c. MEMORY Usage
450 This portion consists of two lines which may express values in
451 kibibytes (KiB) through exbibytes (EiB) depending on the scaling factor
452 enforced with the `E' interactive command.
453
454 As a default, Line 1 reflects physical memory, classified as:
455 total, free, used and buff/cache
456
457 Line 2 reflects mostly virtual memory, classified as:
458 total, free, used and avail (which is physical memory)
459
460 The avail number on line 2 is an estimation of physical memory
461 available for starting new applications, without swapping. Unlike the
462 free field, it attempts to account for readily reclaimable page cache
463 and memory slabs. It is available on kernels 3.14, emulated on kernels
464 2.6.27+, otherwise the same as free.
465
466 In the alternate memory display modes, two abbreviated summary lines
467 are shown consisting of these elements:
468 a b c
469 GiB Mem : 18.7/15.738 [ ... ]
470 GiB Swap: 0.0/7.999 [ ... ]
471
472 Where: a) is the percentage used; b) is the total available; and c) is
473 one of two visual graphs of those representations.
474
475 In the case of physical memory, the percentage represents the total
476 minus the estimated avail noted above. The `Mem' graph itself is
477 divided between the non-cached portion of used and any remaining memory
478 not otherwise accounted for by avail. See topic 4b. SUMMARY AREA
479 Commands and the `m' command for additional information on that special
480 4-way toggle.
481
482 This table may help in interpreting the scaled values displayed:
483 KiB = kibibyte = 1024 bytes
484 MiB = mebibyte = 1024 KiB = 1,048,576 bytes
485 GiB = gibibyte = 1024 MiB = 1,073,741,824 bytes
486 TiB = tebibyte = 1024 GiB = 1,099,511,627,776 bytes
487 PiB = pebibyte = 1024 TiB = 1,125,899,906,842,624 bytes
488 EiB = exbibyte = 1024 PiB = 1,152,921,504,606,846,976 bytes
489
490
492 3a. DESCRIPTIONS of Fields
493 Listed below are top's available process fields (columns). They are
494 shown in strict ascii alphabetical order. You may customize their
495 position and whether or not they are displayable with the `f' (Fields
496 Management) interactive command.
497
498 Any field is selectable as the sort field, and you control whether they
499 are sorted high-to-low or low-to-high. For additional information on
500 sort provisions see topic 4c. TASK AREA Commands, SORTING.
501
502 The fields related to physical memory or virtual memory reference
503 `(KiB)' which is the unsuffixed display mode. Such fields may,
504 however, be scaled from KiB through PiB. That scaling is influenced
505 via the `e' interactive command or established for startup through a
506 build option.
507
508
509 %CPU -- CPU Usage
510 The task's share of the elapsed CPU time since the last screen
511 update, expressed as a percentage of total CPU time.
512
513 In a true SMP environment, if a process is multi-threaded and top
514 is not operating in Threads mode, amounts greater than 100% may be
515 reported. You toggle Threads mode with the `H' interactive
516 command.
517
518 Also for multi-processor environments, if Irix mode is Off, top
519 will operate in Solaris mode where a task's cpu usage will be
520 divided by the total number of CPUs. You toggle Irix/Solaris modes
521 with the `I' interactive command.
522
523 Note: When running in forest view mode (`V') with children
524 collapsed (`v'), this field will also include the CPU time of those
525 unseen children. See topic 4c. TASK AREA Commands, CONTENT for
526 more information regarding the `V' and `v' toggles.
527
528
529 %CUC -- CPU Utilization
530 This field is identical to %CUU below, except the percentage also
531 reflects reaped child processes.
532
533
534 %CUU -- CPU Utilization
535 A task's total CPU usage divided by its elapsed running time,
536 expressed as a percentage.
537
538 If a process currently displays high CPU usage, this field can help
539 determine if such behavior is normal. Conversely, if a process has
540 low CPU usage currently, %CUU may reflect historically higher
541 demands over its lifetime.
542
543
544 %MEM -- Memory Usage (RES)
545 A task's currently resident share of available physical memory.
546
547 See `OVERVIEW, Linux Memory Types' for additional details.
548
549
550 AGID -- Autogroup Identifier
551 The autogroup identifier associated with a process. This feature
552 operates in conjunction with the CFS scheduler to improve
553 interactive desktop performance.
554
555 When /proc/sys/kernel/sched_autogroup_enabled is set, a new
556 autogroup is created with each new session (see SID). All
557 subsequently forked processes in that session inherit membership in
558 this autogroup. The kernel then attempts to equalize distribution
559 of CPU cycles across such groups. Thus, an autogroup with many CPU
560 intensive processes (e.g make -j) will not dominate an autogroup
561 with only one or two processes.
562
563 When -1 is displayed it means this information is not available.
564
565
566 AGNI -- Autogroup Nice Value
567 The autogroup nice value which affects scheduling of all processes
568 in that group. A negative nice value means higher priority,
569 whereas a positive nice value means lower priority.
570
571
572 CGNAME -- Control Group Name
573 The name of the control group to which a process belongs, or `-' if
574 not applicable for that process.
575
576 This will typically be the last entry in the full list of control
577 groups as shown under the next heading (CGROUPS). And as is true
578 there, this field is also variable width.
579
580
581 CGROUPS -- Control Groups
582 The names of the control group(s) to which a process belongs, or
583 `-' if not applicable for that process.
584
585 Control Groups provide for allocating resources (cpu, memory,
586 network bandwidth, etc.) among installation-defined groups of
587 processes. They enable fine-grained control over allocating,
588 denying, prioritizing, managing and monitoring those resources.
589
590 Many different hierarchies of cgroups can exist simultaneously on a
591 system and each hierarchy is attached to one or more subsystems. A
592 subsystem represents a single resource.
593
594 Note: The CGROUPS field, unlike most columns, is not fixed-width.
595 When displayed, it plus any other variable width columns will be
596 allocated all remaining screen width (up to the maximum 512
597 characters). Even so, such variable width fields could still
598 suffer truncation. See topic 5c. SCROLLING a Window for additional
599 information on accessing any truncated data.
600
601
602 CODE -- Code Size (KiB)
603 The amount of physical memory currently devoted to executable code,
604 also known as the Text Resident Set size or TRS.
605
606 See `OVERVIEW, Linux Memory Types' for additional details.
607
608
609 COMMAND -- Command Name or Command Line
610 Display the command line used to start a task or the name of the
611 associated program. You toggle between command line and name with
612 `c', which is both a command-line option and an interactive
613 command.
614
615 When you've chosen to display command lines, processes without a
616 command line (like kernel threads) will be shown with only the
617 program name in brackets, as in this example:
618 [kthreadd]
619
620 This field may also be impacted by the forest view display mode.
621 See the `V' interactive command for additional information
622 regarding that mode.
623
624 Note: The COMMAND field, unlike most columns, is not fixed-width.
625 When displayed, it plus any other variable width columns will be
626 allocated all remaining screen width (up to the maximum 512
627 characters). Even so, such variable width fields could still
628 suffer truncation. This is especially true for this field when
629 command lines are being displayed (the `c' interactive command.)
630 See topic 5c. SCROLLING a Window for additional information on
631 accessing any truncated data.
632
633
634 DATA -- Data + Stack Size (KiB)
635 The amount of private memory reserved by a process. It is also
636 known as the Data Resident Set or DRS. Such memory may not yet be
637 mapped to physical memory (RES) but will always be included in the
638 virtual memory (VIRT) amount.
639
640 See `OVERVIEW, Linux Memory Types' for additional details.
641
642
643 ELAPSED -- Elapsed Running Time
644 The length of time since a process was started. Thus, the most
645 recently started task will display the smallest time interval.
646
647 The value will be expressed as `HH,MM' (hours,minutes) but is
648 subject to additional scaling if the interval becomes too great to
649 fit column width. At that point it will be scaled to `DD+HH'
650 (days+hours) and possibly beyond.
651
652
653 ENVIRON -- Environment variables
654 Display all of the environment variables, if any, as seen by the
655 respective processes. These variables will be displayed in their
656 raw native order, not the sorted order you are accustomed to seeing
657 with an unqualified `set'.
658
659 Note: The ENVIRON field, unlike most columns, is not fixed-width.
660 When displayed, it plus any other variable width columns will be
661 allocated all remaining screen width (up to the maximum 512
662 characters). Even so, such variable width fields could still
663 suffer truncation. This is especially true for this field. See
664 topic 5c. SCROLLING a Window for additional information on
665 accessing any truncated data.
666
667
668 EXE -- Executable Path
669 Where available, this is the full path to the executable, including
670 the program name.
671
672 Note: The EXE field, unlike most columns, is not fixed-width. When
673 displayed, it plus any other variable width columns will be
674 allocated all remaining screen width (up to the maximum 512
675 characters).
676
677
678 Flags -- Task Flags
679 This column represents the task's current scheduling flags which
680 are expressed in hexadecimal notation and with zeros suppressed.
681 These flags are officially documented in <linux/sched.h>.
682
683
684 GID -- Group Id
685 The effective group ID.
686
687
688 GROUP -- Group Name
689 The effective group name.
690
691
692 LOGID -- Login User Id
693 The user ID used at login. When -1 is displayed it means this
694 information is not available.
695
696
697 LXC -- Lxc Container Name
698 The name of the lxc container within which a task is running. If a
699 process is not running inside a container, a dash (`-') will be
700 shown.
701
702
703 NI -- Nice Value
704 The nice value of the task. A negative nice value means higher
705 priority, whereas a positive nice value means lower priority. Zero
706 in this field simply means priority will not be adjusted in
707 determining a task's dispatch-ability.
708
709 Note: This value only affects scheduling priority relative to other
710 processes in the same autogroup. See the `AGID' and `AGNI' fields
711 for additional information on autogroups.
712
713
714 NU -- Last known NUMA node
715 A number representing the NUMA node associated with the last used
716 processor (`P'). When -1 is displayed it means that NUMA
717 information is not available.
718
719 See the `2' and `3' interactive commands for additional NUMA
720 provisions affecting the summary area.
721
722
723 OOMa -- Out of Memory Adjustment Factor
724 The value, ranging from -1000 to +1000, added to the current out of
725 memory score (OOMs) which is then used to determine which task to
726 kill when memory is exhausted.
727
728
729 OOMs -- Out of Memory Score
730 The value, ranging from 0 to +1000, used to select task(s) to kill
731 when memory is exhausted. Zero translates to `never kill' whereas
732 1000 means `always kill'.
733
734
735 P -- Last used CPU (SMP)
736 A number representing the last used processor. In a true SMP
737 environment this will likely change frequently since the kernel
738 intentionally uses weak affinity. Also, the very act of running
739 top may break this weak affinity and cause more processes to change
740 CPUs more often (because of the extra demand for cpu time).
741
742
743 PGRP -- Process Group Id
744 Every process is member of a unique process group which is used for
745 distribution of signals and by terminals to arbitrate requests for
746 their input and output. When a process is created (forked), it
747 becomes a member of the process group of its parent. By
748 convention, this value equals the process ID (see PID) of the first
749 member of a process group, called the process group leader.
750
751
752 PID -- Process Id
753 The task's unique process ID, which periodically wraps, though
754 never restarting at zero. In kernel terms, it is a dispatchable
755 entity defined by a task_struct.
756
757 This value may also be used as: a process group ID (see PGRP); a
758 session ID for the session leader (see SID); a thread group ID for
759 the thread group leader (see TGID); and a TTY process group ID for
760 the process group leader (see TPGID).
761
762
763 PPID -- Parent Process Id
764 The process ID (pid) of a task's parent.
765
766
767 PR -- Priority
768 The scheduling priority of the task. If you see `rt' in this
769 field, it means the task is running under real time scheduling
770 priority.
771
772 Under linux, real time priority is somewhat misleading since
773 traditionally the operating itself was not preemptible. And while
774 the 2.6 kernel can be made mostly preemptible, it is not always so.
775
776
777 PSS -- Proportional Resident Memory, smaps (KiB)
778 The proportion of this task's share of `RSS' where each page is
779 divided by the number of processes sharing it. It is also the sum
780 of the `PSan', `PSfd' and `PSsh' fields.
781
782 For example, if a process has 1000 resident pages alone and 1000
783 resident pages shared with another process, its `PSS' would be 1500
784 (times page size).
785
786 Accessing smaps values is 10x more costly than other memory
787 statistics and data for other users requires root privileges.
788
789
790 PSan -- Proportional Anonymous Memory, smaps (KiB)
791 PSfd -- Proportional File Memory, smaps (KiB)
792 PSsh -- Proportional Shmem Memory, smaps (KiB)
793 As was true for `PSS' above (total proportional resident memory),
794 these fields represent the proportion of this task's share of each
795 type of memory divided by the number of processes sharing it.
796
797 Accessing smaps values is 10x more costly than other memory
798 statistics and data for other users requires root privileges.
799
800
801 RES -- Resident Memory Size (KiB)
802 A subset of the virtual address space (VIRT) representing the non-
803 swapped physical memory a task is currently using. It is also the
804 sum of the `RSan', `RSfd' and `RSsh' fields.
805
806 It can include private anonymous pages, private pages mapped to
807 files (including program images and shared libraries) plus shared
808 anonymous pages. All such memory is backed by the swap file
809 represented separately under SWAP.
810
811 Lastly, this field may also include shared file-backed pages which,
812 when modified, act as a dedicated swap file and thus will never
813 impact SWAP.
814
815 See `OVERVIEW, Linux Memory Types' for additional details.
816
817
818 RSS -- Resident Memory, smaps (KiB)
819 Another, more precise view of process non-swapped physical memory.
820 It is obtained from the `smaps_rollup' file and is generally
821 slightly larger than that shown for `RES'.
822
823 Accessing smaps values is 10x more costly than other memory
824 statistics and data for other users requires root privileges.
825
826
827 RSan -- Resident Anonymous Memory Size (KiB)
828 A subset of resident memory (RES) representing private pages not
829 mapped to a file.
830
831
832 RSfd -- Resident File-Backed Memory Size (KiB)
833 A subset of resident memory (RES) representing the implicitly
834 shared pages supporting program images and shared libraries. It
835 also includes explicit file mappings, both private and shared.
836
837
838 RSlk -- Resident Locked Memory Size (KiB)
839 A subset of resident memory (RES) which cannot be swapped out.
840
841
842 RSsh -- Resident Shared Memory Size (KiB)
843 A subset of resident memory (RES) representing the explicitly
844 shared anonymous shm*/mmap pages.
845
846
847 RUID -- Real User Id
848 The real user ID.
849
850
851 RUSER -- Real User Name
852 The real user name.
853
854
855 S -- Process Status
856 The status of the task which can be one of:
857 D = uninterruptible sleep
858 I = idle
859 R = running
860 S = sleeping
861 T = stopped by job control signal
862 t = stopped by debugger during trace
863 Z = zombie
864
865 Tasks shown as running should be more properly thought of as ready
866 to run -- their task_struct is simply represented on the Linux
867 run-queue. Even without a true SMP machine, you may see numerous
868 tasks in this state depending on top's delay interval and nice
869 value.
870
871
872 SHR -- Shared Memory Size (KiB)
873 A subset of resident memory (RES) that may be used by other
874 processes. It will include shared anonymous pages and shared file-
875 backed pages. It also includes private pages mapped to files
876 representing program images and shared libraries.
877
878 See `OVERVIEW, Linux Memory Types' for additional details.
879
880
881 SID -- Session Id
882 A session is a collection of process groups (see PGRP), usually
883 established by the login shell. A newly forked process joins the
884 session of its creator. By convention, this value equals the
885 process ID (see PID) of the first member of the session, called the
886 session leader, which is usually the login shell.
887
888
889 STARTED -- Start Time Interval
890 The length of time since system boot when a process started. Thus,
891 the most recently started task will display the largest time
892 interval.
893
894 The value will be expressed as `MM:SS' (minutes:seconds). But if
895 the interval is too great to fit column width it will be scaled as
896 `HH,MM' (hours,minutes) and possibly beyond.
897
898
899 SUID -- Saved User Id
900 The saved user ID.
901
902
903 SUPGIDS -- Supplementary Group IDs
904 The IDs of any supplementary group(s) established at login or
905 inherited from a task's parent. They are displayed in a comma
906 delimited list.
907
908 Note: The SUPGIDS field, unlike most columns, is not fixed-width.
909 When displayed, it plus any other variable width columns will be
910 allocated all remaining screen width (up to the maximum 512
911 characters).
912
913
914 SUPGRPS -- Supplementary Group Names
915 The names of any supplementary group(s) established at login or
916 inherited from a task's parent. They are displayed in a comma
917 delimited list.
918
919 Note: The SUPGRPS field, unlike most columns, is not fixed-width.
920 When displayed, it plus any other variable width columns will be
921 allocated all remaining screen width (up to the maximum 512
922 characters).
923
924
925 SUSER -- Saved User Name
926 The saved user name.
927
928
929 SWAP -- Swapped Size (KiB)
930 The formerly resident portion of a task's address space written to
931 the swap file when physical memory becomes over committed.
932
933 See `OVERVIEW, Linux Memory Types' for additional details.
934
935
936 TGID -- Thread Group Id
937 The ID of the thread group to which a task belongs. It is the PID
938 of the thread group leader. In kernel terms, it represents those
939 tasks that share an mm_struct.
940
941
942 TIME -- CPU Time
943 Total CPU time the task has used since it started. When Cumulative
944 mode is On, each process is listed with the cpu time that it and
945 its dead children have used. You toggle Cumulative mode with `S',
946 which is both a command-line option and an interactive command.
947 See the `S' interactive command for additional information
948 regarding this mode.
949
950
951 TIME+ -- CPU Time, hundredths
952 The same as TIME, but reflecting more granularity through
953 hundredths of a second.
954
955
956 TPGID -- Tty Process Group Id
957 The process group ID of the foreground process for the connected
958 tty, or -1 if a process is not connected to a terminal. By
959 convention, this value equals the process ID (see PID) of the
960 process group leader (see PGRP).
961
962
963 TTY -- Controlling Tty
964 The name of the controlling terminal. This is usually the device
965 (serial port, pty, etc.) from which the process was started, and
966 which it uses for input or output. However, a task need not be
967 associated with a terminal, in which case you'll see `?' displayed.
968
969
970 UID -- User Id
971 The effective user ID of the task's owner.
972
973
974 USED -- Memory in Use (KiB)
975 This field represents the non-swapped physical memory a task is
976 using (RES) plus the swapped out portion of its address space
977 (SWAP).
978
979 See `OVERVIEW, Linux Memory Types' for additional details.
980
981
982 USER -- User Name
983 The effective user name of the task's owner.
984
985
986 USS -- Unique Set Size
987 The non-swapped portion of physical memory (`RSS') not shared with
988 any other process. It is derived from the `smaps_rollup' file.
989
990 Accessing smaps values is 10x more costly than other memory
991 statistics and data for other users requires root privileges.
992
993
994 VIRT -- Virtual Memory Size (KiB)
995 The total amount of virtual memory used by the task. It includes
996 all code, data and shared libraries plus pages that have been
997 swapped out and pages that have been mapped but not used.
998
999 See `OVERVIEW, Linux Memory Types' for additional details.
1000
1001
1002 WCHAN -- Sleeping in Function
1003 This field will show the name of the kernel function in which the
1004 task is currently sleeping. Running tasks will display a dash
1005 (`-') in this column.
1006
1007
1008 ioR -- I/O Bytes Read
1009 The number of bytes a process caused to be fetched from the storage
1010 layer.
1011
1012 Root privileges are required to display `io' data for other users.
1013
1014
1015 ioRop -- I/O Read Operations
1016 The number of read I/O operations (syscalls) for a process. Such
1017 calls might not result in actual physical disk I/O.
1018
1019
1020 ioW -- I/O Bytes Written
1021 The number of bytes a process caused to be sent to the storage
1022 layer.
1023
1024
1025 ioWop -- I/O Write Operations
1026 The number of write I/O operations (syscalls) for a process. Such
1027 calls might not result in actual physical disk I/O.
1028
1029
1030 nDRT -- Dirty Pages Count
1031 The number of pages that have been modified since they were last
1032 written to auxiliary storage. Dirty pages must be written to
1033 auxiliary storage before the corresponding physical memory location
1034 can be used for some other virtual page.
1035
1036 This field was deprecated with linux 2.6 and is always zero.
1037
1038
1039 nMaj -- Major Page Fault Count
1040 The number of major page faults that have occurred for a task. A
1041 page fault occurs when a process attempts to read from or write to
1042 a virtual page that is not currently present in its address space.
1043 A major page fault is when auxiliary storage access is involved in
1044 making that page available.
1045
1046
1047 nMin -- Minor Page Fault count
1048 The number of minor page faults that have occurred for a task. A
1049 page fault occurs when a process attempts to read from or write to
1050 a virtual page that is not currently present in its address space.
1051 A minor page fault does not involve auxiliary storage access in
1052 making that page available.
1053
1054
1055 nTH -- Number of Threads
1056 The number of threads associated with a process.
1057
1058
1059 nsCGROUP -- CGROUP namespace
1060 The Inode of the namespace used to hide the identity of the control
1061 group of which process is a member.
1062
1063
1064 nsIPC -- IPC namespace
1065 The Inode of the namespace used to isolate interprocess
1066 communication (IPC) resources such as System V IPC objects and
1067 POSIX message queues.
1068
1069
1070 nsMNT -- MNT namespace
1071 The Inode of the namespace used to isolate filesystem mount points
1072 thus offering different views of the filesystem hierarchy.
1073
1074
1075 nsNET -- NET namespace
1076 The Inode of the namespace used to isolate resources such as
1077 network devices, IP addresses, IP routing, port numbers, etc.
1078
1079
1080 nsPID -- PID namespace
1081 The Inode of the namespace used to isolate process ID numbers
1082 meaning they need not remain unique. Thus, each such namespace
1083 could have its own `init/systemd' (PID #1) to manage various
1084 initialization tasks and reap orphaned child processes.
1085
1086
1087 nsTIME -- TIME namespace
1088 The Inode of the namespace which allows processes to see different
1089 system times in a way similar to the UTS namespace.
1090
1091
1092 nsUSER -- USER namespace
1093 The Inode of the namespace used to isolate the user and group ID
1094 numbers. Thus, a process could have a normal unprivileged user ID
1095 outside a user namespace while having a user ID of 0, with full
1096 root privileges, inside that namespace.
1097
1098
1099 nsUTS -- UTS namespace
1100 The Inode of the namespace used to isolate hostname and NIS domain
1101 name. UTS simply means "UNIX Time-sharing System".
1102
1103
1104 vMj -- Major Page Fault Count Delta
1105 The number of major page faults that have occurred since the last
1106 update (see nMaj).
1107
1108
1109 vMn -- Minor Page Fault Count Delta
1110 The number of minor page faults that have occurred since the last
1111 update (see nMin).
1112
1113
1114 3b. MANAGING Fields
1115 After pressing the interactive command `f' (Fields Management) you will
1116 be presented with a screen showing: 1) the `current' window name; 2)
1117 the designated sort field; 3) all fields in their current order along
1118 with descriptions. Entries marked with an asterisk are the currently
1119 displayed fields, screen width permitting.
1120
1121
1122 • As the on screen instructions indicate, you navigate among the
1123 fields with the Up and Down arrow keys. The PgUp, PgDn, Home
1124 and End keys can also be used to quickly reach the first or last
1125 available field.
1126
1127
1128 • The Right arrow key selects a field for repositioning and the
1129 Left arrow key or the <Enter> key commits that field's
1130 placement.
1131
1132
1133 • The `d' key or the <Space> bar toggles a field's display status,
1134 and thus the presence or absence of the asterisk.
1135
1136
1137 • The `s' key designates a field as the sort field. See topic 4c.
1138 TASK AREA Commands, SORTING for additional information regarding
1139 your selection of a sort field.
1140
1141
1142 • The `a' and `w' keys can be used to cycle through all available
1143 windows and the `q' or <Esc> keys exit Fields Management.
1144
1145
1146 The Fields Management screen can also be used to change the `current'
1147 window/field group in either full-screen mode or alternate-display
1148 mode. Whatever was targeted when `q' or <Esc> was pressed will be made
1149 current as you return to the top display. See topic 5.
1150 ALTERNATE-DISPLAY Provisions and the `g' interactive command for
1151 insight into `current' windows and field groups.
1152
1153
1154 Note: Any window that has been scrolled horizontally will be reset if
1155 any field changes are made via the Fields Management screen. Any
1156 vertical scrolled position, however, will not be affected. See topic
1157 5c. SCROLLING a Window for additional information regarding vertical
1158 and horizontal scrolling.
1159
1160
1162 Listed below is a brief index of commands within categories. Some
1163 commands appear more than once -- their meaning or scope may vary
1164 depending on the context in which they are issued.
1165
1166 4a. Global-Commands
1167 <Ent/Sp> ?, =, 0,
1168 A, B, d, E, e, g, H, h, I, k, q, r, s, W, X, Y, Z,
1169 ^G, ^K, ^N, ^P, ^U, ^L, ^R
1170 4b. Summary-Area-Commands
1171 C, l, t, m, 1, 2, 3, 4, 5, !
1172 4c. Task-Area-Commands
1173 Appearance: b, J, j, x, y, z
1174 Content: c, F, f, O, o, S, U, u, V, v, ^E
1175 Size: #, i, n
1176 Sorting: <, >, f, R
1177 4d. Color-Mapping
1178 <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
1179 5b. Commands-for-Windows
1180 -, _, =, +, A, a, G, g, w
1181 5c. Scrolling-a-Window
1182 C, Up, Dn, Left, Right, PgUp, PgDn, Home, End
1183 5d. Searching-in-a-Window
1184 L, &
1185 5e. Filtering-in-a-Window
1186 O, o, ^O, =, +
1187
1188
1189 4a. GLOBAL Commands
1190 The global interactive commands are always available in both
1191 full-screen mode and alternate-display mode. However, some of these
1192 interactive commands are not available when running in Secure mode.
1193
1194 If you wish to know in advance whether or not your top has been
1195 secured, simply ask for help and view the system summary on the second
1196 line.
1197
1198
1199 <Enter> or <Space> :Refresh-Display
1200 These commands awaken top and following receipt of any input the
1201 entire display will be repainted. They also force an update of
1202 any hotplugged cpu or physical memory changes.
1203
1204 Use either of these keys if you have a large delay interval and
1205 wish to see current status,
1206
1207
1208 ? | h :Help
1209 There are two help levels available. The first will provide a
1210 reminder of all the basic interactive commands. If top is
1211 secured, that screen will be abbreviated.
1212
1213 Typing `h' or `?' on that help screen will take you to help for
1214 those interactive commands applicable to alternate-display mode.
1215
1216
1217 = :Exit-Display-Limits
1218 Removes restrictions on what is shown. This command will
1219 reverse any `i' (idle tasks), `n' (max tasks), `v' (hide
1220 children) and `F' focus commands that might be active. It also
1221 provides for an exit from PID monitoring, User filtering, Other
1222 filtering, Locate processing and Combine Cpus mode.
1223
1224 Additionally, if the window has been scrolled it will be reset
1225 with this command.
1226
1227
1228 0 :Zero-Suppress toggle
1229 This command determines whether zeros are shown or suppressed
1230 for many of the fields in a task window. Fields like UID, GID,
1231 NI, PR or P are not affected by this toggle.
1232
1233
1234 A :Alternate-Display-Mode toggle
1235 This command will switch between full-screen mode and
1236 alternate-display mode. See topic 5. ALTERNATE-DISPLAY
1237 Provisions and the `g' interactive command for insight into
1238 `current' windows and field groups.
1239
1240
1241 B :Bold-Disable/Enable toggle
1242 This command will influence use of the bold terminfo capability
1243 and alters both the summary area and task area for the `current'
1244 window. While it is intended primarily for use with dumb
1245 terminals, it can be applied anytime.
1246
1247 Note: When this toggle is On and top is operating in monochrome
1248 mode, the entire display will appear as normal text. Thus,
1249 unless the `x' and/or `y' toggles are using reverse for
1250 emphasis, there will be no visual confirmation that they are
1251 even on.
1252
1253
1254 * d | s :Change-Delay-Time-interval
1255 You will be prompted to enter the delay time, in seconds,
1256 between display updates.
1257
1258 Fractional seconds are honored, but a negative number is not
1259 allowed. Entering 0 causes (nearly) continuous updates, with an
1260 unsatisfactory display as the system and tty driver try to keep
1261 up with top's demands. The delay value is inversely
1262 proportional to system loading, so set it with care.
1263
1264 If at any time you wish to know the current delay time, simply
1265 ask for help and view the system summary on the second line.
1266
1267
1268 E :Enforce-Summary-Memory-Scale in Summary Area
1269 With this command you can cycle through the available summary
1270 area memory scaling which ranges from KiB (kibibytes or 1,024
1271 bytes) through EiB (exbibytes or 1,152,921,504,606,846,976
1272 bytes).
1273
1274 If you see a `+' between a displayed number and the following
1275 label, it means that top was forced to truncate some portion of
1276 that number. By raising the scaling factor, such truncation can
1277 be avoided.
1278
1279
1280 e :Enforce-Task-Memory-Scale in Task Area
1281 With this command you can cycle through the available task area
1282 memory scaling which ranges from KiB (kibibytes or 1,024 bytes)
1283 through PiB (pebibytes or 1,125,899,906,842,624 bytes).
1284
1285 While top will try to honor the selected target range,
1286 additional scaling might still be necessary in order to
1287 accommodate current values. If you wish to see a more
1288 homogeneous result in the memory columns, raising the scaling
1289 range will usually accomplish that goal. Raising it too high,
1290 however, is likely to produce an all zero result which cannot be
1291 suppressed with the `0' interactive command.
1292
1293
1294 g :Choose-Another-Window/Field-Group
1295 You will be prompted to enter a number between 1 and 4
1296 designating the field group which should be made the `current'
1297 window. You will soon grow comfortable with these 4 windows,
1298 especially after experimenting with alternate-display mode.
1299
1300
1301 H :Threads-mode toggle
1302 When this toggle is On, individual threads will be displayed for
1303 all processes in all visible task windows. Otherwise, top
1304 displays a summation of all threads in each process.
1305
1306
1307 I :Irix/Solaris-Mode toggle
1308 When operating in Solaris mode (`I' toggled Off), a task's cpu
1309 usage will be divided by the total number of CPUs. After
1310 issuing this command, you'll be told the new state of this
1311 toggle.
1312
1313
1314 * k :Kill-a-task
1315 You will be prompted for a PID and then the signal to send.
1316
1317 Entering no PID or a negative number will be interpreted as the
1318 default shown in the prompt (the first task displayed). A PID
1319 value of zero means the top program itself.
1320
1321 The default signal, as reflected in the prompt, is SIGTERM.
1322 However, you can send any signal, via number or name.
1323
1324 If you wish to abort the kill process, do one of the following
1325 depending on your progress:
1326 1) at the pid prompt, type an invalid number
1327 2) at the signal prompt, type 0 (or any invalid signal)
1328 3) at any prompt, type <Esc>
1329
1330
1331 q :Quit
1332
1333
1334 * r :Renice-a-Task
1335 You will be prompted for a PID and then the value to nice it to.
1336
1337 Entering no PID or a negative number will be interpreted as the
1338 default shown in the prompt (the first task displayed). A PID
1339 value of zero means the top program itself.
1340
1341 A positive nice value will cause a process to lose priority.
1342 Conversely, a negative nice value will cause a process to be
1343 viewed more favorably by the kernel. As a general rule,
1344 ordinary users can only increase the nice value and are
1345 prevented from lowering it.
1346
1347 If you wish to abort the renice process, do one of the following
1348 depending on your progress:
1349 1) at the pid prompt, type an invalid number
1350 2) at the nice prompt, type <Enter> with no input
1351 3) at any prompt, type <Esc>
1352
1353
1354 W :Write-the-Configuration-File
1355 This will save all of your options and toggles plus the current
1356 display mode and delay time. By issuing this command just
1357 before quitting top, you will be able restart later in exactly
1358 that same state.
1359
1360
1361 X :Extra-Fixed-Width
1362 Some fields are fixed width and not scalable. As such, they are
1363 subject to truncation which would be indicated by a `+' in the
1364 last position.
1365
1366 This interactive command can be used to alter the widths of the
1367 following fields:
1368
1369 field default field default field default
1370 GID 5 GROUP 8 WCHAN 10
1371 LOGID 5 LXC 8 nsCGROUP 10
1372 RUID 5 RUSER 8 nsIPC 10
1373 SUID 5 SUSER 8 nsMNT 10
1374 UID 5 TTY 8 nsNET 10
1375 USER 8 nsPID 10
1376 nsTIME 10
1377 nsUSER 10
1378 nsUTS 10
1379
1380 You will be prompted for the amount to be added to the default
1381 widths shown above. Entering zero forces a return to those
1382 defaults.
1383
1384 If you enter a negative number, top will automatically increase
1385 the column size as needed until there is no more truncated data.
1386
1387 Note: Whether explicitly or automatically increased, the widths
1388 for these fields are never decreased by top. To narrow them you
1389 must specify a smaller number or restore the defaults.
1390
1391
1392 Y :Inspect-Other-Output
1393 After issuing the `Y' interactive command, you will be prompted
1394 for a target PID. Typing a value or accepting the default
1395 results in a separate screen. That screen can be used to view a
1396 variety of files or piped command output while the normal top
1397 iterative display is paused.
1398
1399 Note: This interactive command is only fully realized when
1400 supporting entries have been manually added to the end of the
1401 top configuration file. For details on creating those entries,
1402 see topic 6b. ADDING INSPECT Entries.
1403
1404 Most of the keys used to navigate the Inspect feature are
1405 reflected in its header prologue. There are, however,
1406 additional keys available once you have selected a particular
1407 file or command. They are familiar to anyone who has used the
1408 pager `less' and are summarized here for future reference.
1409
1410 key function
1411 = alternate status-line, file or pipeline
1412 / find, equivalent to `L' locate
1413 n find next, equivalent to `&' locate next
1414 <Space> scroll down, equivalent to <PgDn>
1415 b scroll up, equivalent to <PgUp>
1416 g first line, equivalent to <Home>
1417 G last line, equivalent to <End>
1418
1419
1420 Z :Change-Color-Mapping
1421 This key will take you to a separate screen where you can change
1422 the colors for the `current' window, or for all windows. For
1423 details regarding this interactive command see topic 4d. COLOR
1424 Mapping.
1425
1426
1427 ^G :Display-Control-Groups (Ctrl key + `g')
1428 ^K :Display-Cmdline (Ctrl key + `k')
1429 ^N :Display-Environment (Ctrl key + `n')
1430 ^P :Display-Namesspaces (Ctrl key + `p')
1431 ^U :Display-Supplementary-Groups (Ctrl key + `u')
1432 Applied to the first process displayed, these commands will show
1433 that task's full (potentially wrapped) information. Such data
1434 will be displayed in a separate window at the bottom of the
1435 screen while normal top monitoring continues.
1436
1437 Keying the same `Ctrl' command a second time removes that
1438 separate window as does the `=' command. Keying a different
1439 `Ctrl' combination, while one is already active, immediately
1440 transitions to the new information.
1441
1442 Notable among these provisions is the Ctrl+N (environment)
1443 command. Its output can be extensive and not easily read when
1444 line wrapped. A more readable version can be achieved with an
1445 `Inspect' entry in the rcfile like the following.
1446
1447 pipe ^I Environment ^I cat /proc/%d/environ | tr '\0' '\n'
1448
1449 See the `Y' interactive command above and topic 6b. ADDING
1450 INSPECT Entries for additional information.
1451
1452 As an alternative to `Inspect', and available to all of these
1453 `Ctrl' commands, the tab key can be used to highlight individual
1454 elements in the bottom window.
1455
1456
1457 ^L :Logged-Messages (Ctrl key + `l')
1458 The 10 most recent messages are displayed in a separate window
1459 at the bottom of the screen while normal top monitoring
1460 continues. Keying `^L' a second time removes that window as
1461 does the `=' command. Use the tab key to highlight individual
1462 messages.
1463
1464
1465 * ^R :Renice-an-Autogroup (Ctrl key + `r')
1466 You will be prompted for a PID and then the value for its
1467 autogroup AGNI.
1468
1469 Entering no PID will be interpreted as the default shown in the
1470 prompt (the first task displayed).
1471
1472 A positive AGNI value will cause processes in that autogroup to
1473 lose priority. Conversely, a negative value causes them to be
1474 viewed more favorably by the kernel. Ordinary users are not
1475 allowed to set negative AGNI values.
1476
1477 If you wish to abort the renice process type <Esc>.
1478
1479
1480 * The commands shown with an asterisk (`*') are not available in
1481 Secure mode, nor will they be shown on the level-1 help screen.
1482
1483
1484 4b. SUMMARY AREA Commands
1485 The summary area interactive commands are always available in both
1486 full-screen mode and alternate-display mode. They affect the beginning
1487 lines of your display and will determine the position of messages and
1488 prompts.
1489
1490 These commands always impact just the `current' window/field group.
1491 See topic 5. ALTERNATE-DISPLAY Provisions and the `g' interactive
1492 command for insight into `current' windows and field groups.
1493
1494
1495 C :Show-scroll-coordinates toggle
1496 Toggle an informational message which is displayed whenever the
1497 message line is not otherwise being used. For additional
1498 information see topic 5c. SCROLLING a Window.
1499
1500
1501 l :Load-Average/Uptime toggle
1502 This is also the line containing the program name (possibly an
1503 alias) when operating in full-screen mode or the `current'
1504 window name when operating in alternate-display mode.
1505
1506
1507 t :Task/Cpu-States toggle
1508 This command affects from 2 to many summary area lines,
1509 depending on the state of the `1', `2' or `3' command toggles
1510 and whether or not top is running under true SMP.
1511
1512 This portion of the summary area is also influenced by the `H'
1513 interactive command toggle, as reflected in the total label
1514 which shows either Tasks or Threads.
1515
1516 This command serves as a 4-way toggle, cycling through these
1517 modes:
1518 1. detailed percentages by category
1519 2. abbreviated user/system and total % + bar graph
1520 3. abbreviated user/system and total % + block graph
1521 4. turn off task and cpu states display
1522
1523 When operating in either of the graphic modes, the display
1524 becomes much more meaningful when individual CPUs or NUMA nodes
1525 are also displayed. See the the `1', `2' and `3' commands below
1526 for additional information.
1527
1528
1529 m :Memory/Swap-Usage toggle
1530 This command affects the two summary area lines dealing with
1531 physical and virtual memory.
1532
1533 This command serves as a 4-way toggle, cycling through these
1534 modes:
1535 1. detailed percentages by memory type
1536 2. abbreviated % used/total available + bar graph
1537 3. abbreviated % used/total available + block graph
1538 4. turn off memory display
1539
1540
1541 1 :Single/Separate-Cpu-States toggle
1542 This command affects how the `t' command's Cpu States portion is
1543 shown. Although this toggle exists primarily to serve
1544 massively-parallel SMP machines, it is not restricted to solely
1545 SMP environments.
1546
1547 When you see `%Cpu(s):' in the summary area, the `1' toggle is
1548 On and all cpu information is gathered in a single line.
1549 Otherwise, each cpu is displayed separately as: `%Cpu0, %Cpu1,
1550 ...' up to available screen height.
1551
1552
1553 2 :NUMA-Nodes/Cpu-Summary toggle
1554 This command toggles between the `1' command cpu summary display
1555 (only) or a summary display plus the cpu usage statistics for
1556 each NUMA Node. It is only available if a system has the
1557 requisite NUMA support.
1558
1559
1560 3 :Expand-NUMA-Node
1561 You will be invited to enter a number representing a NUMA Node.
1562 Thereafter, a node summary plus the statistics for each cpu in
1563 that node will be shown until the `1', `2' or `4' command toggle
1564 is pressed. This interactive command is only available if a
1565 system has the requisite NUMA support.
1566
1567
1568 4 :Display-Multiple-Elements-Adjacent toggle
1569 This command toggle turns the `1' toggle Off and shows multiple
1570 CPU and Memory results on each line. Each successive `4' key
1571 adds another CPU until again reverting to separate lines for CPU
1572 and Memory results.
1573
1574 A maximum of 8 CPUs per line can be displayed in this manner.
1575 However, data truncation may occur before reaching the maximum.
1576 That is definitely true when displaying detailed statistics via
1577 the `t' command toggle since such data cannot be scaled like the
1578 graphic representations.
1579
1580 If one wished to quickly exit adjacent mode without cycling all
1581 the way to 8, simply use the `1' command toggle.
1582
1583
1584 5 :Display-P-Cores-and-E-Cores toggle
1585 This command toggle is only active when the `t' toggle is On and
1586 the `1', `2', `3' and `!' toggles are Off, thus showing
1587 individual CPU results. It assumes a platform has multiple
1588 cores of two distinct types, either multi-threaded (P-Core) or
1589 single-threaded (E-Core).
1590
1591 While normally each cpu is displayed as `%Cpu0, %Cpu1, ...',
1592 this toggle can be used to identify and/or filter those cpus by
1593 their core type, either P-Core (performance) or E-Core
1594 (efficient).
1595
1596 The 1st time `5' is struck, each CPU is displayed as `%CpP' or
1597 `%CpE' representing the two core types. The 2nd time, only P-
1598 Cores (%CpP) will be shown. The 3rd time, only E-Cores (%CpE)
1599 are displayed. When this command toggle is struck for the 4th
1600 time, the CPU display returns to the normal `%Cpu' convention.
1601
1602 If separate performance and efficient categories are not
1603 present, this command toggle will have no effect.
1604
1605
1606 ! :Combine-Cpus-Mode toggle
1607 This command toggle is intended for massively parallel SMP
1608 environments where, even with the `4' command toggle, not all
1609 processors can be displayed. With each press of `!' the number
1610 of additional cpus combined is doubled thus reducing the total
1611 number of cpu lines displayed.
1612
1613 For example, with the first press of `!' one additional cpu will
1614 be combined and displayed as `0-1, 2-3, ...' instead of the
1615 normal `%Cpu0, %Cpu1, %Cpu2, %Cpu3, ...'. With a second `!'
1616 command toggle two additional cpus are combined and shown as
1617 `0-2, 3-5, ...'. Then the third `!' press, combining four
1618 additional cpus, shows as `0-4, 5-9, ...', etc.
1619
1620 Such progression continues until individual cpus are again
1621 displayed and impacts both the `1' and `4' toggles (one or
1622 muliple columns). Use the `=' command to exit Combine Cpus
1623 mode.
1624
1625
1626 Note: If the entire summary area has been toggled Off for any window,
1627 you would be left with just the message line. In that way, you will
1628 have maximized available task rows but (temporarily) sacrificed the
1629 program name in full-screen mode or the `current' window name when in
1630 alternate-display mode.
1631
1632
1633 4c. TASK AREA Commands
1634 The task area interactive commands are always available in full-screen
1635 mode.
1636
1637 The task area interactive commands are never available in
1638 alternate-display mode if the `current' window's task display has been
1639 toggled Off (see topic 5. ALTERNATE-DISPLAY Provisions).
1640
1641
1642 APPEARANCE of task window
1643
1644
1645 J :Justify-Numeric-Columns toggle
1646 Alternates between right-justified (the default) and left-
1647 justified numeric data. If the numeric data completely fills
1648 the available column, this command toggle may impact the column
1649 header only.
1650
1651
1652 j :Justify-Character-Columns toggle
1653 Alternates between left-justified (the default) and right-
1654 justified character data. If the character data completely
1655 fills the available column, this command toggle may impact the
1656 column header only.
1657
1658
1659 The following commands will also be influenced by the state of the
1660 global `B' (bold enable) toggle.
1661
1662
1663 b :Bold/Reverse toggle
1664 This command will impact how the `x' and `y' toggles are
1665 displayed. It may also impact the summary area when a bar graph
1666 has been selected for cpu states or memory usage via the `t' or
1667 `m' toggles.
1668
1669
1670 x :Column-Highlight toggle
1671 Changes highlighting for the current sort field. If you forget
1672 which field is being sorted this command can serve as a quick
1673 visual reminder, providing the sort field is being displayed.
1674 The sort field might not be visible because:
1675 1) there is insufficient Screen Width
1676 2) the `f' interactive command turned it Off
1677
1678
1679 y :Row-Highlight toggle
1680 Changes highlighting for "running" tasks. For additional
1681 insight into this task state, see topic 3a. DESCRIPTIONS of
1682 Fields, the `S' field (Process Status).
1683
1684 Use of this provision provides important insight into your
1685 system's health. The only costs will be a few additional tty
1686 escape sequences.
1687
1688
1689 z :Color/Monochrome toggle
1690 Switches the `current' window between your last used color
1691 scheme and the older form of black-on-white or white-on-black.
1692 This command will alter both the summary area and task area but
1693 does not affect the state of the `x', `y' or `b' toggles.
1694
1695
1696 CONTENT of task window
1697
1698
1699 c :Command-Line/Program-Name toggle
1700 This command will be honored whether or not the COMMAND column
1701 is currently visible. Later, should that field come into view,
1702 the change you applied will be seen.
1703
1704
1705 F :Maintain-Parent-Focus toggle
1706 When in forest view mode, this key serves as a toggle to retain
1707 focus on a target task, presumably one with forked children. If
1708 forest view mode is Off this key has no effect.
1709
1710 The toggle is applied to the first (topmost) process in the
1711 `current' window. Once established, that task is always
1712 displayed as the first (topmost) process along with its forked
1713 children. All other processes will be suppressed.
1714
1715 Note: keys like `i' (idle tasks), `n' (max tasks), `v' (hide
1716 children) and User/Other filtering remain accessible and can
1717 impact what is displayed.
1718
1719
1720 f :Fields-Management
1721 This key displays a separate screen where you can change which
1722 fields are displayed, their order and also designate the sort
1723 field. For additional information on this interactive command
1724 see topic 3b. MANAGING Fields.
1725
1726
1727 O | o :Other-Filtering
1728 You will be prompted for the selection criteria which then
1729 determines which tasks will be shown in the `current' window.
1730 Your criteria can be made case sensitive or case can be ignored.
1731 And you determine if top should include or exclude matching
1732 tasks.
1733
1734 See topic 5e. FILTERING in a window for details on these and
1735 additional related interactive commands.
1736
1737
1738 S :Cumulative-Time-Mode toggle
1739 When Cumulative mode is On, each process is listed with the cpu
1740 time that it and its dead children have used.
1741
1742 When Off, programs that fork into many separate tasks will
1743 appear less demanding. For programs like `init' or a shell this
1744 is appropriate but for others, like compilers, perhaps not.
1745 Experiment with two task windows sharing the same sort field but
1746 with different `S' states and see which representation you
1747 prefer.
1748
1749 After issuing this command, you'll be informed of the new state
1750 of this toggle. If you wish to know in advance whether or not
1751 Cumulative mode is in effect, simply ask for help and view the
1752 window summary on the second line.
1753
1754
1755 U | u :Show-Specific-User-Only
1756 You will be prompted for the uid or name of the user to display.
1757 The -u option matches on effective user whereas the -U option
1758 matches on any user (real, effective, saved, or filesystem).
1759
1760 Thereafter, in that task window only matching users will be
1761 shown, or possibly no processes will be shown. Prepending an
1762 exclamation point (`!') to the user id or name instructs top to
1763 display only processes with users not matching the one provided.
1764
1765 Different task windows can be used to filter different users.
1766 Later, if you wish to monitor all users again in the `current'
1767 window, re-issue this command but just press <Enter> at the
1768 prompt.
1769
1770
1771 V :Forest-View-Mode toggle
1772 In this mode, processes are reordered according to their parents
1773 and the layout of the COMMAND column resembles that of a tree.
1774 In forest view mode it is still possible to toggle between
1775 program name and command line (see the `c' interactive command)
1776 or between processes and threads (see the `H' interactive
1777 command).
1778
1779 Note: Typing any key affecting the sort order will exit forest
1780 view mode in the `current' window. See topic 4c. TASK AREA
1781 Commands, SORTING for information on those keys.
1782
1783
1784 v :Hide/Show-Children toggle
1785 When in forest view mode, this key serves as a toggle to
1786 collapse or expand the children of a parent.
1787
1788 The toggle is applied against the first (topmost) process in the
1789 `current' window. See topic 5c. SCROLLING a Window for
1790 additional information regarding vertical scrolling.
1791
1792 If the target process has not forked any children, this key has
1793 no effect. It also has no effect when not in forest view mode.
1794
1795
1796 ^E :Scale-CPU-Time-fields (Ctrl key + `e')
1797 The `time' fields are normally displayed with the greatest
1798 precision their widths permit. This toggle reduces that
1799 precision until it wraps. It also illustrates the scaling those
1800 fields might experience automatically, which usually depends on
1801 how long the system runs.
1802
1803 For example, if `MMM:SS.hh' is shown, each ^E keystroke would
1804 change it to: `MM:SS', `Hours,MM', `Days+Hours' and finally
1805 `Weeks+Days'.
1806
1807 Not all time fields are subject to the full range of such
1808 scaling.
1809
1810
1811 SIZE of task window
1812
1813
1814 i :Idle-Process toggle
1815 Displays all tasks or just active tasks. When this toggle is
1816 Off, tasks that have not used any CPU since the last update will
1817 not be displayed. However, due to the granularity of the %CPU
1818 and TIME+ fields, some processes may still be displayed that
1819 appear to have used no CPU.
1820
1821 If this command is applied to the last task display when in
1822 alternate-display mode, then it will not affect the window's
1823 size, as all prior task displays will have already been painted.
1824
1825
1826 n | # :Set-Maximum-Tasks
1827 You will be prompted to enter the number of tasks to display.
1828 The lessor of your number and available screen rows will be
1829 used.
1830
1831 When used in alternate-display mode, this is the command that
1832 gives you precise control over the size of each currently
1833 visible task display, except for the very last. It will not
1834 affect the last window's size, as all prior task displays will
1835 have already been painted.
1836
1837 Note: If you wish to increase the size of the last visible task
1838 display when in alternate-display mode, simply decrease the size
1839 of the task display(s) above it.
1840
1841
1842 SORTING of task window
1843
1844 For compatibility, this top supports most of the former top sort
1845 keys. Since this is primarily a service to former top users, these
1846 commands do not appear on any help screen.
1847 command sorted-field supported
1848 A start time (non-display) No
1849 M %MEM Yes
1850 N PID Yes
1851 P %CPU Yes
1852 T TIME+ Yes
1853
1854 Before using any of the following sort provisions, top suggests that
1855 you temporarily turn on column highlighting using the `x'
1856 interactive command. That will help ensure that the actual sort
1857 environment matches your intent.
1858
1859 The following interactive commands will only be honored when the
1860 current sort field is visible. The sort field might not be visible
1861 because:
1862 1) there is insufficient Screen Width
1863 2) the `f' interactive command turned it Off
1864
1865
1866 < :Move-Sort-Field-Left
1867 Moves the sort column to the left unless the current sort
1868 field is the first field being displayed.
1869
1870
1871 > :Move-Sort-Field-Right
1872 Moves the sort column to the right unless the current sort
1873 field is the last field being displayed.
1874
1875
1876 The following interactive commands will always be honored whether or
1877 not the current sort field is visible.
1878
1879
1880 f :Fields-Management
1881 This key displays a separate screen where you can change
1882 which field is used as the sort column, among other
1883 functions. This can be a convenient way to simply verify the
1884 current sort field, when running top with column highlighting
1885 turned Off.
1886
1887
1888 R :Reverse/Normal-Sort-Field toggle
1889 Using this interactive command you can alternate between
1890 high-to-low and low-to-high sorts.
1891
1892
1893 4d. COLOR Mapping
1894 When you issue the `Z' interactive command, you will be presented with
1895 a separate screen. That screen can be used to change the colors in
1896 just the `current' window or in all four windows before returning to
1897 the top display.
1898
1899
1900 The following interactive commands are available.
1901 4 upper case letters to select a target
1902 8 numbers to select a color
1903 normal toggles available
1904 B :bold disable/enable
1905 b :running tasks "bold"/reverse
1906 z :color/mono
1907 other commands available
1908 a/w :apply, then go to next/prior
1909 <Enter> :apply and exit
1910 q :abandon current changes and exit
1911
1912 If you use `a' or `w' to cycle the targeted window, you will have
1913 applied the color scheme that was displayed when you left that window.
1914 You can, of course, easily return to any window and reapply different
1915 colors or turn colors Off completely with the `z' toggle.
1916
1917 The Color Mapping screen can also be used to change the `current'
1918 window/field group in either full-screen mode or alternate-display
1919 mode. Whatever was targeted when `q' or <Enter> was pressed will be
1920 made current as you return to the top display.
1921
1922
1924 5a. WINDOWS Overview
1925 Field Groups/Windows:
1926 In full-screen mode there is a single window represented by the
1927 entire screen. That single window can still be changed to display 1
1928 of 4 different field groups (see the `g' interactive command,
1929 repeated below). Each of the 4 field groups has a unique separately
1930 configurable summary area and its own configurable task area.
1931
1932 In alternate-display mode, those 4 underlying field groups can now
1933 be made visible simultaneously, or can be turned Off individually at
1934 your command.
1935
1936 The summary area will always exist, even if it's only the message
1937 line. At any given time only one summary area can be displayed.
1938 However, depending on your commands, there could be from zero to
1939 four separate task displays currently showing on the screen.
1940
1941
1942 Current Window:
1943 The `current' window is the window associated with the summary area
1944 and the window to which task related commands are always directed.
1945 Since in alternate-display mode you can toggle the task display Off,
1946 some commands might be restricted for the `current' window.
1947
1948 A further complication arises when you have toggled the first
1949 summary area line Off. With the loss of the window name (the `l'
1950 toggled line), you'll not easily know what window is the `current'
1951 window.
1952
1953
1954 5b. COMMANDS for Windows
1955 - | _ :Show/Hide-Window(s) toggles
1956 The `-' key turns the `current' window's task display On and
1957 Off. When On, that task area will show a minimum of the columns
1958 header you've established with the `f' interactive command. It
1959 will also reflect any other task area options/toggles you've
1960 applied yielding zero or more tasks.
1961
1962 The `_' key does the same for all task displays. In other
1963 words, it switches between the currently visible task display(s)
1964 and any task display(s) you had toggled Off. If all 4 task
1965 displays are currently visible, this interactive command will
1966 leave the summary area as the only display element.
1967
1968
1969 * = | + :Equalize/Reset-Window(s)
1970 The `=' key forces the `current' window's task display to be
1971 visible. It also reverses any active `i' (idle tasks), `n' (max
1972 tasks), `u/U' (user filter), `o/O' (other filter), `v' (hide
1973 children), `F' focused, `L' (locate) and `!' (combine cpus)
1974 commands. Also, if the window had been scrolled, it will be
1975 reset with this command. See topic 5c. SCROLLING a Window for
1976 additional information regarding vertical and horizontal
1977 scrolling.
1978
1979 The `+' key does the same for all windows. The four task
1980 displays will reappear, evenly balanced, while retaining any
1981 customizations previously applied beyond those noted for the `='
1982 command toggle.
1983
1984
1985 * A :Alternate-Display-Mode toggle
1986 This command will switch between full-screen mode and
1987 alternate-display mode.
1988
1989 The first time you issue this command, all four task displays
1990 will be shown. Thereafter when you switch modes, you will see
1991 only the task display(s) you've chosen to make visible.
1992
1993
1994 * a | w :Next-Window-Forward/Backward
1995 This will change the `current' window, which in turn changes the
1996 window to which commands are directed. These keys act in a
1997 circular fashion so you can reach any desired window using
1998 either key.
1999
2000 Assuming the window name is visible (you have not toggled `l'
2001 Off), whenever the `current' window name loses its
2002 emphasis/color, that's a reminder the task display is Off and
2003 many commands will be restricted.
2004
2005
2006 G :Change-Window/Field-Group-Name
2007 You will be prompted for a new name to be applied to the
2008 `current' window. It does not require that the window name be
2009 visible (the `l' toggle to be On).
2010
2011
2012 * The interactive commands shown with an asterisk (`*') have use
2013 beyond alternate-display mode.
2014 =, A, g are always available
2015 a, w act the same with color mapping
2016 and fields management
2017
2018
2019 * g :Choose-Another-Window/Field-Group
2020 You will be prompted to enter a number between 1 and 4
2021 designating the field group which should be made the `current'
2022 window.
2023
2024 In full-screen mode, this command is necessary to alter the
2025 `current' window. In alternate-display mode, it is simply a
2026 less convenient alternative to the `a' and `w' commands.
2027
2028
2029 5c. SCROLLING a Window
2030 Typically a task window is a partial view into a system's total
2031 tasks/threads which shows only some of the available fields/columns.
2032 With these scrolling keys, you can move that view vertically or
2033 horizontally to reveal any desired task or column.
2034
2035
2036 Up,PgUp :Scroll-Tasks
2037 Move the view up toward the first task row, until the first task is
2038 displayed at the top of the `current' window. The Up arrow key
2039 moves a single line while PgUp scrolls the entire window.
2040
2041
2042 Down,PgDn :Scroll-Tasks
2043 Move the view down toward the last task row, until the last task is
2044 the only task displayed at the top of the `current' window. The
2045 Down arrow key moves a single line while PgDn scrolls the entire
2046 window.
2047
2048
2049 Left,Right :Scroll-Columns
2050 Move the view of displayable fields horizontally one column at a
2051 time.
2052
2053 Note: As a reminder, some fields/columns are not fixed-width but
2054 allocated all remaining screen width when visible. When scrolling
2055 right or left, that feature may produce some unexpected results
2056 initially.
2057
2058 Additionally, there are special provisions for any variable width
2059 field when positioned as the last displayed field. Once that field
2060 is reached via the right arrow key, and is thus the only column
2061 shown, you can continue scrolling horizontally within such a field.
2062 See the `C' interactive command below for additional information.
2063
2064
2065 Home :Jump-to-Home-Position
2066 Reposition the display to the un-scrolled coordinates.
2067
2068
2069 End :Jump-to-End-Position
2070 Reposition the display so that the rightmost column reflects the
2071 last displayable field and the bottom task row represents the last
2072 task.
2073
2074 Note: From this position it is still possible to scroll down and
2075 right using the arrow keys. This is true until a single column and
2076 a single task is left as the only display element.
2077
2078
2079 C :Show-scroll-coordinates toggle
2080 Toggle an informational message which is displayed whenever the
2081 message line is not otherwise being used. That message will take
2082 one of two forms depending on whether or not a variable width
2083 column has also been scrolled.
2084
2085 scroll coordinates: y = n/n (tasks), x = n/n (fields)
2086 scroll coordinates: y = n/n (tasks), x = n/n (fields) + nn
2087
2088 The coordinates shown as n/n are relative to the upper left corner
2089 of the `current' window. The additional `+ nn' represents the
2090 displacement into a variable width column when it has been scrolled
2091 horizontally. Such displacement occurs in normal 8 character tab
2092 stop amounts via the right and left arrow keys.
2093
2094
2095 y = n/n (tasks)
2096 The first n represents the topmost visible task and is
2097 controlled by scrolling keys. The second n is updated
2098 automatically to reflect total tasks.
2099
2100
2101 x = n/n (fields)
2102 The first n represents the leftmost displayed column and is
2103 controlled by scrolling keys. The second n is the total number
2104 of displayable fields and is established with the `f'
2105 interactive command.
2106
2107
2108 The above interactive commands are always available in full-screen mode
2109 but never available in alternate-display mode if the `current' window's
2110 task display has been toggled Off.
2111
2112 Note: When any form of filtering is active, you can expect some slight
2113 aberrations when scrolling since not all tasks will be visible. This
2114 is particularly apparent when using the Up/Down arrow keys.
2115
2116
2117 5d. SEARCHING in a Window
2118 You can use these interactive commands to locate a task row containing
2119 a particular value.
2120
2121
2122 L :Locate-a-string
2123 You will be prompted for the case-sensitive string to locate
2124 starting from the current window coordinates. There are no
2125 restrictions on search string content.
2126
2127 Searches are not limited to values from a single field or column.
2128 All of the values displayed in a task row are allowed in a search
2129 string. You may include spaces, numbers, symbols and even forest
2130 view artwork.
2131
2132 Keying <Enter> with no input will effectively disable the `&' key
2133 until a new search string is entered.
2134
2135
2136 & :Locate-next
2137 Assuming a search string has been established, top will attempt to
2138 locate the next occurrence.
2139
2140
2141 When a match is found, the current window is repositioned vertically so
2142 the task row containing that string is first. The scroll coordinates
2143 message can provide confirmation of such vertical repositioning (see
2144 the `C' interactive command). Horizontal scrolling, however, is never
2145 altered via searching.
2146
2147 The availability of a matching string will be influenced by the
2148 following factors.
2149
2150 a. Which fields are displayable from the total available,
2151 see topic 3b. MANAGING Fields.
2152
2153 b. Scrolling a window vertically and/or horizontally,
2154 see topic 5c. SCROLLING a Window.
2155
2156 c. The state of the command/command-line toggle,
2157 see the `c' interactive command.
2158
2159 d. The stability of the chosen sort column,
2160 for example PID is good but %CPU bad.
2161
2162
2163 If a search fails, restoring the `current' window home (unscrolled)
2164 position, scrolling horizontally, displaying command-lines or choosing
2165 a more stable sort field could yet produce a successful `&' search.
2166
2167 The above interactive commands are always available in full-screen mode
2168 but never available in alternate-display mode if the `current' window's
2169 task display has been toggled Off.
2170
2171
2172 5e. FILTERING in a Window
2173 You can use this `Other Filter' feature to establish selection criteria
2174 which will then determine which tasks are shown in the `current'
2175 window. Such filters can be made persistent if preserved in the rcfile
2176 via the `W' interactive command.
2177
2178 Establishing a filter requires: 1) a field name; 2) an operator; and 3)
2179 a selection value, as a minimum. This is the most complex of top's
2180 user input requirements so, when you make a mistake, command recall
2181 will be your friend. Remember the Up/Down arrow keys or their aliases
2182 when prompted for input.
2183
2184 Filter Basics
2185
2186 1. field names are case sensitive and spelled as in the header
2187
2188 2. selection values need not comprise the full displayed field
2189
2190 3. a selection is either case insensitive or sensitive to case
2191
2192 4. the default is inclusion, prepending `!' denotes exclusions
2193
2194 5. multiple selection criteria can be applied to a task window
2195
2196 6. inclusion and exclusion criteria can be used simultaneously
2197
2198 7. the 1 equality and 2 relational filters can be freely mixed
2199
2200 8. separate unique filters are maintained for each task window
2201
2202
2203 If a field is not turned on or is not currently in view, then your
2204 selection criteria will not affect the display. Later, should a
2205 filtered field become visible, the selection criteria will then be
2206 applied.
2207
2208 Keyboard Summary
2209
2210 O :Other-Filter (upper case)
2211 You will be prompted to establish a case sensitive filter.
2212
2213
2214 o :Other-Filter (lower case)
2215 You will be prompted to establish a filter that ignores case when
2216 matching.
2217
2218
2219 ^O :Show-Active-Filters (Ctrl key + `o')
2220 This can serve as a reminder of which filters are active in the
2221 `current' window. A summary will be shown on the message line
2222 until you press the <Enter> key.
2223
2224
2225 = :Reset-Filtering in current window
2226 This clears all of your selection criteria in the `current'
2227 window. It also has additional impact so please see topic 4a.
2228 GLOBAL Commands.
2229
2230
2231 + :Reset-Filtering in all windows
2232 This clears the selection criteria in all windows, assuming you
2233 are in alternate-display mode. As with the `=' interactive
2234 command, it too has additional consequences so you might wish to
2235 see topic 5b. COMMANDS for Windows.
2236
2237
2238 Input Requirements
2239
2240 When prompted for selection criteria, the data you provide must take
2241 one of two forms. There are 3 required pieces of information, with
2242 a 4th as optional. These examples use spaces for clarity but your
2243 input generally would not.
2244 #1 #2 #3 ( required )
2245 Field-Name ? include-if-value
2246 ! Field-Name ? exclude-if-value
2247 #4 ( optional )
2248
2249 Items #1, #3 and #4 should be self-explanatory. Item #2 represents
2250 both a required delimiter and the operator which must be one of
2251 either equality (`=') or relation (`<' or `>').
2252
2253 The `=' equality operator requires only a partial match and that can
2254 reduce your `if-value' input requirements. The `>' or `<'
2255 relational operators always employ string comparisons, even with
2256 numeric fields. They are designed to work with a field's default
2257 justification and with homogeneous data. When some field's numeric
2258 amounts have been subjected to scaling while others have not, that
2259 data is no longer homogeneous.
2260
2261 If you establish a relational filter and you have changed the
2262 default Numeric or Character justification, that filter is likely to
2263 fail. When a relational filter is applied to a memory field and you
2264 have not changed the scaling, it may produce misleading results.
2265 This happens, for example, because `100.0m' (MiB) would appear
2266 greater than `1.000g' (GiB) when compared as strings.
2267
2268 If your filtered results appear suspect, simply altering
2269 justification or scaling may yet achieve the desired objective. See
2270 the `j', `J' and `e' interactive commands for additional
2271 information.
2272
2273 Potential Problems
2274
2275 These GROUP filters could produce the exact same results or the
2276 second one might not display anything at all, just a blank task
2277 window.
2278 GROUP=root ( only the same results when )
2279 GROUP=ROOT ( invoked via lower case `o' )
2280
2281 Either of these RES filters might yield inconsistent and/or
2282 misleading results, depending on the current memory scaling factor.
2283 Or both filters could produce the exact same results.
2284 RES>9999 ( only the same results when )
2285 !RES<10000 ( memory scaling is at `KiB' )
2286
2287 This nMin filter illustrates a problem unique to scalable fields.
2288 This particular field can display a maximum of 4 digits, beyond
2289 which values are automatically scaled to KiB or above. So while
2290 amounts greater than 9999 exist, they will appear as 2.6m, 197k,
2291 etc.
2292 nMin>9999 ( always a blank task window )
2293
2294 Potential Solutions
2295
2296 These examples illustrate how Other Filtering can be creatively
2297 applied to achieve almost any desired result. Single quotes are
2298 sometimes shown to delimit the spaces which are part of a filter or
2299 to represent a request for status (^O) accurately. But if you used
2300 them with if-values in real life, no matches would be found.
2301
2302 Assuming field nTH is displayed, the first filter will result in
2303 only multi-threaded processes being shown. It also reminds us that
2304 a trailing space is part of every displayed field. The second
2305 filter achieves the exact same results with less typing.
2306 !nTH=` 1 ' ( ` for clarity only )
2307 nTH>1 ( same with less i/p )
2308
2309 With Forest View mode active and the COMMAND column in view, this
2310 filter effectively collapses child processes so that just 3 levels
2311 are shown.
2312 !COMMAND=` `- ' ( ` for clarity only )
2313
2314 The final two filters appear as in response to the status request
2315 key (^O). In reality, each filter would have required separate
2316 input. The PR example shows the two concurrent filters necessary to
2317 display tasks with priorities of 20 or more, since some might be
2318 negative. Then by exploiting trailing spaces, the nMin series of
2319 filters could achieve the failed `9999' objective discussed above.
2320 `PR>20' + `!PR=-' ( 2 for right result )
2321 `!nMin=0 ' + `!nMin=1 ' + `!nMin=2 ' + `!nMin=3 ' ...
2322
2323
2325 6a. PERSONAL Configuration File
2326 This file is created or updated via the `W' interactive command.
2327
2328 The legacy version is written as `$HOME/.your-name-4-top' + `rc' with a
2329 leading period.
2330
2331 A newly created configuration file is written as
2332 procps/your-name-4-top' + `rc' without a leading period. The procps
2333 directory will be subordinate to either $XDG_CONFIG_HOME when set as an
2334 absolute path or the $HOME/.config directory.
2335
2336 While not intended to be edited manually, here is the general layout:
2337 global # line 1: the program name/alias notation
2338 " # line 2: id,altscr,irixps,delay,curwin
2339 per ea # line a: winname,fieldscur
2340 window # line b: winflags,sortindx,maxtasks,etc
2341 " # line c: summclr,msgsclr,headclr,taskclr
2342 global # line 15: additional miscellaneous settings
2343 " # any remaining lines are devoted to optional
2344 " # active `other filters' discussed in section 5e above
2345 " # plus `inspect' entries discussed in section 6b below
2346
2347 If a valid absolute path to the rcfile cannot be established,
2348 customizations made to a running top will be impossible to preserve.
2349
2350
2351 6b. ADDING INSPECT Entries
2352 To exploit the `Y' interactive command, you must add entries at the end
2353 of the top personal configuration file. Such entries simply reflect a
2354 file to be read or command/pipeline to be executed whose results will
2355 then be displayed in a separate scrollable, searchable window.
2356
2357 If you don't know the location or name of your top rcfile, use the `W'
2358 interactive command to rewrite it and note those details.
2359
2360 Inspect entries can be added with a redirected echo or by editing the
2361 configuration file. Redirecting an echo risks overwriting the rcfile
2362 should it replace (>) rather than append (>>) to that file.
2363 Conversely, when using an editor care must be taken not to corrupt
2364 existing lines, some of which could contain unprintable data or unusual
2365 characters depending on the top version under which that configuration
2366 file was saved.
2367
2368 Those Inspect entries beginning with a `#' character are ignored,
2369 regardless of content. Otherwise they consist of the following 3
2370 elements, each of which must be separated by a tab character (thus 2
2371 `\t' total):
2372
2373 .type: literal `file' or `pipe'
2374 .name: selection shown on the Inspect screen
2375 .fmts: string representing a path or command
2376
2377 The two types of Inspect entries are not interchangeable. Those
2378 designated `file' will be accessed using fopen and must reference a
2379 single file in the `.fmts' element. Entries specifying `pipe' will
2380 employ popen, their `.fmts' element could contain many pipelined
2381 commands and, none can be interactive.
2382
2383 If the file or pipeline represented in your `.fmts' deals with the
2384 specific PID input or accepted when prompted, then the format string
2385 must also contain the `%d' specifier, as these examples illustrate.
2386
2387 .fmts= /proc/%d/numa_maps
2388 .fmts= lsof -P -p %d
2389
2390 For `pipe' type entries only, you may also wish to redirect stderr to
2391 stdout for a more comprehensive result. Thus the format string
2392 becomes:
2393
2394 .fmts= pmap -x %d 2>&1
2395
2396 Here are examples of both types of Inspect entries as they might appear
2397 in the rcfile. The first entry will be ignored due to the initial `#'
2398 character. For clarity, the pseudo tab depictions (^I) are surrounded
2399 by an extra space but the actual tabs would not be.
2400
2401 # pipe ^I Sockets ^I lsof -n -P -i 2>&1
2402 pipe ^I Open Files ^I lsof -P -p %d 2>&1
2403 file ^I NUMA Info ^I /proc/%d/numa_maps
2404 pipe ^I Log ^I tail -n100 /var/log/syslog | sort -Mr
2405
2406 Except for the commented entry above, these next examples show what
2407 could be echoed to achieve similar results, assuming the rcfile name
2408 was `.toprc'. However, due to the embedded tab characters, each of
2409 these lines should be preceded by `/bin/echo -e', not just a simple an
2410 `echo', to enable backslash interpretation regardless of which shell
2411 you use.
2412
2413 "pipe\tOpen Files\tlsof -P -p %d 2>&1" >> ~/.toprc
2414 "file\tNUMA Info\t/proc/%d/numa_maps" >> ~/.toprc
2415 "pipe\tLog\ttail -n200 /var/log/syslog | sort -Mr" >> ~/.toprc
2416
2417 If any inspect entry you create produces output with unprintable
2418 characters they will be displayed in either the ^C notation or
2419 hexadecimal <FF> form, depending on their value. This applies to tab
2420 characters as well, which will show as `^I'. If you want a truer
2421 representation, any embedded tabs should be expanded. The following
2422 example takes what could have been a `file' entry but employs a `pipe'
2423 instead so as to expand the embedded tabs.
2424
2425 # next would have contained `\t' ...
2426 # file ^I <your_name> ^I /proc/%d/status
2427 # but this will eliminate embedded `\t' ...
2428 pipe ^I <your_name> ^I cat /proc/%d/status | expand -
2429
2430 Note: Some programs might rely on SIGINT to end. Therefore, if a
2431 `pipe' such as the following is established, one must use Ctrl-C to
2432 terminate it in order to review the results. This is the single
2433 occasion where a `^C' will not also terminate top.
2434
2435 pipe ^I Trace ^I /usr/bin/strace -p %d 2>&1
2436
2437 Lastly, while `pipe' type entries have been discussed in terms of
2438 pipelines and commands, there is nothing to prevent you from including
2439 shell scripts as well. Perhaps even newly created scripts designed
2440 specifically for the `Y' interactive command.
2441
2442 For example, as the number of your Inspect entries grows over time, the
2443 `Options:' row will be truncated when screen width is exceeded. That
2444 does not affect operation other than to make some selections invisible.
2445 However, if some choices are lost to truncation but you want to see
2446 more options, there is an easy solution hinted at below.
2447
2448 Inspection Pause at pid ...
2449 Use: left/right then <Enter> ...
2450 Options: help 1 2 3 4 5 6 7 8 9 10 11 ...
2451
2452 The entries in the top rcfile would have a number for the `.name'
2453 element and the `help' entry would identify a shell script you've
2454 written explaining what those numbered selections actually mean. In
2455 that way, many more choices can be made visible.
2456
2457
2458 6c. SYSTEM Configuration File
2459 This configuration file represents defaults for users who have not
2460 saved their own configuration file. The format mirrors exactly the
2461 personal configuration file and can also include `inspect' entries as
2462 explained above.
2463
2464 Creating it is a simple process.
2465
2466 1. Configure top appropriately for your installation and preserve that
2467 configuration with the `W' interactive command.
2468
2469 2. Add and test any desired `inspect' entries.
2470
2471 3. Copy that configuration file to the /etc/ directory as
2472 `topdefaultrc'.
2473
2474
2475 6d. SYSTEM Restrictions File
2476 The presence of this file will influence which version of the help
2477 screen is shown to an ordinary user.
2478
2479 More importantly, it will limit what ordinary users are allowed to do
2480 when top is running. They will not be able to issue the following
2481 commands.
2482 k Kill a task
2483 r Renice a task
2484 d or s Change delay/sleep interval
2485
2486 This configuration file is not created by top. Rather, it is created
2487 manually and placed it in the /etc/ directory as `toprc'.
2488
2489 It should have exactly two lines, as shown in this example:
2490 s # line 1: secure mode switch
2491 5.0 # line 2: delay interval in seconds
2492
2493
2495 The value set for the following is unimportant, just its presence.
2496
2497
2498 LIBPROC_HIDE_KERNEL
2499 This will prevent display of any kernel threads and exclude such
2500 processes from the summary area Tasks/Threads counts.
2501
2502
2504 Many of these tricks work best when you give top a scheduling boost.
2505 So plan on starting him with a nice value of -10, assuming you've got
2506 the authority.
2507
2508
2509 7a. Kernel Magic
2510 For these stupid tricks, top needs full-screen mode.
2511
2512
2513 • The user interface, through prompts and help, intentionally implies
2514 that the delay interval is limited to tenths of a second. However,
2515 you're free to set any desired delay. If you want to see Linux at
2516 his scheduling best, try a delay of .09 seconds or less.
2517
2518 For this experiment, under x-windows open an xterm and maximize it.
2519 Then do the following:
2520 . provide a scheduling boost and tiny delay via:
2521 nice -n -10 top -d.09
2522 . keep sorted column highlighting Off so as to
2523 minimize path length
2524 . turn On reverse row highlighting for emphasis
2525 . try various sort columns (TIME/MEM work well),
2526 and normal or reverse sorts to bring the most
2527 active processes into view
2528
2529 What you'll see is a very busy Linux doing what he's always done for
2530 you, but there was no program available to illustrate this.
2531
2532
2533 • Under an xterm using `white-on-black' colors, on top's Color Mapping
2534 screen set the task color to black and be sure that task
2535 highlighting is set to bold, not reverse. Then set the delay
2536 interval to around .3 seconds.
2537
2538 After bringing the most active processes into view, what you'll see
2539 are the ghostly images of just the currently running tasks.
2540
2541
2542 • Delete the existing rcfile, or create a new symlink. Start this new
2543 version then type `T' (a secret key, see topic 4c. Task Area
2544 Commands, SORTING) followed by `W' and `q'. Finally, restart the
2545 program with -d0 (zero delay).
2546
2547 Your display will be refreshed at three times the rate of the former
2548 top, a 300% speed advantage. As top climbs the TIME ladder, be as
2549 patient as you can while speculating on whether or not top will ever
2550 reach the top.
2551
2552
2553 7b. Bouncing Windows
2554 For these stupid tricks, top needs alternate-display mode.
2555
2556
2557 • With 3 or 4 task displays visible, pick any window other than the
2558 last and turn idle processes Off using the `i' command toggle.
2559 Depending on where you applied `i', sometimes several task displays
2560 are bouncing and sometimes it's like an accordion, as top tries his
2561 best to allocate space.
2562
2563
2564 • Set each window's summary lines differently: one with no memory
2565 (`m'); another with no states (`t'); maybe one with nothing at all,
2566 just the message line. Then hold down `a' or `w' and watch a
2567 variation on bouncing windows -- hopping windows.
2568
2569
2570 • Display all 4 windows and for each, in turn, set idle processes to
2571 Off using the `i' command toggle. You've just entered the "extreme
2572 bounce" zone.
2573
2574
2575 7c. The Big Bird Window
2576 This stupid trick also requires alternate-display mode.
2577
2578
2579 • Display all 4 windows and make sure that 1:Def is the `current'
2580 window. Then, keep increasing window size with the `n' interactive
2581 command until all the other task displays are "pushed out of the
2582 nest".
2583
2584 When they've all been displaced, toggle between all
2585 visible/invisible windows using the `_' command toggle. Then ponder
2586 this:
2587 is top fibbing or telling honestly your imposed truth?
2588
2589
2590 7d. The Ol' Switcheroo
2591 This stupid trick works best without alternate-display mode, since
2592 justification is active on a per window basis.
2593
2594
2595 • Start top and make COMMAND the last (rightmost) column displayed.
2596 If necessary, use the `c' command toggle to display command lines
2597 and ensure that forest view mode is active with the `V' command
2598 toggle.
2599
2600 Then use the up/down arrow keys to position the display so that some
2601 truncated command lines are shown (`+' in last position). You may
2602 have to resize your xterm to produce truncation.
2603
2604 Lastly, use the `j' command toggle to make the COMMAND column right
2605 justified.
2606
2607 Now use the right arrow key to reach the COMMAND column. Continuing
2608 with the right arrow key, watch closely the direction of travel for
2609 the command lines being shown.
2610
2611 some lines travel left, while others travel right
2612
2613 eventually all lines will Switcheroo, and move right
2614
2615
2617 Please send bug reports to ⟨procps@freelists.org⟩.
2618
2619
2620
2622 free(1), ps(1), uptime(1), atop(1), slabtop(1), vmstat(8), w(1)
2623
2624
2625
2626procps-ng January 2023 TOP(1)