In this post, we will look at a few tools to monitor linux system resources. Specifically, we will look at command line monitoring tools that will help us determine which processes consume most system resources on Linux machine. These terminal based tools are atop, htop, and top . For the experienced hands, a terminal and “*top” command may be familiar.

If you would like to check out website monitoring tools, read my posts on this topic here and here.

The need for process monitoring in Linux Server

With so many processes and operations running simultaneously, it’s crucial to have an accurate and efficient way of monitoring system performance. That’s where terminal-based monitoring tools come in. In this blog post, we will explore three such tools: atop, htop, and top. These monitoring tools provide administrators with insights into the system’s resource usage, process management, and other critical metrics. While all three tools share a common purpose, they each have distinct features and capabilities. Top, the most basic tool, provides a real-time view of system processes and their resource usage. Htop is an advanced version of Top, providing a more user-friendly interface and additional features such as filtering and process tree viewing. Atop goes even further, providing detailed information about resource usage, system bottlenecks, and network activity.

Throwback : Process Monitoring in Windows

Back in the days I used Windows, that could be brought up by pushing ctrl+alt+del . This was a tried and tested way to figure out resource usage. Also to find out the naughty and un-responsive processes, that hogged up memory or processor cycles. I have not used Windows for quite a while now, bit I am leaving you with an image from Windows10. Incidentally, the machine I am using to post this blog is an AMD Ryzen powered Lenovo Thinkpad that runs dual boot Windows 11/ Linux Manjaro Linux Mint.

Measure Linux system resources

In Linux, like always, there are multiple ways of achieving a similar result. I will cover three terminal based tools below.

htop

Using htop on a Linux server to monitor system resources

Using htop on a Linux server to monitor system resources

`htop` offers a comprehensive overview of system resources in an easy-to-understand format. It comes equipped with features such as real-time CPU usage, memory usage, and load average monitoring.

top

`top` is a basic monitoring tool that displays real-time information about system resource usage in a concise format.
Using top on a Linux server to monitor system resources

Using top on a Linux server to monitor system resources

atop

`atop` is a powerful command-line tool that provides detailed information about system resources. It offers a wide range of features, including process-specific resource utilization, disk and network activity monitoring, and per-process I/O statistics.
Sometimes, one or two processes can run awry and chew up system resources. This slows the entire computer. That’s where monitoring plays an important role. Case in point: when I was updating this post, Firefox and Dolphin (file manager for KDE desktop) took up a lot or RAM. htop showed me the errant process, and I could take the necessary corrective action.

Graphical Tools for processes and resource use

Linux desktops do offer graphical tools that help in monitoring system resources. KDE Desktop, which I use, has a tool called KDE System Monitor. A screenshot from my desktop with that tool running forms the feature image for this blog post!


Linux website system monitoring monitoring linux system resources. Blog of Amar Vyas

Concept image- dashboard for monitoring linux system resources.

Other Monitors for Linux

1. btop++

Btop++ is a modern and highly customizable resource monitoring tool for the Linux terminal. It offers a similar interface to htop, with a color-coded display of CPU, memory, and disk usage. One of the standout features of btop++ is its ability to display network traffic in real-time, making it a great tool for monitoring network activity. It also offers the option to display information in a tree view, allowing users to see which processes are using the most resources.

2. bottom

Bottom is a cross-platform resource monitoring tool that offers a simple and easy-to-use interface. It displays information in a similar way to htop, with color-coded bars for CPU, memory, and disk usage. One of the standout features of bottom is its ability to display the top processes using the most resources in real-time. This can be particularly helpful for quickly identifying any processes that may be causing performance issues.

3. bpytop

Bpytop is a modern and feature-rich resource monitoring tool that offers a visually appealing interface. It displays information in a similar way to htop, with color-coded bars for CPU, memory, and disk usage. One of the standout features of bpytop is its ability to display information in a tree view, allowing users to see which processes are using the most resources.

