1TOP(1)                     Linux User's Manual                     TOP(1)
2
3
4

NAME

6       top - display Linux tasks
7
8
9

SYNOPSIS

11       ⟨⟩
12        -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
13
14       The traditional switches '-' and whitespace are optional.
15
16
17

DESCRIPTION

19       The .ie 0 .    br
20        program  provides  a  dynamic real-time view of a running system.
21       It can display system summary information as well  as  a  list  of
22       tasks  currently  being managed by the Linux kernel.  The types of
23       system summary information shown and the types, order and size  of
24       information displayed for tasks are all user configurable and that
25       configuration can be made persistent across restarts.
26
27       The program provides a limited interactive interface  for  process
28       manipulation  as  well as a much more extensive interface for per‐
29       sonal configuration  --  encompassing every aspect of  its  opera‐
30       tion.  And while .ie 0 .    br
31        is referred to throughout this document, you are free to name the
32       program anything you wish.  That new name, possibly an alias, will
33       then be reflected on top's display and used when reading and writ‐
34       ing a configuration file.
35
36
37

OVERVIEW

39   Documentation
40       The remaining Table of Contents
41           1. COMMAND-LINE Options
42           2. FIELDS / Columns
43              a. DESCRIPTIONS of Fields
44              b. SELECTING and ORDERING Columns
45           3. INTERACTIVE Commands
46              a. GLOBAL Commands
47              b. SUMMARY Area Commands
48              c. TASK Area Commands
49              d. COLOR Mapping
50           4. ALTERNATE-DISPLAY Mode
51              a. WINDOWS Overview
52              b. COMMANDS for Windows
53           5. FILES
54              a. SYSTEM Configuration File
55              b. PERSONAL Configuration File
56           6. STUPID TRICKS Sampler
57              a. Kernel Magic
58              b. Bouncing Windows
59              c. The Big Bird Window
60           7. BUGS, 8. HISTORY Former top, 9. AUTHOR, 10. SEE ALSO
61
62
63   Operation
64       When operating top, the two most important keys are help  ('h'  or
65       '?')  and quit ('q') key.  Alternatively, you could simply use the
66       traditional interrupt key ('^C') when you're done.
67
68       When you start top for the first time, you'll  be  presented  with
69       the   traditional  screen  elements:  1)  Summary  Area;  2)  Mes‐
70       sage/Prompt Line; 3) Columns Header; 4) Task  Area.   There  will,
71       however, be some differences when compared to the former top.
72
73
74       Highlighting
75          Summary_Area: There is no highlighting for load/uptime and only
76          values are highlighted for other elements.
77
78          Task_Area: Tasks running (or ready to run) will be highlighted,
79          and bold is only one way of emphasizing such processes.
80
81
82       Content/Labels
83          Summary_Area:  The  program name is shown, perhaps a symlink or
84          alias.  The Cpu(s) state label hints  at  other  possibilities.
85          The memory stats use a lower case 'k'.
86
87          Columns_Header:  Will show a new field and some changed labels.
88          More new fields will be found as you customize your top.
89
90
91       Note: the width of top's display will be limited to 512 positions.
92       Displaying  all  fields requires a minimum of 160 characters.  The
93       remaining width could be used for the 'Command' column.
94
95
96   Startup Defaults
97       The following startup defaults assume no configuration file,  thus
98       no  user  customizations.   Even  so, items shown with an asterisk
99       ('*') could be overridden through the command-line.
100
101           Global_defaults
102              'A' - Alt display      Off (full-screen)
103            * 'd' - Delay time       3.0 seconds
104              'I' - Irix mode        On  (no, 'solaris' smp)
105            * 'p' - PID monitoring   Off
106            * 's' - Secure mode      Off (unsecured)
107              'B' - Bold disable     Off
108           Summary_Area_defaults
109              'l' - Load Avg/Uptime  On  (thus program name)
110              't' - Task/Cpu states  On  (1+1 lines, see '1')
111              'm' - Mem/Swap usage   On  (2 lines worth)
112              '1' - Single Cpu       On  (thus 1 line if smp)
113           Task_Area_defaults
114              'b' - Bold hilite      On  (not 'reverse')
115            * 'c' - Command line     Off (name, not cmdline)
116            * 'H' - Threads          Off (show all threads)
117            * 'i' - Idle tasks       On  (show all tasks)
118              'R' - Reverse sort     On  (pids high-to-low)
119            * 'S' - Cumulative time  Off (no, dead children)
120              'x' - Column hilite    Off (no, sort field)
121              'y' - Row hilite       On  (yes, running tasks)
122              'z' - color/mono       Off (no, colors)
123
124
125

1. COMMAND-LINE Options

