Three System Monitoring Tools to Supplement top
By Gary Sims / Feb 10, 2014 / Linux
The Linux "top" command is often the go to tool for system administrators who need to check on the health of a system. It displays essential system information like CPU load, memory usage, swap usage and a list of the top processes on one convenient, live screen. While "top" is good, there are also some other system monitoring tools which can supplement it and provide extra information for those monitoring the health of a Linux system. Among these other system tools are "htop", "iotop" and "glances".
As its name implies, the "htop" command is very similar to "top", but rather than displaying the process list as a simple text output, that is limited by the size of the terminal, "htop" uses ncurses (a library for building text based user interfaces) and which allows horizontal and vertical scrolling. It also adds a bit of color! If you don't have "htop" already installed on your machine, then for Ubuntu use:
sudo apt-get install htop
To start "htop" simply type:
The top of the screen shows a simple text based bar chart of the CPU, memory and swap usage along with some miscellaneous information like the system uptime. Below this is the list of processes running on the system, sorted by CPU usage. You can scroll this list up and down and left and right (to see the full list of arguments for the processes) using the cursor keys. Page Up and Page Down also work. To change the sort criteria, press "M" to sort by memory and "T" to sort by time. Using "P" will revert to sorting by CPU usage. Note that the commands are case sensitive and that "P", "M" and "T" are all uppercase.
You can also select any given process by scrolling up and down and you can interact with the process using "k" (to kill the process), "i" (to set its IO priority) and "l" to list the files opened by that process. If you started htop with sudo, you can use "[" or "]" to change the scheduling priority of a process using nice. For more information, use "h" to display the help.
iotop
The "iotop" command is "top" for IO (Input and Output) operations rather than CPU usage and memory. It is useful to monitor which processes are reading and writing to the disk but which may not be using much CPU time. The performance of certain services like web servers or databases can be reduced when they become IO bound without necessarily being limited by the CPU or amount of available memory.
To install it on Ubuntu use:
sudo apt-get install iotop
And to launch it, use:
sudo iotop
The first two lines of "iotop" show the disk read and write bandwidth being used by the system and then it lists the processes, ordered of IO usage. You can change the sort order by using the left and right cursor keys. The current sort column is show in bold. Use "r" to reverse the sort order from descending to ascending. Use "a" to change the disk read and write columns to accumulated IO (rather than current IO) and use "o" to reduce the list of processes to only those that are actually doing any IO.
"glances" builds on the ideas of "top", "htop" and "iotop" and aims to display the maximum amount of information in the minimum of space. As well as showing the current process list (sorted by CPU usage), it also shows the current network bandwidth, disk IO bandwidth and the disk space usage on the mounted file systems.
To install "glances" on Ubuntu, use:
sudo apt-get install glances
"glances" uses color coding to flag resources that are becoming limited. For example, when a process starts to consume too much CPU, it will be flagged. The process list can be sorted by memory usage and by IO rate by pressing "m" and "i" respectively.
From self-managed servers for web hosting to Linux servers in a small home or office, system monitoring is a essential part of any system administrators job and tools like "htop", "iotop" and "glances" can supplement commands like "top" and even help with simple process management like killing tasks and changing process priorities.
If you have any questions about "htop", "iotop" and "glances", please ask them in the comments and we will see if we can help.
Image credit: By Neo139 (Own work), via Wikimedia Commons
Gary Sims
Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.
Starbeamrainbowlabs
htop and glances look good – although glances won't install on a raspberry pi :(
8 Tools to Easily Create a Custom Linux Distro
12 of the Best Linux Games in 2021
How to Set Up a Virtual On-Screen Keyboard in Linux
Do You Need a Boot Partition in Linux?
How to Install and Configure Openbox Window Manager
A Quick Guide to Linux Partition Schemes
The Beginner's Guide to Btrfs
Deepin Linux Review: Stylish Distro or Spyware?