Unix Top
  Disclaimer Y2K Lists About FAQ Download Documentation Main Menu

Top is a program that will give continual reports about the state of the system, including a list of the top cpu using processes. Version 3 of "top" has three primary design goals:

  • provide an accurate snapshot of the system and process state,
  • not be one of the top processes itself,
  • be as portable as possible.

Top was originally inspired by a VMS command which listed the top five busiest processes along with a bargraph of their utilization. The VMS command showed nothing besides the process name and cpu percentage. When I decided to adapt the idea for Unix, I knew that the output had to be as rich in information as ps.

The first version of top was completed in the early part of 1984. At that time it only supported one system: a VAX running BSD 4.1. Version 1 used the curses screen management package. When it became apparent that top was always appearing at or near the top of the display, I decided that I had to find ways to cut CPU overhead. Version 2 , released in September of 1986, had its own screen management code that used termcap directly. With curses out of the picture, top became significantly more efficient.

Top displays information about a system and the processes that it is running. By default, the processes are sorted by percentage of cpu utilization. The display is updated at regular intervals to reflect the current state of the system. Top is a handy tool for helping to determine what a system is doing.

The following diagram shows sample output from a system running Solaris 2.5.1:

Top output


In order to gather information about the system, top requires read access to the device files /dev/kmem and /dev/mem. These files provide direct access to the kernel's memory spaces. A few platforms have other mechanisms to retrieve this information which do not require direct access to these devices, and top will utilize such mechanism on systems where they are available. However, on most systems top will need to be installed with sufficient privilege to read from /dev/kmem and /dev/mem . This usually requires installing the top executable with either set-user-id to root or set-group-id to a group like sys.


Compilation and Installation

Top comes with a gnu configuration script called configure. This script takes a few customization options which you can see by running "./configure --help". For most situations, simply running "./configure" without options will generate the necessary files to make top. Follow it with a simple "make" and you should be rewarded with a running executable. You can install that executable with "make install". Installation usually needs to be done by root.

Top is very sensitive to changes in the data structures maintained by the kernel. Typically an executable created under one version of the operating system will not run successfully on any other version. On operating systems with a variety of hardware platforms (such as Sun's sun4m, sun4d, and sun4u platforms), a separate executable may need to be created for each platform type. When a machine is upgraded to a newer version of the operating system, top should be recompiled and reinstalled.



The official home for top is on sourceforge as the project named unixtop. All recent releases are available for downloading there, as well as access to the subversion repository.

The download section has details on how one can obtain the source package for top from sites other than sourceforge.



My perpetual thanks to all the people who have helped me support top on so many platforms. Without these people, top would not be what it is. Here is a partial list of contributors and other individuals:

Anthony Baxter, Robert Boucher, Sandeep Cariapa, Marc Cohen, David S. Comay, David Cutter, Erik Deumens, Casper Dik, John Haxby, Charles Hedrick, Arne Helme, Richard Henderson, Andrew Herbert, Steve Hocking, Rich Holland, Mike Hopkirk, Jeff Janvrin, William L. Jones, Claus Kalle, Torsten Kasch, moto kawasaki, Petri Kutvonen, Marty LeFebvre, David MacKenzie, Brett McCoy, Jeff Polk, Tim Pugh, Steve Scherf, Kevin Schmidt, Wolfram Schneider, Alex A. Sergejew, Gregory Shilin, Daniel Trinkle, Joep Vesseur, Warren Vosper, Steven Wallace, Pat Welch, Jeff White, Mike Williams, Phillip Wu, Christos Zoulas.



Top is written and maintained by William LeFebvre.