127       The command-line syntax for top consists of:
128
129            -hv | -bcHisS -d delay -n iterations -p pid [,pid...]
130
131       The typically mandatory switches ('-')  and  even  whitespace  are
132       completely optional.
133
134
135       -b : Batch mode operation
136            Starts top in 'Batch mode', which could be useful for sending
137            output from top to other programs or  to  a  file.   In  this
138            mode, top will not accept input and runs until the iterations
139            limit you've set with the '-n' command-line option  or  until
140            killed.
141
142
143       -c : Command line/Program name toggle
144            Starts  top  with  the  last  remembered  'c' state reversed.
145            Thus, if top was displaying command  lines,  now  that  field
146            will  show program names, and visa versa.  See the 'c' inter‐
147            active command for additional information.
148
149
150       -d : Delay time interval as:  -d ss.tt (seconds.tenths)
151            Specifies the delay between screen updates, and overrides the
152            corresponding  value  in one's personal configuration file or
153            the startup default.  Later this can be changed with the  'd'
154            or 's' interactive commands.
155
156            Fractional  seconds are honored, but a negative number is not
157            allowed.  In all cases, however, such changes are  prohibited
158            if  top  is running in 'Secure mode', except for root (unless
159            the 's' command-line option was used).  For additional infor‐
160            mation  on  'Secure  mode' see topic 5a. SYSTEM Configuration
161            File.
162
163
164
165       -h : Help
166            Show library version and the usage prompt, then quit.
167
168
169       -H : Threads toggle
170            Starts top with the last remembered 'H' state reversed.  When
171            this  toggle is On, all individual threads will be displayed.
172            Otherwise, top displays a  summation  of  all  threads  in  a
173            process.
174
175
176       -i : Idle Processes toggle
177            Starts top with the last remembered 'i' state reversed.  When
178            this toggle is Off, tasks that are idled or zombied will  not
179            be displayed.
180
181
182       -n : Number of iterations limit as:  -n number
183            Specifies  the  maximum  number of iterations, or frames, top
184            should produce before ending.
185
186
187       -u : Monitor by user as:  -u somebody
188            Monitor only processes with an effective  UID  or  user  name
189            matching that given.
190
191
192       -U : Monitor by user as:  -U somebody
193            Monitor  only processes with a UID or user name matching that
194            given.  This matches real, effective, saved,  and  filesystem
195            UIDs.
196
197
198       -p : Monitor PIDs as:  -pN1 -pN2 ...  or  -pN1, N2 [,...]
199            Monitor  only  processes  with  specified  process IDs.  This
200            option can be given up to 20 times,  or  you  can  provide  a
201            comma  delimited  list  with up to 20 pids.  Co-mingling both
202            approaches is permitted.
203
204            This is a command-line option only.  And should you  wish  to
205            return  to  normal operation, it is not necessary to quit and
206            and restart top  --  just issue the '=' interactive command.
207
208
209       -s : Secure mode operation
210            Starts top with secure mode forced, even for root.  This mode
211            is  far  better  controlled  through the system configuration
212            file (see topic 5. FILES).
213
214
215       -S : Cumulative time mode toggle
216            Starts top with the last remembered 'S' state reversed.  When
217            'Cumulative  mode' is On, each process is listed with the cpu
218            time that it and its dead children have used.   See  the  'S'
219            interactive command for additional information regarding this
220            mode.
221
222
223       -v : Version
224            Show library version and the usage prompt, then quit.
225
226
227

2. FIELDS / Columns

