Top command
From NetworkCommands
A command available on most Linux platforms; used to monitor and display dynamic, real-time system tasks and processes.
Contents |
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
Usage Examples
top
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)
Usage Notes
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
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;
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
Related Files
The top executable is normally found here: /usr/bin/top
Related Commands
Command Equivalents
The Cisco command equivalent is the show processes command
The F5 BigIP command equivalent is the bigtop command
Related Articles
Information on other Linux commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on F5 BigIP commands
Information on Zebra commands
Information on Secure Platform commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands







