The Linux “top” utility

Monitoring a Linux Server with the Top Utility  (A Linux Tool like the Windows Task Manager)

One of the most useful utilities for monitoring load on a Linux system, is "top".  This is a text based display, so it is available remotely via a telnet session.

What top does, is display a list of active processes.  The list is limited to the size of the screen, it does not scroll off.  It is useful in that the list can be sorted by many different criteria.  Usually, I set it to sort by CPU usage, or the total time that the CPU has used for the process.  The output is sorted in descending order, so the highest CPU usage, for example, will be at the top of the list.  This makes it easy to spot a process that is hogging the CPU.

The "i" option is one that is very handy.  It toggles the "ignore" flag.  When the "ignore" flag is on, only processes that are currently running are displayed.  If a process is sleeping, or waiting for input, it is not displayed.  So, the result is a list of what is actively using resources.

Additionally, the top of the screen shows more useful information.  The 1, 5, and 15 minute average server loads are displayed.  The memory usage shows physical memory, and swap memory.  When memory is written to swap, or read from swap, it shows that occurring also.  With this, I can see that swapping is actively occurring.  While it may be a transient issue, it also is an indication that either more RAM needs to be added to the server, or processes re-configured to use less memory.

Other useful information can be obtained by sorting on memory usage.  Both the amount of resident memory, and the total memory, can be displayed for a process.  Sorting on these fields, gives a list of the processes that are using the most memory.

There is a help screen that does a good job of explaining the options.  Just hit "H" after starting top.  

There is a lot of useful information that can be found with the top utility.  It is definitely worth a few minutes to install it, and familiarize yourself with it, if you are running a Linux system.



Leave a Reply