229   2a. DESCRIPTIONS of Fields
230       Listed below are top's available fields.  They are always  associ‐
231       ated  with  the  letter  shown, regardless of the position you may
232       have established for them with the 'o' (Order fields)  interactive
233       command.
234
235       Any field is selectable as the sort field, and you control whether
236       they are sorted high-to-low or low-to-high.  For additional infor‐
237       mation on sort provisions see topic 3c. TASK Area Commands.
238
239
240       a: PID  --  Process Id
241          The  task's unique process ID, which periodically wraps, though
242          never restarting at zero.
243
244
245       b: PPID  --  Parent Process Pid
246          The process ID of a task's parent.
247
248
249       c: RUSER  --  Real User Name
250          The real user name of the task's owner.
251
252
253       d: UID  --  User Id
254          The effective user ID of the task's owner.
255
256
257       e: USER  --  User Name
258          The effective user name of the task's owner.
259
260
261       f: GROUP  --  Group Name
262          The effective group name of the task's owner.
263
264
265       g: TTY  --  Controlling Tty
266          The name of the controlling  terminal.   This  is  usually  the
267          device  (serial  port,  pty,  etc.)  from which the process was
268          started, and which it uses for input  or  output.   However,  a
269          task  need  not  be  associated  with a terminal, in which case
270          you'll see '?' displayed.
271
272
273       h: PR  --  Priority
274          The priority of the task.
275
276
277       i: NI  --  Nice value
278          The nice value of the task.  A negative nice value means higher
279          priority,  whereas  a positive nice value means lower priority.
280          Zero in this field simply means priority will not  be  adjusted
281          in determining a task's dispatchability.
282
283
284       j: P  --  Last used CPU (SMP)
285          A  number  representing the last used processor.  In a true SMP
286          environment this will likely change frequently since the kernel
287          intentionally  uses  weak affinity.  Also, the very act of run‐
288          ning top may break this weak affinity and cause more  processes
289          to  change CPUs more often (because of the extra demand for cpu
290          time).
291
292
293       k: %CPU  --  CPU usage
294          The task's share of the elapsed CPU time since the last  screen
295          update, expressed as a percentage of total CPU time.  In a true
296          SMP environment, if 'Irix mode' is Off,  top  will  operate  in
297          'Solaris  mode' where a task's cpu usage will be divided by the
298          total number of CPUs.  You toggle 'Irix/Solaris' modes with the
299          'I' interactive command.
300
301
302       l: TIME  --  CPU Time
303          Total CPU time the task has used since it started.  When 'Cumu‐
304          lative mode' is On, each process is listed with  the  cpu  time
305          that it and its dead children has used.  You toggle 'Cumulative
306          mode' with 'S', which is a command-line option and an  interac‐
307          tive  command.   See the 'S' interactive command for additional
308          information regarding this mode.
309
310
311       m: TIME+  --  CPU Time, hundredths
312          The same as 'TIME', but  reflecting  more  granularity  through
313          hundredths of a second.
314
315
316       n: %MEM  --  Memory usage (RES)
317          A task's currently used share of available physical memory.
318
319
320       o: VIRT  --  Virtual Image (kb)
321          The  total  amount  of  virtual  memory  used  by the task.  It
322          includes all code, data and shared libraries  plus  pages  that
323          have  been  swapped  out.  (Note: you can define the STATSIZE=1
324          environment variable and the VIRT will be calculated  from  the
325          /proc/#/state VmSize field.)
326
327          VIRT = SWAP + RES.
328
329
330       p: SWAP  --  Swapped size (kb)
331          The swapped out portion of a task's total virtual memory image.
332
333
334       q: RES  --  Resident size (kb)
335          The non-swapped physical memory a task has used.
336
337          RES = CODE + DATA.
338
339
340       r: CODE  --  Code size (kb)
341          The  amount of physical memory devoted to executable code, also
342          known as the 'text resident set' size or TRS.
343
344
345       s: DATA  --  Data+Stack size (kb)
346          The amount of physical memory devoted to other than  executable
347          code, also known as the 'data resident set' size or DRS.
348
349
350       t: SHR  --  Shared Mem size (kb)
351          The amount of shared memory used by a task.  It simply reflects
352          memory that could be potentially shared with other processes.
353
354
355       u: nFLT  --  Page Fault count
356          The number of major page faults that have occurred for a  task.
357          A  page  fault  occurs  when a process attempts to read from or
358          write to a virtual page that is not currently  present  in  its
359          address  space.   A  major  page  fault  is when disk access is
360          involved in making that page available.
361
362
363       v: nDRT  --  Dirty Pages count
364          The number of pages that have been  modified  since  they  were
365          last  written  to  disk.   Dirty  pages must be written to disk
366          before the corresponding physical memory location can  be  used
367          for some other virtual page.
368
369
370       w: S  --  Process Status
371          The status of the task which can be one of:
372             'D' = uninterruptible sleep
373             'R' = running
374             'S' = sleeping
375             'T' = traced or stopped
376             'Z' = zombie
377
378          Tasks  shown  as  running should be more properly thought of as
379          'ready to run'  --  their task_struct is simply represented  on
380          the  Linux run-queue.  Even without a true SMP machine, you may
381          see numerous tasks in  this  state  depending  on  top's  delay
382          interval and nice value.
383
384
385       x: Command  --  Command line or Program name
386          Display  the  command  line used to start a task or the name of
387          the associated program.  You toggle between  command  line  and
388          name  with  'c',  which  is  both  a command-line option and an
389          interactive command.
390
391          When you've chosen to display command lines, processes  without
392          a  command  line  (like kernel threads) will be shown with only
393          the program name in parentheses, as in this example:
394                ( mdrecoveryd )
395
396          Either form of display is subject to  potential  truncation  if
397          it's too long to fit in this field's current width.  That width
398          depends upon other fields selected, their order and the current
399          screen width.
400
401          Note:  The  'Command' field/column is unique, in that it is not
402          fixed-width.  When displayed, this column will be allocated all
403          remaining  screen  width  (up to the maximum 512 characters) to
404          provide for the potential growth of program names into  command
405          lines.
406
407
408       y: WCHAN  --  Sleeping in Function
409          Depending  on  the  availability  of the kernel link map ('Sys‐
410          tem.map'), this field will show the name or the address of  the
411          kernel  function in which the task is currently sleeping.  Run‐
412          ning tasks will display a dash ('-') in this column.
413
414          Note: By displaying this field, top's own working set  will  be
415          increased  by  over  700Kb.   Your  only means of reducing that
416          overhead will be to stop and restart top.
417
418
419       z: Flags  --  Task Flags
420          This column represents  the  task's  current  scheduling  flags
421          which are expressed in hexadecimal notation and with zeros sup‐
422          pressed.    These   flags   are   officially   documented    in
423          <linux/sched.h>.   Less  formal documentation can also be found
424          on the 'Fields select' and 'Order fields' screens.
425
426
427   2b. SELECTING and ORDERING Columns
428       After pressing the interactive commands 'f' (Fields select) or ´o'
429       (Order  fields)  you will be shown a screen containing the current
430       fields string followed by names and descriptions for all fields.
431
432       Here is a sample  fields  string  from  one  of  top's  four  win‐
433       dows/field groups and an explanation of the conventions used:
434
435       -  Sample fields string:
436             ANOPQRSTUVXbcdefgjlmyzWHIK
437
438       -  The  order  of displayed fields corresponds to the order of the
439          letters in that string.
440
441       -  If the letter is upper case the corresponding field itself will
442          then be shown as part of the task display (screen width permit‐
443          ting).  This will also  be  indicated  by  a  leading  asterisk
444          ('*'), as in this excerpt:
445              ...
446              * K: %CPU       = CPU usage
447                l: TIME       = CPU Time
448                m: TIME+      = CPU Time, hundredths
449              * N: %MEM       = Memory usage (RES)
450              * O: VIRT       = Virtual Image (kb)
451              ...
452
453
454       Fields select screen  --  the 'f' interactive command
455          You toggle the display of a field by simply pressing the corre‐
456          sponding letter.
457
458
459       Order fields screen  --  the 'o' interactive command
460          You move a field to the  left  by  pressing  the  corresponding
461          upper case letter and to the right with the lower case letter.
462
463
464

3. INTERACTIVE Commands

466       Listed below is a brief index of commands within categories.  Some
467       commands appear more than once  --  their  meaning  or  scope  may
468       vary depending on the context in which they are issued.
469
470         3a. GLOBAL_Commands
471               <Ret/Sp> ?, =, A, B, d, G, h, I, k, q, r, s, W, Z
472         3b. SUMMARY_Area_Commands
473               l, m, t, 1
474         3c. TASK_Area_Commands
475               Appearance:  b, x, y, z
476               Content:     c, f, H, o, S, u
477               Size:        #, i, n
478               Sorting:     <, >, F, O, R
479         3d. COLOR_Mapping
480               <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
481         4b. COMMANDS_for_Windows
482               -, _, =, +, A, a, G, g, w
483
484
485   3a. GLOBAL Commands
486       The  global  interactive  commands  are  always  available in both
487       full-screen mode and alternate-display  mode.   However,  some  of
488       these  interactive  commands  are  not  available  when running in
489       'Secure mode'.
490
491       If you wish to know in advance whether or not your  top  has  been
492       secured,  simply  ask  for help and view the system summary on the
493       second line.
494
495
496         <Enter> or <Space> :Refresh_Display
497              These commands do nothing, they are simply  ignored.   How‐
498              ever,  they  will  awaken  top and following receipt of any
499              input the entire display will be repainted.
500
501              Use either of these keys if you have a large delay interval
502              and wish to see current status,
503
504
505         ´?´ or ´h´ :Help
506              There  are  two help levels available.  The first will pro‐
507              vide a reminder of all the basic interactive commands.   If
508              top is secured, that screen will be abbreviated.
509
510              Typing 'h' or '?' on that help screen will take you to help
511              for those interactive commands applicable to alternate-dis‐
512              play mode.
513
514
515         ´=´ :Exit_Task_Limits
516              Removes  restrictions  on which tasks are shown.  This com‐
517              mand will reverse any 'i' (idle tasks) and 'n' (max  tasks)
518              commands  that  might  be  active.  It also provides for an
519              'exit' from PID  monitoring.   See  the  '-p'  command-line
520              option for a discussion of PID monitoring.
521
522              When operating in alternate-display mode this command has a
523              slightly broader meaning.
524
525
526         ´A´ :Alternate_Display_Mode_toggle
527              This command  will  switch  between  full-screen  mode  and
528              alternate-display  mode.   See  topic  4. ALTERNATE-DISPLAY
529              Mode and the 'G' interactive command for insight into ´cur‐
530              rent' windows and field groups.
531
532
533         ´B´ :Bold_Disable/Enable_toggle
534              This  command  will  influence  use  of the 'bold' terminfo
535              capability and alters both the summary area and  task  area
536              for  the  ´current' window.  While it is intended primarily
537              for use with dumb terminals, it can be applied anytime.
538
539              Note: When this toggle is On and top is operating in  mono‐
540              chrome mode, the entire display will appear as normal text.
541              Thus, unless the 'x' and/or 'y' toggles are  using  reverse
542              for  emphasis,  there  will  be no visual confirmation that
543              they are even on.
544
545
546       * ´d´ or ´s´ :Change_Delay_Time_interval
547              You will be prompted to enter the delay time,  in  seconds,
548              between display updates.
549
550              Fractional  seconds  are  honored, but a negative number is
551              not  allowed.   Entering  0  causes   (nearly)   continuous
552              updates,  with  an unsatisfactory display as the system and
553              tty driver try to keep up with top's  demands.   The  delay
554              value  is  inversely proportional to system loading, so set
555              it with care.
556
557              If at any time you wish to know  the  current  delay  time,
558              simply ask for help and view the system summary on the sec‐
559              ond line.
560
561
562         ´G´ :Choose_Another_Window/Field_Group
563              You will be prompted to enter a number between 1 and 4 des‐
564              ignating  the  window/field  group which should be made the
565              ´current' window.  You  will  soon  grow  comfortable  with
566              these 4 windows, especially after experimenting with alter‐
567              nate-display mode.
568
569
570         ´I´ :Irix/Solaris_Mode_toggle
571              When operating in  'Solaris  mode'  ('I'  toggled  Off),  a
572              task's  cpu  usage  will  be divided by the total number of
573              CPUs.  After issuing this command, you'll  be  informed  of
574              the new state of this toggle.
575
576
577         ´u´ :select a user
578              You  will be prompted for a UID or username. Only processes
579              belonging to the selected  user  will  be  displayed.  This
580              option matches on the effective UID.
581
582
583         ´U´ :select a user
584              You  will be prompted for a UID or username. Only processes
585              belonging to the selected  user  will  be  displayed.  This
586              option  matches on the real, effective, saved, and filesys‐
587              tem UID.
588
589
590       * ´k´ :Kill_a_task
591              You will be prompted for a PID and then the signal to send.
592              The default signal, as reflected in the prompt, is SIGTERM.
593              However, you can send any signal, via number or name.
594
595              If you wish to abort the kill process, do one of  the  fol‐
596              lowing depending on your progress:
597                 1) at the pid prompt, just press <Enter>
598                 2) at the signal prompt, type 0
599
600
601         ´q´ :Quit
602
603
604       * ´r´ :Renice_a_Task
605              You  will  be prompted for a PID and then the value to nice
606              it to.  Entering a positive value will cause a  process  to
607              lose  priority.   Conversely, a negative value will cause a
608              process to be viewed more favorably by the kernel.
609
610
611         ´W´ :Write_the_Configuration_File
612              This will save all of your options  and  toggles  plus  the
613              current  display mode and delay time.  By issuing this com‐
614              mand just before quitting top, you  will  be  able  restart
615              later in exactly that same state.
616
617
618         ´Z´ :Change_Color_Mapping
619              This  key  will take you to a separate screen where you can
620              change the colors for the ´current' window, or for all win‐
621              dows.   For  details regarding this interactive command see
622              topic 3d. COLOR Mapping.
623
624
625       *  The commands shown with an asterisk ('*') are not available  in
626          'Secure  mode',  nor  will  they  be  shown on the level-1 help
627          screen.
628
629
630   3b. SUMMARY Area Commands
631       The summary area interactive commands are always available in both
632       full-screen  mode  and  alternate-display  mode.   They affect the
633       beginning lines of your display and will determine the position of
634       messages and prompts.
635
636       These  commands  always  impact  just  the  ´current' window/field
637       group.  See topic 4. ALTERNATE-DISPLAY Mode and the  'G'  interac‐
638       tive command for insight into ´current' windows and field groups.
639
640
641         ´l´ :Toggle_Load_Average/Uptime  --  On/Off
642              This is also the line containing the program name (possibly
643              an alias) when operating in full-screen mode or  the  ´cur‐
644              rent' window name when operating in alternate-display mode.
645
646
647         ´m´ :Toggle_Memory/Swap_Usage  --  On/Off
648              This command affects two summary area lines.
649
650
651         ´t´ :Toggle_Task/Cpu_States  --  On/Off
652              This  command  affects  from  2 to many summary area lines,
653              depending on the state of the '1' toggle and whether or not
654              top is running under true SMP.
655
656
657         ´1´ :Toggle_Single/Separate_Cpu_States  --  On/Off
658              This  command affects how the 't' command's Cpu States por‐
659              tion is shown.  Although this toggle  exists  primarily  to
660              serve massively-parallel SMP machines, it is not restricted
661              to solely SMP environments.
662
663              When you see 'Cpu(s):' in the summary area, the '1'  toggle
664              is On and all cpu information is gathered in a single line.
665              Otherwise, each cpu  is  displayed  separately  as:  'Cpu0,
666              Cpu1, ...'
667
668
669       Note: If the entire summary area has been toggled Off for any win‐
670       dow, you would be left with just the message line.  In  that  way,
671       you will have maximized available task rows but (temporarily) sac‐
672       rificed the program name in full-screen mode or the ´current' win‐
673       dow name when in alternate-display mode.
674
675
676   3c. TASK Area Commands
677       The  task  area  interactive  commands  are  always  available  in
678       full-screen mode.
679
680       The task area interactive commands are never available  in  alter‐
681       nate-display  mode if the ´current' window's task display has been
682       toggled Off (see topic 4. ALTERNATE-DISPLAY Mode).
683
684
685       APPEARANCE of task window
686         The following commands will also be influenced by the  state  of
687         the global 'B' (bold disable) toggle.
688
689
690         ´b´ :Bold/Reverse_toggle
691              This  command  will  impact how the 'x' and 'y' toggles are
692              displayed.  Further, it will  only  be  available  when  at
693              least one of those toggles is On.
694
695
696         ´x´ :Column_Highlight_toggle
697              Changes highlighting for the current sort field.  You prob‐
698              ably don't need a constant  visual  reminder  of  the  sort
699              field  and top hopes that you always run with 'column high‐
700              light' Off, due to the cost in path-length.
701
702              If you forget which field is being sorted this command  can
703              serve as a quick visual reminder.
704
705
706         ´y´ :Row_Highlight_toggle
707              Changes  highlighting  for "running" tasks.  For additional
708              insight into this task state, see topic 2a. DESCRIPTIONS of
709              Fields, Process Status.
710
711              Use  of this provision provides important insight into your
712              system's health.  The only costs will be a  few  additional
713              tty escape sequences.
714
715
716         ´z´ :Color/Monochrome_toggle
717              Switches  the ´current' window between your last used color
718              scheme and the older form of  black-on-white  or  white-on-
719              black.   This  command will alter both the summary area and
720              task area but does not affect the state of the 'x', 'y'  or
721              'b' toggles.
722
723
724       CONTENT of task window
725         ´c´ :Command_Line/Program_Name_toggle
726              This  command  will be honored whether or not the 'Command'
727              column is currently visible.  Later, should that field come
728              into view, the change you applied will be seen.
729
730         ´f´ and ´o´ :Fields_select or Order_fields
731              These  keys  display  separate screens where you can change
732              which fields are displayed and their order.  For additional
733              information  on  these  interactive  commands see topic 2b.
734              SELECTING and ORDERING Columns.
735
736         ´H´ :Threads_toggle
737              When this toggle is On, all individual threads will be dis‐
738              played.  Otherwise, top displays a summation of all threads
739              in a process.
740
741         ´S´ :Cumulative_Time_Mode_toggle
742              When 'Cumulative mode' is On, each process is  listed  with
743              the cpu time that it and its dead children have used.
744
745              When  Off, programs that fork into many separate tasks will
746              appear less demanding.  For programs like 'init' or a shell
747              this is appropriate but for others, like compilers, perhaps
748              not.  Experiment with two task  windows  sharing  the  same
749              sort field but with different 'S' states and see which rep‐
750              resentation you prefer.
751
752              After issuing this command, you'll be informed of  the  new
753              state  of  this  toggle.   If  you  wish to know in advance
754              whether or not 'Cumulative mode' is in effect,  simply  ask
755              for help and view the window summary on the second line.
756
757         ´u´ :Show_Specific_User_Only
758              You  will be prompted to enter the name of the user to dis‐
759              play.  Thereafter, in that task window only  matching  User
760              ID's will be shown, or possibly no tasks will be shown.
761
762              Later,  if  you  wish  to monitor all tasks again, re-issue
763              this command but just press <Enter> at the prompt,  without
764              providing a name.
765
766       SIZE of task window
767         ´i´ :Idle_Processes_toggle
768              Displays  all tasks or just active tasks.  When this toggle
769              is Off, idled or zombied processes will not be displayed.
770
771              If this command is applied to the last task display when in
772              alternate-display  mode,  then  it will not affect the win‐
773              dow's size, as all prior task displays  will  have  already
774              been painted.
775
776         ´n´ or ´#´ :Set_Maximum_Tasks
777              You  will  be prompted to enter the number of tasks to dis‐
778              play.  The lessor of your number and available screen  rows
779              will be used.
780
781              When  used  in  alternate-display mode, this is the command
782              that gives you precise control over the size of  each  cur‐
783              rently  visible task display, except for the very last.  It
784              will not affect the last window's size, as all  prior  task
785              displays will have already been painted.
786
787              Note:  If you wish to increase the size of the last visible
788              task  display  when  in  alternate-display   mode,   simply
789              decrease the size of the task display(s) above it.
790
791       SORTING of task window
792         For compatibility, this top supports most of the former top sort
793         keys.  Since this is primarily a service to  former  top  users,
794         these commands do not appear on any help screen.
795            command   sorted field                  supported
796              A         start time (non-display)      No
797              M         %MEM                          Yes
798              N         PID                           Yes
799              P         %CPU                          Yes
800              T         TIME+                         Yes
801
802         Before  using any of the following sort provisions, top suggests
803         that you temporarily turn on column highlighting using  the  'x'
804         interactive command.  That will help ensure that the actual sort
805         environment matches your intent.
806
807         The following interactive commands will only be honored when the
808         current sort field is visible.  The sort field might not be vis‐
809         ible because:
810              1) there is insufficient Screen Width
811              2) the 'f' interactive command turned it Off
812
813         ´<´ :Move_Sort_Field_Left
814              Moves the sort column to the left unless the  current  sort
815              field is the first field being displayed.
816
817         ´>´ :Move_Sort_Field_Right
818              Moves  the sort column to the right unless the current sort
819              field is the last field being displayed.
820
821         The  following  interactive  commands  will  always  be  honored
822         whether or not the current sort field is visible.
823
824         ´F´ or ´O´ :Select_Sort_Field
825              These  keys  display a separate screen where you can change
826              which field is used as the sort column.
827
828              If a field is selected which was not previously being  dis‐
829              played,  it  will  be  forced On when you return to the top
830              display.  However, depending upon your screen width and the
831              order  of  your  fields,  this  sort  field may not be dis‐
832              playable.
833
834              This interactive command can be a convenient way to  simply
835              verify the current sort field, when running top with column
836              highlighting turned Off.
837
838         ´R´ :Reverse/Normal_Sort_Field_toggle
839              Using this interactive command you  can  alternate  between
840              high-to-low and low-to-high sorts.
841
842         Note:  Field  sorting  uses internal values, not those in column
843         display.  Thus, the TTY and WCHAN  fields  will  violate  strict
844         ASCII collating sequence.
845
846   3d. COLOR Mapping
847       When  you issue the 'Z' interactive command, you will be presented
848       with a separate screen.  That screen can be  used  to  change  the
849       colors  in just the ´current' window or in all four windows before
850       returning to the top display.
851
852       Available interactive commands
853           4 upper case letters to select a target
854           8 numbers to select a color
855           normal toggles available
856               'B'       :bold disable/enable
857               'b'       :running tasks "bold"/reverse
858               'z'       :color/mono
859           other commands available
860               'a'/'w'   :apply, then go to next/prior
861               <Enter>   :apply and exit
862               'q'       :abandon current changes and exit
863
864       If your use 'a' or 'w' to cycle the targeted window, you will have
865       applied  the  color  scheme  that was displayed when you left that
866       window.  You can, of course, easily return to any window and reap‐
867       ply  different  colors  or turn colors Off completely with the 'z'
868       toggle.
869
870       The Color Mapping screen can also be used to change the  ´current'
871       window/field group in either full-screen mode or alternate-display
872       mode.  Whatever was targeted when 'q' or <Enter> was pressed  will
873       be made current as you return to the top display.
874
875

