Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Top (software)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Task manager program found in many Unix-like operating systems}} {{lowercase}} {{Infobox software | name = top | screenshot = BSD-unix-top-plain.png | screenshot size = 300px | author = William LeFebvre | developer = | released = {{Start date and age|1984}} | latest release version = | latest release date = | genre = Process viewer / [[System monitor]] | license = | website = hide | operating_system = [[Unix-like]] | programming_language = [[C (programming language)|C]] }} '''top''' is a [[task manager]] or [[system monitor]] program, found in many [[Unix-like]] operating systems, that displays information about [[central processing unit|CPU]] and memory utilization. ==Overview== The program produces an ordered list of running processes selected by user-specified criteria, and updates it periodically. Default ordering is by CPU usage, and only the top CPU consumers are shown (hence the name). top shows how much processing power and memory are being used, as well as other information about the running processes. Some versions of top allow extensive customization of the display, such as choice of columns or sorting method. top is useful for [[system administrator]]s, as it shows which users and processes are consuming the most system resources at any given time. [[File:Top-with-altered-settings.png|thumb|top on Linux with altered preferences for better view]] ==Implementations== There are several different versions of top. The traditional Unix version was written by William LeFebvre and originally copyrighted in 1984.<ref>{{Cite web|url=http://www.unixtop.org/license.shtml|archive-url=https://web.archive.org/web/20080413180808/http://www.unixtop.org/license.shtml|url-status=dead|archive-date=2008-04-13|title=Documentation|website=Unix Top|access-date=2016-05-22}}</ref> It is hosted on [[SourceForge]],<ref>{{Cite web|url=http://www.unixtop.org/faq.shtml#title1|archive-url=https://web.archive.org/web/20040420005914/http://www.unixtop.org/faq.shtml#title1|url-status=dead|archive-date=2004-04-20|title=About Top|last=LeFebvre|first=William|date=2014-09-16|website=Unix Top|access-date=2016-05-22}}</ref> and release 3.7 was announced in 2008.<ref>{{Cite web|url=https://sourceforge.net/p/unixtop/news/?source=navbar|title=Top / News|website=SourceForge|access-date=2016-05-22}}</ref> The Linux version of top is part of the [[procps-ng]] group of tools. It was originally written by Roger Binns<ref>{{Cite web|url=http://linux.die.net/man/1/top|title=top(1): tasks - Linux man page|website=Linux Documentation|access-date=2016-05-22}}</ref> and released in early 1992 but shortly thereafter taken over by others.<ref>{{Cite web|url=http://www.rogerbinns.com/blog/linux-top-origins.html|title=Linux Top Origins {{!}} Roger's world|last=Binns|first=Roger|website=Roger's world|access-date=2016-05-22}}</ref> On [[Solaris (operating system)|Solaris]], the roughly equivalent program is prstat. [[Microsoft Windows]] has the [[tasklist]] command and the graphical [[Task Manager (Windows)|Task Manager]] utility. [[IBM AIX]] has an updating running processes list as part of the topas and [[topas_nmon]] commands. The load average numbers in Linux refers to the sum of the number of processes waiting in the run-queue plus the number currently executing. The number is absolute, not relative. And thus it can be [[Bounded function|unbounded]]; unlike utilization. The instant variations of the number of processes are [[Damping ratio|damped]] with an [[exponential decay]] formula which is calculated using [[Fixed-point arithmetic|fixed point]] math.<ref name="tq_ldavg2">{{cite web|url=http://www.teamquest.com/pdfs/whitepaper/ldavg2.pdf|title=UNIX Load Average Part 2: Not Your Average Average|last=J. Gunther|first=Neil|year=2010|publisher=teamquest.com|accessdate=2013-06-10|archive-url=https://web.archive.org/web/20120602093128/http://www.teamquest.com/pdfs/whitepaper/ldavg2.pdf|archive-date=2012-06-02|url-status=dead}}</ref> The [[ps (Unix)|ps]] program is similar to top, but instead produces a snapshot of processes taken at the time of invocation. top's {{mono|n}} (number of iterations) option can product a similar result, causing the program to run the specified number of iterations, then exit after printing its output. == Example == The first 5 rows overview the entire system. <syntaxhighlight lang="text"> top - 14:21:23 up 2 days, 21:40, 44 users, load average: 14.44, 14.13, 14.64 | | | | <time> <system uptime> <user count> <load average for the past 1, 5, 15 minutes> Tasks: 1552 total, 8 running, 1544 sleeping, 0 stopped, 0 zombie %Cpu(s): 9.6 us, 0.7 sy, 0.0 ni, 89.5 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st | | | | | | | '------. <user> <system> <nice> <idle> <IOWait> <hardware/software interrupt> <steal time> MiB Mem : 1031911.+total, 368915.2 free, 172285.0 used, 490711.5 buff/cache MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 807110.1 avail Mem </syntaxhighlight> <code>[[Load (computing)|load average]]</code> is the exponential moving average of the run-queue length over the past 1/5/15 minutes. The run-queue includes both processes being run and waiting to be run. At complete utilization with no task switching, the load average is equal to the number of CPUs.<ref name="drdobbs">{{cite web |last=Walker |first=Ray |date=1 December 2006 |title=Examining Load Average |url=http://www.linuxjournal.com/article/9001 |access-date=13 March 2012 |work=Linux Journal}}</ref> <code>Tasks</code> counts the processes their statuses. <code>%Cpu(s)</code> counts the percentage of CPU usage, broken down into categories. <code>MiB Mem</code>: Memory usage in units of [[mebibyte]]. The <code>buff/cache</code> is for memory used by [[Registered memory|buffers]] and [[Cache (computing)|cache]]. <code>MiB Swap</code>: Swap space usage in units of [[mebibyte]]. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. In this snapshot, there's a total of 2048 MiB of swap, all free, indicating that no swapping is occurring, which is good for performance. <code>avail Mem</code>: The amount of memory available for new applications, without swapping. This considers not just the unused RAM, but also the memory that can be reclaimed from RAM caches. The rest of the text provides a table with each row being a [[Process (computing)|process]], with the following columns often used out of many possible columns (the choice and ordering of columns are configurable):<ref>[https://gitlab.com/procps-ng/procps/-/blob/master/man/top.1?ref_type=heads top(1) - Linux man page]</ref> <syntaxhighlight lang="text"> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 2456 1612 1500 S 0.0 0.0 0:00.07 init(Ubuntu) 4 root 20 0 2456 4 0 S 0.0 0.0 0:00.00 init 656403 user2 20 0 80.0g 3.6g 370000 S 100.0 0.4 1594:38 python3 2024198 longnam+ 20 0 50.5g 4.7g 609200 S 1.6 0.5 204:46.85 long-name-proc 2056804 longnam+ 20 0 237.1g 31.1g 23.1g S 136.8 3.1 69:54.11 python3 </syntaxhighlight> * <code>PID</code>: [[Process identifier|Process ID]], a unique number identifying each running process. * <code>USER</code>: The [[User (computing)|user]] who started the process. If the username is too long, it is cut-off with a <code>+</code> at the end. * <code>PR</code>: Real-time [[Scheduling (computing)|priority]] of the task, computed by the system scheduler. ''Lower'' PR numbers are considered more important by the scheduler and more likely to be scheduled, which means it tends to have more CPU-time per real-time. * <code>NI</code>: The [[Nice (Unix)|''niceness'']] of the task, manually set by users and administrators to influence the real-time priority. A lower nice value tends to favor the process, and a higher nice value tends to disfavor the process. It ranges from -20 (most favored) to 19 (least favored). * <code>VIRT</code>: [[Virtual memory]] size of the process. This includes all memory that the process can access, including memory that is swapped out, memory that is allocated but not used, and shared memory. * <code>RES</code>: [[Resident set size]], the portion of a process's memory that is held in RAM. Compared with <code>VIRT</code>, this excludes memory that is swapped out, not yet used, or shared. * <code>SHR</code>: [[Shared memory]] size: how much of the RAM claimed by the process is sharable with other processes. * <code>S</code>: Status of process. The status can be: ** <code>R</code> for running ** <code>S</code> for sleeping ** <code>I</code> for idle ** <code>D</code> for disk sleep (uninterruptible) ** <code>Z</code> for [[Zombie process|zombie]] (terminated but not reaped by its parent) ** <code>T</code> for stopped by a [[Job control (Unix)|job control signal]] or <code>t</code> for stopped by [[debugger]] during [[Tracing (software)|tracing]]. * <code>%CPU</code>: The percentage of the CPU time that the process is currently using. * <code>%MEM</code>: The percentage of the physical RAM used by the process. * <code>TIME+</code>: The total CPU time the task has used since it started. This is shown in <code>minutes:seconds</code> . The plus sign in <code>TIME+</code> means that it is accurate to 0.01 second. If it shows <code>TIME</code> then it is accurate to 1 second. * <code>COMMAND</code>: The command line argument that started the process. Unlike <code>USER</code> , if the command is too long, it is cut-off without a <code>+</code> at the end. ==See also== {{columns-list|colwidth=35em| * [[Bmon]] bandwidth monitoring for Linux * [[htop]] interactive system-monitor for Linux * [[iftop]] * [[LatencyTOP]] * [[mpstat]] * [[nmon]] system-monitor for AIX and Linux * [[ntop]] * [[PowerTOP]] * [[sar (Unix)]] }} ==References== {{Reflist}} ==External links== {{Commons category|Top (software)}} * {{man|1|top|FreeBSD}} * {{man|1|top|OpenBSD}} * {{man|1|top|Linux}} * {{Cite web |title=Decoded: The top utility (procps) |url=http://www.maizure.org/projects/decoded-top-procps/ |access-date=2024-02-11 |website=www.maizure.org |language=en-US}}. A deep dive into the mechanics of <code>top</code>. * * {{Cite web |last=James |first=Hayden |date=2019-09-18 |title=How to customize the Linux top command |url=https://www.redhat.com/sysadmin/customize-top-command |access-date=2024-02-11 |website=www.redhat.com |language=en}} {{Unix commands}} [[Category:Console applications]] [[Category:Unix process- and task-management-related software]] [[Category:System administration]] [[Category:System monitors]] [[Category:Task managers]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Columns-list
(
edit
)
Template:Commons category
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Mono
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Template other
(
edit
)
Template:Unix commands
(
edit
)