· 9 years ago · Jul 04, 2017, 06:24 PM
1TOP(1) Linux User's Manual TOP(1)
2
3
4
5NAME
6 top - display Linux tasks
7
8
9
10SYNOPSIS
11 top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
12
13 The traditional switches '-' and whitespace are optional.
14
15
16
17DESCRIPTION
18 The top program provides a dynamic real-time view of a running
19 system. It can display system summary information as well as a
20 list of tasks currently being managed by the Linux kernel. The
21 types of system summary information shown and the types, order and
22 size of information displayed for tasks are all user configurable
23 and that configuration can be made persistent 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
34
35OVERVIEW
36 Documentation
37 The remaining Table of Contents
38 1. COMMAND-LINE Options
39 2. FIELDS / Columns
40 a. DESCRIPTIONS of Fields
41 b. SELECTING and ORDERING Columns
42 3. INTERACTIVE Commands
43 a. GLOBAL Commands
44 b. SUMMARY Area Commands
45 c. TASK Area Commands
46 d. COLOR Mapping
47 4. ALTERNATE-DISPLAY Mode
48 a. WINDOWS Overview
49 b. COMMANDS for Windows
50 5. FILES
51 a. SYSTEM Configuration File
52 b. PERSONAL Configuration File
53 6. STUPID TRICKS Sampler
54 a. Kernel Magic
55 b. Bouncing Windows
56 c. The Big Bird Window
57 7. BUGS, 8. HISTORY Former top, 9. AUTHOR, 10. SEE ALSO
58
59
60 Operation
61 When operating top, the two most important keys are help ('h' or
62 '?') and quit ('q') key. Alternatively, you could simply use the
63 traditional interrupt key ('^C') when you're done.
64
65 When you start top for the first time, you'll be presented with
66 the traditional screen elements: 1) Summary Area; 2) Mesâ€
67 sage/Prompt Line; 3) Columns Header; 4) Task Area. There will,
68 however, be some differences when compared to the former top.
69
70
71 Highlighting
72 Summary_Area: There is no highlighting for load/uptime and only
73 values are highlighted for other elements.
74
75 Task_Area: Tasks running (or ready to run) will be highlighted,
76 and bold is only one way of emphasizing such processes.
77
78
79 Content/Labels
80 Summary_Area: The program name is shown, perhaps a symlink or
81 alias. The Cpu(s) state label hints at other possibilities.
82 The memory stats use a lower case 'k'.
83
84 Columns_Header: Will show a new field and some changed labels.
85 More new fields will be found as you customize your top.
86
87
88 Note: the width of top's display will be limited to 512 positions.
89 Displaying all fields requires a minimum of 160 characters. The
90 remaining width could be used for the 'Command' column.
91
92
93 Startup Defaults
94 The following startup defaults assume no configuration file, thus
95 no user customizations. Even so, items shown with an asterisk
96 ('*') could be overridden through the command-line.
97
98 Global_defaults
99 'A' - Alt display Off (full-screen)
100 * 'd' - Delay time 3.0 seconds
101 'I' - Irix mode On (no, 'solaris' smp)
102 * 'p' - PID monitoring Off
103 * 's' - Secure mode Off (unsecured)
104 'B' - Bold enable Off
105 Summary_Area_defaults
106 'l' - Load Avg/Uptime On (thus program name)
107 't' - Task/Cpu states On (1+1 lines, see '1')
108 'm' - Mem/Swap usage On (2 lines worth)
109 '1' - Single Cpu On (thus 1 line if smp)
110 Task_Area_defaults
111 'b' - Bold hilite On (not 'reverse')
112 * 'c' - Command line Off (name, not cmdline)
113 * 'H' - Threads Off (show all threads)
114 * 'i' - Idle tasks On (show all tasks)
115 'R' - Reverse sort On (pids high-to-low)
116 * 'S' - Cumulative time Off (no, dead children)
117 'x' - Column hilite Off (no, sort field)
118 'y' - Row hilite On (yes, running tasks)
119 'z' - color/mono Off (no, colors)
120
121
122
1231. COMMAND-LINE Options
124 The command-line syntax for top consists of:
125
126 -hv | -bcHisS -d delay -n iterations -p pid [,pid...]
127
128 The typically mandatory switches ('-') and even whitespace are
129 completely optional.
130
131
132 -b : Batch mode operation
133 Starts top in 'Batch mode', which could be useful for sending
134 output from top to other programs or to a file. In this
135 mode, top will not accept input and runs until the iterations
136 limit you've set with the '-n' command-line option or until
137 killed.
138
139
140 -c : Command line/Program name toggle
141 Starts top with the last remembered 'c' state reversed.
142 Thus, if top was displaying command lines, now that field
143 will show program names, and visa versa. See the 'c' interâ€
144 active command for additional information.
145
146
147 -d : Delay time interval as: -d ss.tt (seconds.tenths)
148 Specifies the delay between screen updates, and overrides the
149 corresponding value in one's personal configuration file or
150 the startup default. Later this can be changed with the 'd'
151 or 's' interactive commands.
152
153 Fractional seconds are honored, but a negative number is not
154 allowed. In all cases, however, such changes are prohibited
155 if top is running in 'Secure mode', except for root (unless
156 the 's' command-line option was used). For additional inforâ€
157 mation on 'Secure mode' see topic 5a. SYSTEM Configuration
158 File.
159
160
161
162 -h : Help
163 Show library version and the usage prompt, then quit.
164
165
166 -H : Threads toggle
167 Starts top with the last remembered 'H' state reversed. When
168 this toggle is On, all individual threads will be displayed.
169 Otherwise, top displays a summation of all threads in a
170 process.
171
172
173 -i : Idle Processes toggle
174 Starts top with the last remembered 'i' state reversed. When
175 this toggle is Off, tasks that are idled or zombied will not
176 be displayed.
177
178
179 -n : Number of iterations limit as: -n number
180 Specifies the maximum number of iterations, or frames, top
181 should produce before ending.
182
183
184 -u : Monitor by user as: -u somebody
185 Monitor only processes with an effective UID or user name
186 matching that given.
187
188
189 -U : Monitor by user as: -U somebody
190 Monitor only processes with a UID or user name matching that
191 given. This matches real, effective, saved, and filesystem
192 UIDs.
193
194
195 -p : Monitor PIDs as: -pN1 -pN2 ... or -pN1, N2 [,...]
196 Monitor only processes with specified process IDs. This
197 option can be given up to 20 times, or you can provide a
198 comma delimited list with up to 20 pids. Co-mingling both
199 approaches is permitted.
200
201 This is a command-line option only. And should you wish to
202 return to normal operation, it is not necessary to quit and
203 and restart top -- just issue the '=' interactive command.
204
205
206 -s : Secure mode operation
207 Starts top with secure mode forced, even for root. This mode
208 is far better controlled through the system configuration
209 file (see topic 5. FILES).
210
211
212 -S : Cumulative time mode toggle
213 Starts top with the last remembered 'S' state reversed. When
214 'Cumulative mode' is On, each process is listed with the cpu
215 time that it and its dead children have used. See the 'S'
216 interactive command for additional information regarding this
217 mode.
218
219
220 -v : Version
221 Show library version and the usage prompt, then quit.
222
223
224
2252. FIELDS / Columns
226 2a. DESCRIPTIONS of Fields
227 Listed below are top's available fields. They are always associâ€
228 ated with the letter shown, regardless of the position you may
229 have established for them with the 'o' (Order fields) interactive
230 command.
231
232 Any field is selectable as the sort field, and you control whether
233 they are sorted high-to-low or low-to-high. For additional inforâ€
234 mation on sort provisions see topic 3c. TASK Area Commands.
235
236
237 a: PID -- Process Id
238 The task's unique process ID, which periodically wraps, though
239 never restarting at zero.
240
241
242 b: PPID -- Parent Process Pid
243 The process ID of a task's parent.
244
245
246 c: RUSER -- Real User Name
247 The real user name of the task's owner.
248
249
250 d: UID -- User Id
251 The effective user ID of the task's owner.
252
253
254 e: USER -- User Name
255 The effective user name of the task's owner.
256
257
258 f: GROUP -- Group Name
259 The effective group name of the task's owner.
260
261
262 g: TTY -- Controlling Tty
263 The name of the controlling terminal. This is usually the
264 device (serial port, pty, etc.) from which the process was
265 started, and which it uses for input or output. However, a
266 task need not be associated with a terminal, in which case
267 you'll see '?' displayed.
268
269
270 h: PR -- Priority
271 The priority of the task.
272
273
274 i: NI -- Nice value
275 The nice value of the task. A negative nice value means higher
276 priority, whereas a positive nice value means lower priority.
277 Zero in this field simply means priority will not be adjusted
278 in determining a task's dispatchability.
279
280
281 j: P -- Last used CPU (SMP)
282 A number representing the last used processor. In a true SMP
283 environment this will likely change frequently since the kernel
284 intentionally uses weak affinity. Also, the very act of runâ€
285 ning top may break this weak affinity and cause more processes
286 to change CPUs more often (because of the extra demand for cpu
287 time).
288
289
290 k: %CPU -- CPU usage
291 The task's share of the elapsed CPU time since the last screen
292 update, expressed as a percentage of total CPU time. In a true
293 SMP environment, if 'Irix mode' is Off, top will operate in
294 'Solaris mode' where a task's cpu usage will be divided by the
295 total number of CPUs. You toggle 'Irix/Solaris' modes with the
296 'I' interactive command.
297
298
299 l: TIME -- CPU Time
300 Total CPU time the task has used since it started. When 'Cumuâ€
301 lative mode' is On, each process is listed with the cpu time
302 that it and its dead children has used. You toggle 'Cumulative
303 mode' with 'S', which is a command-line option and an interacâ€
304 tive command. See the 'S' interactive command for additional
305 information regarding this mode.
306
307
308 m: TIME+ -- CPU Time, hundredths
309 The same as 'TIME', but reflecting more granularity through
310 hundredths of a second.
311
312
313 n: %MEM -- Memory usage (RES)
314 A task's currently used share of available physical memory.
315
316
317 o: VIRT -- Virtual Image (kb)
318 The total amount of virtual memory used by the task. It
319 includes all code, data and shared libraries plus pages that
320 have been swapped out.
321
322 VIRT = SWAP + RES.
323
324
325 p: SWAP -- Swapped size (kb)
326 The swapped out portion of a task's total virtual memory image.
327
328
329 q: RES -- Resident size (kb)
330 The non-swapped physical memory a task has used.
331
332
333 r: CODE -- Code size (kb)
334 The amount of virtual memory devoted to executable code, also
335 known as the 'text resident set' size or TRS.
336
337
338 s: DATA -- Data+Stack size (kb)
339 The amount of virtual memory devoted to other than executable
340 code, also known as the 'data resident set' size or DRS.
341
342
343 t: SHR -- Shared Mem size (kb)
344 The amount of shared memory used by a task. It simply reflects
345 memory that could be potentially shared with other processes.
346
347
348 u: nFLT -- Page Fault count
349 The number of major page faults that have occurred for a task.
350 A page fault occurs when a process attempts to read from or
351 write to a virtual page that is not currently present in its
352 address space. A major page fault is when backing storage
353 access (such as a disk) is involved in making that page availâ€
354 able.
355
356
357 v: nDRT -- Dirty Pages count
358 The number of pages that have been modified since they were
359 last written to disk. Dirty pages must be written to disk
360 before the corresponding physical memory location can be used
361 for some other virtual page.
362
363
364 w: S -- Process Status
365 The status of the task which can be one of:
366 'D' = uninterruptible sleep
367 'R' = running
368 'S' = sleeping
369 'T' = traced or stopped
370 'Z' = zombie
371
372 Tasks shown as running should be more properly thought of as
373 'ready to run' -- their task_struct is simply represented on
374 the Linux run-queue. Even without a true SMP machine, you may
375 see numerous tasks in this state depending on top's delay
376 interval and nice value.
377
378
379 x: Command -- Command line or Program name
380 Display the command line used to start a task or the name of
381 the associated program. You toggle between command line and
382 name with 'c', which is both a command-line option and an
383 interactive command.
384
385 When you've chosen to display command lines, processes without
386 a command line (like kernel threads) will be shown with only
387 the program name in parentheses, as in this example:
388 ( mdrecoveryd )
389
390 Either form of display is subject to potential truncation if
391 it's too long to fit in this field's current width. That width
392 depends upon other fields selected, their order and the current
393 screen width.
394
395 Note: The 'Command' field/column is unique, in that it is not
396 fixed-width. When displayed, this column will be allocated all
397 remaining screen width (up to the maximum 512 characters) to
398 provide for the potential growth of program names into command
399 lines.
400
401
402 y: WCHAN -- Sleeping in Function
403 Depending on the availability of the kernel link map ('Sysâ€
404 tem.map'), this field will show the name or the address of the
405 kernel function in which the task is currently sleeping. Runâ€
406 ning tasks will display a dash ('-') in this column.
407
408 Note: By displaying this field, top's own working set will be
409 increased by over 700Kb. Your only means of reducing that
410 overhead will be to stop and restart top.
411
412
413 z: Flags -- Task Flags
414 This column represents the task's current scheduling flags
415 which are expressed in hexadecimal notation and with zeros supâ€
416 pressed. These flags are officially documented in
417 <linux/sched.h>. Less formal documentation can also be found
418 on the 'Fields select' and 'Order fields' screens.
419
420
421 2b. SELECTING and ORDERING Columns
422 After pressing the interactive commands 'f' (Fields select) or 'o'
423 (Order fields) you will be shown a screen containing the current
424 fields string followed by names and descriptions for all fields.
425
426 Here is a sample fields string from one of top's four winâ€
427 dows/field groups and an explanation of the conventions used:
428
429 - Sample fields string:
430 ANOPQRSTUVXbcdefgjlmyzWHIK
431
432 - The order of displayed fields corresponds to the order of the
433 letters in that string.
434
435 - If the letter is upper case the corresponding field itself will
436 then be shown as part of the task display (screen width permitâ€
437 ting). This will also be indicated by a leading asterisk
438 ('*'), as in this excerpt:
439 ...
440 * K: %CPU = CPU usage
441 l: TIME = CPU Time
442 m: TIME+ = CPU Time, hundredths
443 * N: %MEM = Memory usage (RES)
444 * O: VIRT = Virtual Image (kb)
445 ...
446
447
448 Fields select screen -- the 'f' interactive command
449 You toggle the display of a field by simply pressing the correâ€
450 sponding letter.
451
452
453 Order fields screen -- the 'o' interactive command
454 You move a field to the left by pressing the corresponding
455 upper case letter and to the right with the lower case letter.
456
457
458 2c. CPU States
459 The CPU states are shown in the Summary Area. They are always
460 shown as a percentage and are for the time between now and the
461 last refresh.
462
463
464 us -- User CPU time
465 The time the CPU has spent running users' processes that are
466 not niced.
467
468
469 sy -- System CPU time
470 The time the CPU has spent running the kernel and its proâ€
471 cesses.
472
473
474 ni -- Nice CPU time
475 The time the CPU has spent running users' proccess that have
476 been niced.
477
478
479 wa -- iowait
480 Amount of time the CPU has been waiting for I/O to complete.
481
482
483 hi -- Hardware IRQ
484 The amount of time the CPU has been servicing hardware interâ€
485 rupts.
486
487
488 si -- Software Interrupts
489 The amount of time the CPU has been servicing software interâ€
490 rupts.
491
492
493 st -- Steal Time
494 The amount of CPU 'stolen' from this virtual machine by the
495 hypervisor for other tasks (such as running another virtual
496 machine).
497
498
4993. INTERACTIVE Commands
500 Listed below is a brief index of commands within categories. Some
501 commands appear more than once -- their meaning or scope may
502 vary depending on the context in which they are issued.
503
504 3a. GLOBAL_Commands
505 <Ret/Sp> ?, =, A, B, d, G, h, I, k, q, r, s, W, Z
506 3b. SUMMARY_Area_Commands
507 l, m, t, 1
508 3c. TASK_Area_Commands
509 Appearance: b, x, y, z
510 Content: c, f, H, o, S, u
511 Size: #, i, n
512 Sorting: <, >, F, O, R
513 3d. COLOR_Mapping
514 <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
515 4b. COMMANDS_for_Windows
516 -, _, =, +, A, a, G, g, w
517
518
519 3a. GLOBAL Commands
520 The global interactive commands are always available in both
521 full-screen mode and alternate-display mode. However, some of
522 these interactive commands are not available when running in
523 'Secure mode'.
524
525 If you wish to know in advance whether or not your top has been
526 secured, simply ask for help and view the system summary on the
527 second line.
528
529
530 <Enter> or <Space> :Refresh_Display
531 These commands do nothing, they are simply ignored. Howâ€
532 ever, they will awaken top and following receipt of any
533 input the entire display will be repainted.
534
535 Use either of these keys if you have a large delay interval
536 and wish to see current status,
537
538
539 <?> or <h> :Help
540 There are two help levels available. The first will proâ€
541 vide a reminder of all the basic interactive commands. If
542 top is secured, that screen will be abbreviated.
543
544 Typing 'h' or '?' on that help screen will take you to help
545 for those interactive commands applicable to alternate-disâ€
546 play mode.
547
548
549 <=> :Exit_Task_Limits
550 Removes restrictions on which tasks are shown. This comâ€
551 mand will reverse any 'i' (idle tasks) and 'n' (max tasks)
552 commands that might be active. It also provides for an
553 'exit' from PID monitoring. See the '-p' command-line
554 option for a discussion of PID monitoring.
555
556 When operating in alternate-display mode this command has a
557 slightly broader meaning.
558
559
560 <A> :Alternate_Display_Mode_toggle
561 This command will switch between full-screen mode and
562 alternate-display mode. See topic 4. ALTERNATE-DISPLAY
563 Mode and the 'G' interactive command for insight into ´curâ€
564 rent' windows and field groups.
565
566
567 <B> :Bold_Disable/Enable_toggle
568 This command will influence use of the 'bold' terminfo
569 capability and alters both the summary area and task area
570 for the ´current' window. While it is intended primarily
571 for use with dumb terminals, it can be applied anytime.
572
573 Note: When this toggle is On and top is operating in monoâ€
574 chrome mode, the entire display will appear as normal text.
575 Thus, unless the 'x' and/or 'y' toggles are using reverse
576 for emphasis, there will be no visual confirmation that
577 they are even on.
578
579
580 * <d> or <s> :Change_Delay_Time_interval
581 You will be prompted to enter the delay time, in seconds,
582 between display updates.
583
584 Fractional seconds are honored, but a negative number is
585 not allowed. Entering 0 causes (nearly) continuous
586 updates, with an unsatisfactory display as the system and
587 tty driver try to keep up with top's demands. The delay
588 value is inversely proportional to system loading, so set
589 it with care.
590
591 If at any time you wish to know the current delay time,
592 simply ask for help and view the system summary on the secâ€
593 ond line.
594
595
596 <G> :Choose_Another_Window/Field_Group
597 You will be prompted to enter a number between 1 and 4 desâ€
598 ignating the window/field group which should be made the
599 ´current' window. You will soon grow comfortable with
600 these 4 windows, especially after experimenting with alterâ€
601 nate-display mode.
602
603
604 <I> :Irix/Solaris_Mode_toggle
605 When operating in 'Solaris mode' ('I' toggled Off), a
606 task's cpu usage will be divided by the total number of
607 CPUs. After issuing this command, you'll be informed of
608 the new state of this toggle.
609
610
611 <u> :select a user
612 You will be prompted for a UID or username. Only processes
613 belonging to the selected user will be displayed. This
614 option matches on the effective UID.
615
616
617 <U> :select a user
618 You will be prompted for a UID or username. Only processes
619 belonging to the selected user will be displayed. This
620 option matches on the real, effective, saved, and filesysâ€
621 tem UID.
622
623
624 * <k> :Kill_a_task
625 You will be prompted for a PID and then the signal to send.
626 The default signal, as reflected in the prompt, is SIGTERM.
627 However, you can send any signal, via number or name.
628
629 If you wish to abort the kill process, do one of the folâ€
630 lowing depending on your progress:
631 1) at the pid prompt, just press <Enter>
632 2) at the signal prompt, type 0
633
634
635 <q> :Quit
636
637
638 * <r> :Renice_a_Task
639 You will be prompted for a PID and then the value to nice
640 it to. Entering a positive value will cause a process to
641 lose priority. Conversely, a negative value will cause a
642 process to be viewed more favorably by the kernel.
643
644
645 <W> :Write_the_Configuration_File
646 This will save all of your options and toggles plus the
647 current display mode and delay time. By issuing this comâ€
648 mand just before quitting top, you will be able restart
649 later in exactly that same state.
650
651
652 <Z> :Change_Color_Mapping
653 This key will take you to a separate screen where you can
654 change the colors for the ´current' window, or for all winâ€
655 dows. For details regarding this interactive command see
656 topic 3d. COLOR Mapping.
657
658
659 * The commands shown with an asterisk ('*') are not available in
660 'Secure mode', nor will they be shown on the level-1 help
661 screen.
662
663
664 3b. SUMMARY Area Commands
665 The summary area interactive commands are always available in both
666 full-screen mode and alternate-display mode. They affect the
667 beginning lines of your display and will determine the position of
668 messages and prompts.
669
670 These commands always impact just the ´current' window/field
671 group. See topic 4. ALTERNATE-DISPLAY Mode and the 'G' interacâ€
672 tive command for insight into ´current' windows and field groups.
673
674
675 <l> :Toggle_Load_Average/Uptime -- On/Off
676 This is also the line containing the program name (possibly
677 an alias) when operating in full-screen mode or the ´curâ€
678 rent' window name when operating in alternate-display mode.
679
680
681 <m> :Toggle_Memory/Swap_Usage -- On/Off
682 This command affects two summary area lines.
683
684
685 <t> :Toggle_Task/Cpu_States -- On/Off
686 This command affects from 2 to many summary area lines,
687 depending on the state of the '1' toggle and whether or not
688 top is running under true SMP.
689
690
691 <1> :Toggle_Single/Separate_Cpu_States -- On/Off
692 This command affects how the 't' command's Cpu States porâ€
693 tion is shown. Although this toggle exists primarily to
694 serve massively-parallel SMP machines, it is not restricted
695 to solely SMP environments.
696
697 When you see 'Cpu(s):' in the summary area, the '1' toggle
698 is On and all cpu information is gathered in a single line.
699 Otherwise, each cpu is displayed separately as: 'Cpu0,
700 Cpu1, ...'
701
702
703 Note: If the entire summary area has been toggled Off for any winâ€
704 dow, you would be left with just the message line. In that way,
705 you will have maximized available task rows but (temporarily) sacâ€
706 rificed the program name in full-screen mode or the ´current' winâ€
707 dow name when in alternate-display mode.
708
709
710 3c. TASK Area Commands
711 The task area interactive commands are always available in
712 full-screen mode.
713
714 The task area interactive commands are never available in alterâ€
715 nate-display mode if the ´current' window's task display has been
716 toggled Off (see topic 4. ALTERNATE-DISPLAY Mode).
717
718
719 APPEARANCE of task window
720 The following commands will also be influenced by the state of
721 the global 'B' (bold disable) toggle.
722
723
724 <b> :Bold/Reverse_toggle
725 This command will impact how the 'x' and 'y' toggles are
726 displayed. Further, it will only be available when at
727 least one of those toggles is On.
728
729
730 <x> :Column_Highlight_toggle
731 Changes highlighting for the current sort field. You probâ€
732 ably don't need a constant visual reminder of the sort
733 field and top hopes that you always run with 'column highâ€
734 light' Off, due to the cost in path-length.
735
736 If you forget which field is being sorted this command can
737 serve as a quick visual reminder.
738
739
740 <y> :Row_Highlight_toggle
741 Changes highlighting for "running" tasks. For additional
742 insight into this task state, see topic 2a. DESCRIPTIONS of
743 Fields, Process Status.
744
745 Use of this provision provides important insight into your
746 system's health. The only costs will be a few additional
747 tty escape sequences.
748
749
750 <z> :Color/Monochrome_toggle
751 Switches the ´current' window between your last used color
752 scheme and the older form of black-on-white or white-on-
753 black. This command will alter both the summary area and
754 task area but does not affect the state of the 'x', 'y' or
755 'b' toggles.
756
757
758 CONTENT of task window
759 <c> :Command_Line/Program_Name_toggle
760 This command will be honored whether or not the 'Command'
761 column is currently visible. Later, should that field come
762 into view, the change you applied will be seen.
763
764 <f> and <o> :Fields_select or Order_fields
765 These keys display separate screens where you can change
766 which fields are displayed and their order. For additional
767 information on these interactive commands see topic 2b.
768 SELECTING and ORDERING Columns.
769
770 <S> :Cumulative_Time_Mode_toggle
771 When this toggle is On, all individual threads will be disâ€
772 played. Otherwise, top displays a summation of all threads
773 in a process.
774
775 ´S´ :Cumulative_Time_Mode_toggle
776 When 'Cumulative mode' is On, each process is listed with
777 the cpu time that it and its dead children have used.
778
779 When Off, programs that fork into many separate tasks will
780 appear less demanding. For programs like 'init' or a shell
781 this is appropriate but for others, like compilers, perhaps
782 not. Experiment with two task windows sharing the same
783 sort field but with different 'S' states and see which repâ€
784 resentation you prefer.
785
786 After issuing this command, you'll be informed of the new
787 state of this toggle. If you wish to know in advance
788 whether or not 'Cumulative mode' is in effect, simply ask
789 for help and view the window summary on the second line.
790
791 <u> :Show_Specific_User_Only
792 You will be prompted to enter the name of the user to disâ€
793 play. Thereafter, in that task window only matching User
794 ID's will be shown, or possibly no tasks will be shown.
795
796 Later, if you wish to monitor all tasks again, re-issue
797 this command but just press <Enter> at the prompt, without
798 providing a name.
799
800 SIZE of task window
801 <i> :Idle_Processes_toggle
802 Displays all tasks or just active tasks. When this toggle
803 is Off, idled or zombied processes will not be displayed.
804
805 If this command is applied to the last task display when in
806 alternate-display mode, then it will not affect the winâ€
807 dow's size, as all prior task displays will have already
808 been painted.
809
810 <n> or <#> :Set_Maximum_Tasks
811 You will be prompted to enter the number of tasks to disâ€
812 play. The lessor of your number and available screen rows
813 will be used.
814
815 When used in alternate-display mode, this is the command
816 that gives you precise control over the size of each curâ€
817 rently visible task display, except for the very last. It
818 will not affect the last window's size, as all prior task
819 displays will have already been painted.
820
821 Note: If you wish to increase the size of the last visible
822 task display when in alternate-display mode, simply
823 decrease the size of the task display(s) above it.
824
825 SORTING of task window
826 For compatibility, this top supports most of the former top sort
827 keys. Since this is primarily a service to former top users,
828 these commands do not appear on any help screen.
829 command sorted field supported
830 A start time (non-display) No
831 M %MEM Yes
832 N PID Yes
833 P %CPU Yes
834 T TIME+ Yes
835
836 Before using any of the following sort provisions, top suggests
837 that you temporarily turn on column highlighting using the 'x'
838 interactive command. That will help ensure that the actual sort
839 environment matches your intent.
840
841 The following interactive commands will only be honored when the
842 current sort field is visible. The sort field might not be visâ€
843 ible because:
844 1) there is insufficient Screen Width
845 2) the 'f' interactive command turned it Off
846
847 <<> :Move_Sort_Field_Left
848 Moves the sort column to the left unless the current sort
849 field is the first field being displayed.
850
851 <>> :Move_Sort_Field_Right
852 Moves the sort column to the right unless the current sort
853 field is the last field being displayed.
854
855 The following interactive commands will always be honored
856 whether or not the current sort field is visible.
857
858 <F> or <O> :Select_Sort_Field
859 These keys display a separate screen where you can change
860 which field is used as the sort column.
861
862 If a field is selected which was not previously being disâ€
863 played, it will be forced On when you return to the top
864 display. However, depending upon your screen width and the
865 order of your fields, this sort field may not be disâ€
866 playable.
867
868 This interactive command can be a convenient way to simply
869 verify the current sort field, when running top with column
870 highlighting turned Off.
871
872 <R> :Reverse/Normal_Sort_Field_toggle
873 Using this interactive command you can alternate between
874 high-to-low and low-to-high sorts.
875
876 Note: Field sorting uses internal values, not those in column
877 display. Thus, the TTY and WCHAN fields will violate strict
878 ASCII collating sequence.
879
880 3d. COLOR Mapping
881 When you issue the 'Z' interactive command, you will be presented
882 with a separate screen. That screen can be used to change the
883 colors in just the ´current' window or in all four windows before
884 returning to the top display.
885
886 Available interactive commands
887 4 upper case letters to select a target
888 8 numbers to select a color
889 normal toggles available
890 'B' :bold disable/enable
891 'b' :running tasks "bold"/reverse
892 'z' :color/mono
893 other commands available
894 'a'/'w' :apply, then go to next/prior
895 <Enter> :apply and exit
896 'q' :abandon current changes and exit
897
898 If your use 'a' or 'w' to cycle the targeted window, you will have
899 applied the color scheme that was displayed when you left that
900 window. You can, of course, easily return to any window and reapâ€
901 ply different colors or turn colors Off completely with the 'z'
902 toggle.
903
904 The Color Mapping screen can also be used to change the ´current'
905 window/field group in either full-screen mode or alternate-display
906 mode. Whatever was targeted when 'q' or <Enter> was pressed will
907 be made current as you return to the top display.
908
909
9104. ALTERNATE-DISPLAY Mode
911 4a. WINDOWS Overview
912 Field Groups/Windows:
913 In full-screen mode there is a single window represented by
914 the entire screen. That single window can still be changed
915 to display 1 of 4 different field groups (see the 'G'
916 interactive command, repeated below). Each of the 4 field
917 groups has a unique separately configurable summary area
918 and its own configurable task area.
919
920 In alternate-display mode, those 4 underlying field groups
921 can now be made visible simultaneously, or can be turned
922 Off individually at your command.
923
924 The summary area will always exist, even if it's only the
925 message line. At any given time only one summary area can
926 be displayed. However, depending on your commands, there
927 could be from zero to four separate task displays currently
928 showing on the screen.
929
930 Current Window:
931 The ´current' window is the window associated with the sumâ€
932 mary area and the window to which task related commands are
933 always directed. Since in alternate-display mode you can
934 toggle the task display Off, some commands might be
935 restricted for the ´current' window.
936
937 A further complication arises when you have toggled the
938 first summary area line Off. With the loss of the window
939 name (the 'l' toggled line), you'll not easily know what
940 window is the ´current' window.
941
942 4b. COMMANDS for Windows
943 <-> and <_> :Show/Hide_Window(s)_toggles
944 The '-' key turns the ´current' window's task display On
945 and Off. When On, that task area will show a minimum of
946 the columns header you've established with the 'f' and 'o'
947 commands. It will also reflect any other task area
948 options/toggles you've applied yielding zero or more tasks.
949
950 The '_' key does the same for all task displays. In other
951 words, it switches between the currently visible task disâ€
952 play(s) and any task display(s) you had toggled Off. If
953 all 4 task displays are currently visible, this interactive
954 command will leave the summary area as the only display
955 element.
956
957 * <=> and <+> :Equalize_(re-balance)_Window(s)
958 The '=' key forces the ´current' window's task display to
959 be visible. It also reverses any 'i' (idle tasks) and 'n'
960 (max tasks) commands that might be active.
961
962 The '+' key does the same for all windows. The four task
963 displays will reappear, evenly balanced. They will also
964 have retained any customizations you had previously
965 applied, except for the 'i' (idle tasks) and 'n' (max
966 tasks) commands.
967
968 * <A> :Alternate_Display_Mode_toggle
969 This command will switch between full-screen mode and
970 alternate-display mode.
971
972 The first time you issue this command, all four task disâ€
973 plays will be shown. Thereafter when you switch modes, you
974 will see only the task display(s) you've chosen to make
975 visible.
976
977 * <a> and <w> :Next_Window_Forward/Backward
978 This will change the ´current' window, which in turn
979 changes the window to which commands are directed. These
980 keys act in a circular fashion so you can reach any desired
981 ´current' window using either key.
982
983 Assuming the window name is visible (you have not toggled
984 'l' Off), whenever the ´current' window name loses its
985 emphasis/color, that's a reminder the task display is Off
986 and many commands will be restricted.
987
988 * <G> :Choose_Another_Window/Field_Group
989 You will be prompted to enter a number between 1 and 4 desâ€
990 ignating the window/field group which should be made the
991 ´current' window.
992
993 In full-screen mode, this command is necessary to alter the
994 ´current' window. In alternate-display mode, it is simply
995 a less convenient alternative to the 'a' and 'w' commands.
996
997 <g> :Change_Window/Field_Group_Name
998 You will be prompted for a new name to be applied to the
999 ´current' window. It does not require that the window name
1000 be visible (the 'l' toggle to be On).
1001
1002 * The interactive commands shown with an asterisk ('*') have use
1003 beyond alternate-display mode.
1004 '=', 'A', 'G' are always available
1005 'a', 'w' act the same when color mapping
1006
1007
10085. FILES
1009 5a. SYSTEM Configuration File
1010 The presence of this file will influence which version of the
1011 'help' screen is shown to an ordinary user. More importantly, it
1012 will limit what ordinary users are allowed to do when top is runâ€
1013 ning. They will not be able to issue the following commands.
1014 k Kill a task
1015 r Renice a task
1016 d or s Change delay/sleep interval
1017
1018 The system configuration file is not created by top. Rather, you
1019 create this file manually and place it in the /etc directory. Its
1020 name must be 'toprc' and must have no leading '.' (period). It
1021 must have only two lines.
1022
1023 Here is an example of the contents of /etc/toprc:
1024 s # line 1: 'secure' mode switch
1025 5.0 # line 2: 'delay' interval in seconds
1026
1027 5b. PERSONAL Configuration File
1028 This file is written as '$HOME/.your-name-4-top' + 'rc'. Use the
1029 'W' interactive command to create it or update it.
1030
1031 Here is the general layout:
1032 global # line 1: the program name/alias notation
1033 " # line 2: id,altscr,irixps,delay,curwin
1034 per ea # line a: winname,fieldscur
1035 window # line b: winflags,sortindx,maxtasks
1036 " # line c: summclr,msgsclr,headclr,taskclr
1037
1038 If the $HOME variable is not present, top will try to write the
1039 personal configuration file to the current directory, subject to
1040 permissions.
1041
1042
10436. STUPID TRICKS Sampler
1044 Many of these 'tricks' work best when you give top a scheduling
1045 boost. So plan on starting him with a nice value of -10, assuming
1046 you've got the authority.
1047
1048 6a. Kernel Magic
1049 For these stupid tricks, top needs full-screen mode.
1050
1051 -*- The user interface, through prompts and help, intentionally
1052 implies that the delay interval is limited to tenths of a
1053 second. However, you're free to set any desired delay. If
1054 you want to see Linux at his scheduling best, try a delay of
1055 .09 seconds or less.
1056
1057 For this experiment, under x-windows open an xterm and maxiâ€
1058 mize it. Then do the following:
1059 . provide a scheduling boost and tiny delay via:
1060 nice -n -10 top -d.09
1061 . keep sorted column highlighting Off to minimize
1062 path length
1063 . turn On reverse row highlighting for emphasis
1064 . try various sort columns (TIME/MEM work well),
1065 and normal or reverse sorts to bring the most
1066 active processes into view
1067
1068 What you'll see is a very busy Linux doing what he's always
1069 done for you, but there was no program available to illusâ€
1070 trate this.
1071
1072 -*- Under an xterm using 'white-on-black' colors, try setting
1073 top's task color to black and be sure that task highlighting
1074 is set to bold, not reverse. Then set the delay interval to
1075 around .3 seconds.
1076
1077 After bringing the most active processes into view, what
1078 you'll see are the ghostly images of just the currently runâ€
1079 ning tasks.
1080
1081 -*- Delete the existing rcfile, or create a new symlink. Start
1082 this new version then type 'T' (a secret key, see topic 3c.
1083 TASK Area Commands, Sorting) followed by 'W' and 'q'.
1084 Finally, restart the program with -d0 (zero delay).
1085
1086 Your display will be refreshed at three times the rate of the
1087 former top, a 300% speed advantage. As top climbs the TIME
1088 ladder, be as patient as you can while speculating on whether
1089 or not top will ever reach the top.
1090
1091 6b. Bouncing Windows
1092 For these stupid tricks, top needs alternate-display mode.
1093
1094 -*- With 3 or 4 task displays visible, pick any window other than
1095 the last and turn idle processes Off. Depending on where you
1096 applied 'i', sometimes several task displays are bouncing and
1097 sometimes it's like an accordion, as top tries his best to
1098 allocate space.
1099
1100 -*- Set each window's summary lines differently: one with no memâ€
1101 ory; another with no states; maybe one with nothing at all,
1102 just the message line. Then hold down 'a' or 'w' and watch a
1103 variation on bouncing windows -- hopping windows.
1104
1105 -*- Display all 4 windows and for each, in turn, set idle proâ€
1106 cesses to Off. You've just entered the "extreme bounce"
1107 zone.
1108
1109 6c. The Big Bird Window
1110 This stupid trick also requires alternate-display mode.
1111
1112 -*- Display all 4 windows and make sure that 1:Def is the ´curâ€
1113 rent' window. Then, keep increasing window size until the
1114 all the other task displays are "pushed out of the nest".
1115
1116 When they've all been displaced, toggle between all visiâ€
1117 ble/invisible windows. Then ponder this:
1118 is top fibbing or telling honestly your imposed truth?
1119
1120
11217. BUGS
1122 Send bug reports to:
1123 Albert D. Cahalan, <albert@users.sf.net>
1124
1125
11268. HISTORY Former top
1127 The original top was written by Roger Binns, based on Branko
1128 Lankester's <lankeste@fwi.uva.nl> ps program.
1129
1130 Robert Nation <nation@rocket.sanders.lockheed.com> adapted it for
1131 the proc file system.
1132
1133 Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de> added support
1134 for configurable fields.
1135
1136 Plus many other individuals contributed over the years.
1137
1138
11399. AUTHOR
1140 This entirely new and enhanced replacement was written by:
1141 Jim / James C. Warner, <warnerjc@worldnet.att.net>
1142
1143 With invaluable help from:
1144 Albert D. Cahalan, <albert@users.sf.net>
1145 Craig Small, <csmall@small.dropbear.id.au>
1146
1147
114810. SEE ALSO
1149 free(1), ps(1), uptime(1), atop(1), slabtop(1), vmstat(8), w(1).
1150
1151
1152
1153
1154
1155
1156Linux September 2002 TOP(1)