4. ALTERNATE-DISPLAY Mode

877   4a. WINDOWS Overview
878       Field Groups/Windows:
879              In full-screen mode there is a single window represented by
880              the entire screen.  That single window can still be changed
881              to  display  1  of  4  different  field groups (see the 'G'
882              interactive command, repeated below).  Each of the 4  field
883              groups  has  a  unique separately configurable summary area
884              and its own configurable task area.
885
886              In alternate-display mode, those 4 underlying field  groups
887              can  now  be  made visible simultaneously, or can be turned
888              Off individually at your command.
889
890              The summary area will always exist, even if it's  only  the
891              message  line.  At any given time only one summary area can
892              be displayed.  However, depending on your  commands,  there
893              could be from zero to four separate task displays currently
894              showing on the screen.
895
896       Current Window:
897              The ´current' window is the window associated with the sum‐
898              mary area and the window to which task related commands are
899              always directed.  Since in alternate-display mode  you  can
900              toggle  the  task  display  Off,  some  commands  might  be
901              restricted for the ´current' window.
902
903              A further complication arises when  you  have  toggled  the
904              first  summary  area line Off.  With the loss of the window
905              name (the 'l' toggled line), you'll not  easily  know  what
906              window is the ´current' window.
907
908   4b. COMMANDS for Windows
909         ´-´ and ´_´ :Show/Hide_Window(s)_toggles
910              The  '-'  key  turns the ´current' window's task display On
911              and Off.  When On, that task area will show  a  minimum  of
912              the  columns header you've established with the 'f' and 'o'
913              commands.   It  will  also  reflect  any  other  task  area
914              options/toggles you've applied yielding zero or more tasks.
915
916              The  '_' key does the same for all task displays.  In other
917              words, it switches between the currently visible task  dis‐
918              play(s)  and  any  task display(s) you had toggled Off.  If
919              all 4 task displays are currently visible, this interactive
920              command  will  leave  the  summary area as the only display
921              element.
922
923       * ´=´ and ´+´ :Equalize_(re-balance)_Window(s)
924              The '=' key forces the ´current' window's task  display  to
925              be  visible.  It also reverses any 'i' (idle tasks) and 'n'
926              (max tasks) commands that might be active.
927
928              The '+' key does the same for all windows.  The  four  task
929              displays  will  reappear,  evenly balanced.  They will also
930              have  retained  any  customizations  you   had   previously
931              applied,  except  for  the  'i'  (idle  tasks) and 'n' (max
932              tasks) commands.
933
934       * ´A´ :Alternate_Display_Mode_toggle
935              This command  will  switch  between  full-screen  mode  and
936              alternate-display mode.
937
938              The  first  time you issue this command, all four task dis‐
939              plays will be shown.  Thereafter when you switch modes, you
940              will  see  only  the  task display(s) you've chosen to make
941              visible.
942
943       * ´a´ and ´w´ :Next_Window_Forward/Backward
944              This will  change  the  ´current'  window,  which  in  turn
945              changes  the  window to which commands are directed.  These
946              keys act in a circular fashion so you can reach any desired
947              ´current' window using either key.
948
949              Assuming  the  window name is visible (you have not toggled
950              'l' Off), whenever the  ´current'  window  name  loses  its
951              emphasis/color,  that's  a reminder the task display is Off
952              and many commands will be restricted.
953
954       * ´G´ :Choose_Another_Window/Field_Group
955              You will be prompted to enter a number between 1 and 4 des‐
956              ignating  the  window/field  group which should be made the
957              ´current' window.
958
959              In full-screen mode, this command is necessary to alter the
960              ´current'  window.  In alternate-display mode, it is simply
961              a less convenient alternative to the 'a' and 'w' commands.
962
963         ´g´ :Change_Window/Field_Group_Name
964              You will be prompted for a new name to be  applied  to  the
965              ´current' window.  It does not require that the window name
966              be visible (the 'l' toggle to be On).
967
968       *  The interactive commands shown with an asterisk ('*') have  use
969          beyond alternate-display mode.
970              ´=', 'A', 'G'  are always available
971              ´a', 'w'       act the same when color mapping
972
973

