Log in Go to the main page Page Discussion History Go to the file list Go to the site toolbox

Top command

From NetworkCommands


Image:Tux_64x64.png

A command available on most Linux platforms; used to monitor and display dynamic, real-time system tasks and processes.

Contents

Image:Vm-power-on-medium.png Usage Syntax

top [options]

Common options include;

  • -ppid[, pid, pid...] - only monitor and display the process or processes specified
  • -u (uid | username) - only monitor and display processes running with the effective specified UID or username
  • -U (uid | username) - only monitor and display processes running with the real, saved, file system or effective specified UID or username
  • -d seconds - specify the number of seconds between top display updates (the default is 3s)
  • -n number - specify the number of iterations top should display before ending

Image:Vm-power-on-medium.png Usage Examples

top

Image:Preferences-desktop-keyboard-shortcuts-medium.png Interactive Functions

Before I list the majority of the available interactive top commands, here's a quick list of the most useful;

  • < - Move sort field one column to the left
  • > - Move sort field one column to the right
  • R - Reverse sort order
  • [SPACE] - Refresh display
  • B - Bold enable
  • z - color/mono

Sorting Columns

  • < - Move sort field one column to the left
  • > - Move sort field one column to the right
  • R - Reverse sort order

Display

  • [SPACE] - Refresh display
  • [ENTER] - Refresh display
  • A - Alternative display
  • d or s - Set delay time
  • B - Bold enable

Summary Area

All these summary area information rows are on by default;

  • l - Load Avg/Uptime - On by default
  • t - Task/Cpu states - On by default
  • m Mem/Swap usage - On by default
  • 1 - Single Cpu - On by default

Task Area

  • b - Bold hilite On (not ’reverse’)
  • c - Command line Off (name, not cmdline)
  • H - Threads Off (show all threads)
  • i - Idle tasks On (show all tasks)
  • R - Reverse sort On (pids high-to-low)
  • S - Cumulative time Off (no, dead children)
  • x - Column hilite Off (no, sort field)
  • y - Row hilite On (yes, running tasks)
  • z - color/mono Off (no, colors)


Image:accessories-text-editor-v2-medium.png Usage Notes

Image:accessories-text-editor-v2-medium.png Linux Usage Notes

With most Linux or Unix commands;

  • Brief help can be displayed using the option/keyword: -h or --help, for example: chmod --help
  • A full command manual can be displayed using the man command followed by the command name, for example: man chmod
  • Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
  • Version information can be display using the option/keyword: -v or --version, for example: chmod --version


Image:Hitori-medium.png Equivalent Information via SNMP

Some or all of the information displayed by this command can be obtained via SNMP using the the MIB(s) and OID(s) detailed below along with retrieval examples using commands from the popular net-snmp application suite;


Image:utilities-terminal-medium.png Typical Output

Cpu(s):  2.9%us,  0.8%sy,  0.0%ni, 92.9%id,  1.1%wa,  1.1%hi,  1.1%si,  0.0%st
Mem:   1034172k total,  1017740k used,    16432k free,    29688k buffers
Swap:  3028212k total,    39744k used,  2988468k free,   639736k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
 6225 steve     20   0 50804  23m 8360 S    6  2.4   8:05.62 transmission       
 5488 root      20   0  310m  31m 9564 S    1  3.2   1:34.50 Xorg               
 5092 messageb  20   0  2900 1392  792 S    1  0.1   0:04.64 dbus-daemon        
 5292 haldaemo  20   0  6312 4332 3584 S    1  0.4   0:04.04 hald               
12806 steve     20   0  2308 1116  852 R    1  0.1   0:00.08 top                
    1 root      20   0  2844 1688  544 S    0  0.2   0:01.40 init               
    2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd           
    3 root      RT  -5     0    0    0 S    0  0.0   0:00.04 migration/0        
    4 root      15  -5     0    0    0 S    0  0.0   0:00.38 ksoftirqd/0        
    5 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/0         
    6 root      RT  -5     0    0    0 S    0  0.0   0:00.02 migration/1        
    7 root      15  -5     0    0    0 S    0  0.0   0:00.32 ksoftirqd/1        
    8 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/1         
    9 root      15  -5     0    0    0 S    0  0.0   0:00.06 events/0           
   10 root      15  -5     0    0    0 S    0  0.0   0:00.08 events/1           
   11 root      15  -5     0    0    0 S    0  0.0   0:00.00 khelper            
   46 root      15  -5     0    0    0 S    0  0.0   0:00.12 kblockd/0  

Image:Folder-medium.png Related Files

The top executable is normally found here: /usr/bin/top

Image:icemon-medium.png Related Commands

Image:object-flip-horizontal-medium.png Command Equivalents

The Cisco command equivalent is the show processes command Image:Cisco-logo-small.png

The F5 BigIP command equivalent is the bigtop command Image:F5-logo-small.png

Image:icemon-medium.png Related Articles

Information on other Linux commands Image:Tux-small.png

Information on Cisco commands Image:Cisco-logo-small.png

Information on Vyatta commands Image:Vyatta-logo-small.png

Information on Extreme commands Image:Extreme-logo-small.png

Information on F5 BigIP commands Image:F5-logo-small.png

Information on Zebra commands

Information on Secure Platform commands

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Image:internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)



Site Toolbox:

Personal tools
This page was last modified on 13 September 2008, at 18:04. - This page has been accessed 12 times. - Disclaimers - About NetworkCommands
Powered by MediaWiki