Noteworthy Mentions

  1. Glances Glances is a cross-platform monitoring tool that can be used to monitor system resources in real-time. It is written in Python and offers a simple, easy-to-use interface. Glances provides information about CPU, memory, disk, network, and processes. It also has the ability to monitor remote systems. One of the unique features of Glances is its ability to display system information in a web interface, making it accessible from any device with a web browser.
  2. nmon nmon (short for Nigel’s Monitor) is another popular system monitoring tool for Linux. It provides a comprehensive view of system resources, including CPU, memory, disk, network, and processes. nmon also has the ability to generate reports in various formats, such as CSV, HTML, and JSON. It also offers a curses-based interface for users who prefer a more traditional terminal-based experience.
  3. Netdata Netdata is a real-time monitoring tool that is designed for high-performance systems. It offers a web-based interface that displays system metrics in real-time, making it easy to identify any performance issues. Netdata supports a wide range of systems, including Linux, BSD, and macOS. It also has a plugin architecture that allows users to add custom metrics and alerts.
  4. Sysstat Sysstat is a collection of performance monitoring tools for Linux. It includes various utilities such as sar, iostat, and mpstat, which can be used to collect and analyze system performance data. Sysstat can be configured to collect data at regular intervals, making it useful for long-term performance monitoring. It also offers a web-based interface for visualizing data and generating reports.
  5. Prometheus Prometheus is an open-source monitoring system that is widely used for collecting and storing metrics from various systems. It has a client-server architecture and offers a powerful query language for analyzing data. Prometheus also has a rich ecosystem of exporters, which can be used to collect metrics from different systems and applications.
Linux website system monitoring. Blog of Amar Vyas

Monitoring System Resources Remotely

If you are using a server or a headless machine (Computer without a graphical interface), then you can monitor the resource usage remotely using “*top” via a terminal. You will have to ssh into the server in order to do so. For example, I used this method to check system resources on a storage server from Inception Hosting I have in the United States.
$ ssh Stor
Linux inph.vyas 5.10.0-10-amd64 #1 SMP Debian xxx
amar@inph:~$ htop

Using vmstat for checking system resource usage

Update March 2022 : I recently decided to brush up my knowledge of Linux commands, and a familiar yet lesser known command `vmstat` came to mind. Below are some of the ways in which you can use this command to find out how much RAM is being used. You can find the output form my Lenovo Thinkpad.
$ vmstat -s
      6990192 K total memory
      3474820 K used memory
      1533028 K active memory
      4361344 K inactive memory
       127464 K free memory
        84132 K buffer memory
      3303776 K swap cache
      1048572 K total swap
       751992 K used swap
       296580 K free swap

Similarly, the `iostat` command gives information on CPU and disk usage.You can see the version of Linux Kernel, the cpu achitecture, disk read and write speed and cpu steal among other information. This post on techmint has some useful information on using the above two commands.
$iostat

Linux 5.16.11-arch1-1 (sanganak-tp) 	03/03/22 	_x86_64_	(12 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           5.89    0.28    6.13    0.04    0.00   87.66

Device             tps    kB_read/s    kB_wrtn/s    kB_dscd/s    kB_read
nvme0n1           6.66       562.63        54.21         0.00   52507999

Using Third Party Server Monitoring Tools

For the more experienced hands, tools like Grafana, Netdata, or Hetrix Tools might come in handy. I was recently introduced to the Hetrix Tools Monitoring Agent through this discussion on LowEndTalk.

Takeaways from Linux System Resources Monitoring Tools

There are several ways by which one can monitor the system resources and use of cpu, disk space, and RAM. As they say, ‘there is more than one way to skin a cat‘. One of the beautiful things about Linux and Open Source world is that there are several ways to achieve the same result. And many great command line tools to achieve that. In this post, we just mentioned a few that barely scratch the surface. Back in the day when I used lightweight Window managers like Enlightenment on Bodhi Linux, I used gkrellm extensively, which offered similar tools. These days, the trio of htop atop top remain my preferred tools.
This post was updated on 21 Feb 2024
Categories: Notes Blog