5. FILES

975   5a. SYSTEM Configuration File
976       The  presence  of  this  file  will influence which version of the
977       'help' screen is shown to an ordinary user.  More importantly,  it
978       will  limit what ordinary users are allowed to do when top is run‐
979       ning.  They will not be able to issue the following commands.
980          k         Kill a task
981          r         Renice a task
982          d or s    Change delay/sleep interval
983
984       The system configuration file is not created by top.  Rather,  you
985       create this file manually and place it in the /etc directory.  Its
986       name must be 'toprc' and must have no leading  '.'  (period).   It
987       must have only two lines.
988
989       Here is an example of the contents of /etc/toprc:
990          s         # line 1: 'secure' mode switch
991          5.0       # line 2: 'delay'  interval in seconds
992
993   5b. PERSONAL Configuration File
994       This  file is written as '$HOME/.your-name-4-top' + 'rc'.  Use the
995       'W' interactive command to create it or update it.
996
997       Here is the general layout:
998          global    # line 1: the program name/alias notation
999            "       # line 2: id,altscr,irixps,delay,curwin
1000          per ea    # line a: winname,fieldscur
1001          window    # line b: winflags,sortindx,maxtasks
1002            "       # line c: summclr,msgsclr,headclr,taskclr
1003
1004       If the $HOME variable is not present, top will try  to  write  the
1005       personal  configuration  file to the current directory, subject to
1006       permissions.
1007
1008

