top (table of processes) - a console command that displays a list of processes running in the system and information about them. By default, it sorts them in real time by processor load. The program is written for UNIX- compatible operating systems and published under the free GNU FDL license.
| top | |
|---|---|
top output in terminal | |
| Type of | System Process Monitor |
| operating system | Cross-platform software |
| License | GNU GPL |
| Site | procps.sourceforge.net |
The program is often used by system administrators. Alternatives to the top program for GNU / Linux are the atop and htop utilities.
Content
Example
last pid: 34218; load averages: 0.65, 0.36, 0.29 up 0 + 11: 38: 05 16:30:36 3 processes: 1 running, 2 sleeping Mem: 82M Active, 93M Inact, 438M Wired, 112K Cache, 112M Buf, 1390M Free Swap: 2048M Total, 2048M Free PID USERNAME THR PR NICE SIZE RES STATE C TIME WCPU COMMAND 23805 root 1 106 10 6080K 3128K select 3 0:01 0.00% sshd 23806 root 1 8 10 3136K 2008K wait 2 0:00 0.00% bash 34218 root 1 106 10 2160K 1376K CPU2 0 0:00 0.00% top
Work with the program
The program with a refresh rate of 2s shows the current activity of the processes in the form of a table. Standard speakers:
- PID - process identifier
- USERNAME - the user the process is running from
- THR - the number of threads started by the process
- PR - current process priority
- NICE is the priority set by nice . From −20 (highest) to 19.
- SIZE - process size (data, stack, etc.) in kilobytes
- RES - current memory usage
- STATE - current state ("START", "RUN" (only in this state shows the current program load on the processor), "SLEEP", "STOP", " ZOMB ", "WAIT" or "LOCK")
- C - the number of the processor on which execution is in progress (available only on SMP systems)
- TIME - CPU usage time in seconds
- VIRT - the total amount of virtual memory that the process takes
- % CPU - percentage of available processor time that the running program used
- % MEM - percentage of RAM used by this process
- WCPU - average CPU value
- COMMAND - the command that started the process.
To exit top, press the [q] key.
Useful interactive commands that you can use in top:
- [1] Show all statistics for all cores.
- [c] Absolute path to the location of the team module and its arguments.
- [h] Show help about the program.
- [k] Destroy the process. The program asks you for the process code and a signal that will be sent to it.
- [M] Sort by the amount of memory used.
- [n] Change the number of displayed processes. You are prompted to enter a number.
- [P] Sort by processor load.
- [r] Change the priority of the process.
- [u] Sort by username.
- [Z] Select backlight color.
- [z] Highlight running processes.
- [Space] Update screen contents immediately.
Abbreviated output:
# top -SIt
last pid: 9262; load averages: 0.13, 0.40, 0.36 up 2 + 09: 16: 14 22:13:43
103 processes: 1 running, 88 sleeping, 14 waiting
CPU states:% user,% nice,% system,% interrupt,% idle
Mem: 31M Active, 136M Inact, 61M Wired, 3212K Cache, 34M Buf, 12M Free
Swap: 1024M Total, 30M Used, 994M Free, 2% Inuse
PID USERNAME THR PR NICE SIZE RES STATE TIME WCPU COMMAND
11 root 1 171 ki31 0K 8K RUN 44.7H 76.27% idle
14 root 1 -44 - 0K 8K WAIT 16:30 14.65% swi1: net
1277 verlihub 1 8 0 12916K 5780K nanslp 69:52 2.00% verlihub
1028 root 1 8 0 3104K 504K nanslp 55:25 1.42% monitord
27 root 1 -68 - 0K 8K - 187: 25 0.39% dummynet
- l - hide / show the line with the average value of the load.
- t - hide / show the line with the status of the CPU processors.
- m - hide / show lines 4 and 5 with information about the state of memory.
- -S Show system processes. Usually, system processes such as: pager or swapper are not shown. This option will make them visible.
Processor Status
- us - (User CPU time) time spent on user programs
- sy - (System CPU time) time spent on kernel processes
- ni - (Nice CPU time) time spent working with programs with a changed priority
- id - idle processor
- wa - (iowait) time spent completing I / O
- hi - (Hardware IRQ) time spent processing hardware interrupts
- si - (Software Interrupts) time spent working on processing software interrupts (network)
- st - (Steal Time) time "stolen" by the hypervisor from this virtual machine for other tasks (for example, the operation of another virtual machine) or # top -SIt
last pid: 9262; load averages: 0.13, 0.40, 0.36 up 2 + 09: 16: 14 22:13:43 103 processes: 1 running, 88 sleeping, 14 waiting CPU states:% user,% nice,% system,% interrupt,% idle Mem : 31M Active, 136M Inact, 61M Wired, 3212K Cache, 34M Buf, 12M Free Swap: 1024M Total, 30M Used, 994M Free, 2% Inuse
PID USERNAME THR PR NICE SIZE RES STATE TIME WCPU COMMAND 11 root 1 171 ki31 0K 8K RUN 44.7H 76.27% idle 14 root 1 -44 - 0K 8K WAIT 16:30 14.65% swi1: net 1277 verlihub 1 8 0 12916K 5780K nanslp 69:52 2.00% verlihub 1028 root 1 8 0 3104K 504K nanslp 55:25 1.42% monitord 27 root 1 -68 - 0K 8K - 187: 25 0.39% dummynet
History
The top program was created following the example of a program for the VMS operating system. William LeFevre, a student at Rice University , wrote the first similar program in April 1984 for the BSD 4.1 operating system. It was released under the BSD license , which affected the fact that the program was included in many proprietary BSD and UNIX operating systems.
Top has been ported to various operating systems many times, and under different licenses. A program like top was introduced on the AIX 4.3 operating system in 1999 under the name topas .
The first top program was written by Roger Binns. Most modern GNU / Linux distributions include top written by S. Warner and included in the procps package.
See also
- htop
- atop
- Conky