htop

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: 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: And to launch it, use: 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

“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: And to launch it, use: “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.

Conclusion

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