6. STUPID TRICKS Sampler

1010       Many of these 'tricks' work best when you give  top  a  scheduling
1011       boost.  So plan on starting him with a nice value of -10, assuming
1012       you've got the authority.
1013
1014   6a. Kernel Magic
1015       For these stupid tricks, top needs full-screen mode.
1016
1017       -*-  The user interface, through prompts and  help,  intentionally
1018            implies  that  the  delay  interval is limited to tenths of a
1019            second.  However, you're free to set any desired  delay.   If
1020            you  want to see Linux at his scheduling best, try a delay of
1021            .09 seconds or less.
1022
1023            For this experiment, under x-windows open an xterm and  maxi‐
1024            mize it.  Then do the following:
1025              . provide a scheduling boost and tiny delay via:
1026                  nice -n -10 top -d.09
1027              . keep sorted column highlighting Off to minimize
1028                path length
1029              . turn On reverse row highlighting for emphasis
1030              . try various sort columns (TIME/MEM work well),
1031                and normal or reverse sorts to bring the most
1032                active processes into view
1033
1034            What  you'll  see is a very busy Linux doing what he's always
1035            done for you, but there was no program  available  to  illus‐
1036            trate this.
1037
1038       -*-  Under  an  xterm  using  'white-on-black' colors, try setting
1039            top's task color to black and be sure that task  highlighting
1040            is  set to bold, not reverse.  Then set the delay interval to
1041            around .3 seconds.
1042
1043            After bringing the most  active  processes  into  view,  what
1044            you'll  see are the ghostly images of just the currently run‐
1045            ning tasks.
1046
1047       -*-  Delete the existing rcfile, or create a new  symlink.   Start
1048            this  new  version then type 'T' (a secret key, see topic 3c.
1049            TASK  Area  Commands,  Sorting)  followed  by  'W'  and  'q'.
1050            Finally, restart the program with -d0 (zero delay).
1051
1052            Your display will be refreshed at three times the rate of the
1053            former top, a 300% speed advantage.  As top climbs  the  TIME
1054            ladder, be as patient as you can while speculating on whether
1055            or not top will ever reach the top.
1056
1057   6b. Bouncing Windows
1058       For these stupid tricks, top needs alternate-display mode.
1059
1060       -*-  With 3 or 4 task displays visible, pick any window other than
1061            the last and turn idle processes Off.  Depending on where you
1062            applied 'i', sometimes several task displays are bouncing and
1063            sometimes  it's  like  an accordion, as top tries his best to
1064            allocate space.
1065
1066       -*-  Set each window's summary lines differently: one with no mem‐
1067            ory;  another  with no states; maybe one with nothing at all,
1068            just the message line.  Then hold down 'a' or 'w' and watch a
1069            variation on bouncing windows  --  hopping windows.
1070
1071       -*-  Display  all  4  windows and for each, in turn, set idle pro‐
1072            cesses to Off.  You've  just  entered  the  "extreme  bounce"
1073            zone.
1074
1075   6c. The Big Bird Window
1076       This stupid trick also requires alternate-display mode.
1077
1078       -*-  Display  all  4 windows and make sure that 1:Def is the ´cur‐
1079            rent' window.  Then, keep increasing window  size  until  the
1080            all the other task displays are "pushed out of the nest".
1081
1082            When  they've  all  been  displaced, toggle between all visi‐
1083            ble/invisible windows.  Then ponder this:
1084               is top fibbing or telling honestly your imposed truth?
1085
1086

