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