7. BUGS

1088       Send bug reports to:
1089          Albert D. Cahalan, <albert@users.sf.net>
1090
1091       The top command calculates Cpu(s) by looking at the change in  CPU
1092       time values between samples. When you first run it, it has no pre‐
1093       vious sample to compare to, so these initial values are  the  per‐
1094       centages  since  boot. It means you need at least two loops or you
1095       have to ignore summary output from the first loop.  This is  prob‐
1096       lem  for example for batch mode. There is a possible workaround if
1097       you define the CPULOOP=1 environment  variable.  The  top  command
1098       will  be  run  one  extra hidden loop for CPU data before standard
1099       output.
1100

8. HISTORY Former top

1102       The original top was written  by  Roger  Binns,  based  on  Branko
1103       Lankester's <lankeste@fwi.uva.nl> ps program.
1104
1105       Robert  Nation <nation@rocket.sanders.lockheed.com> adapted it for
1106       the proc file system.
1107
1108       Helmut Geyer  <Helmut.Geyer@iwr.uni-heidelberg.de>  added  support
1109       for configurable fields.
1110
1111       Plus many other individuals contributed over the years.
1112
1113

9. AUTHOR

1115       This entirely new and enhanced replacement was written by:
1116          Jim / James C. Warner, <warnerjc@worldnet.att.net>
1117
1118       With invaluable help from:
1119          Albert D. Cahalan, <albert@users.sf.net>
1120          Craig Small, <csmall@small.dropbear.id.au>
1121
1122

10. SEE ALSO

1124       free(1), ps(1), uptime(1), atop(1), slabtop(1), vmstat(8), w(1).
1125
1126
1127
1128
1129
1130
1131Linux                         September 2002                       TOP(1)
Impressum