The 12 best tools to monitor system health on Linux

Not sure how to monitor the health of a Linux system? There are a few tools you can use to check the performance of a Linux system. While some of these come pre-installed on Linux, others need to be installed manually.


Let’s take a look at how you can use command-line tools to understand the underlying issues in your Linux system that keep it from performing at its best. The problem may be due to some bottlenecks in disk storage, CPU, RAM or in the network.


Why monitoring Linux health is important

As a system administrator, you must ensure that your machine is working properly by regularly checking its status. When a problem arises, you must quickly diagnose the problem and prepare a solution so that the system is back up and running and the downtime can be ignored.

To monitor the health of a system, you can use some command-line tools and utilities to monitor system resources and usage. When a problem arises, you can refer to these tools again to diagnose the problem and fix it in no time.

Below are some command line tools you can use to monitor Linux health. To get started, open the Linux command-line interface (CLI) on your computer to run the commands.

Here are some command line tools that focus on monitoring Linux disk storage:

1.df

You can use df to check how much space your Linux machine is using. When used with a file name, df tells you about the free space on the disk partition where the file is stored. Run this command to check free disk space on Linux:


df

2. du

This command line utility allows you to see what disk space is already being used by files. Note that it doesn’t list available space like df does. It only shows the used space.

Run this command to check the consumed space:


du

3. The ls command

The ls command lists all directory contents and the space they occupy. To check the size of the files in a particular folder, go to that folder and issue the following command:


ls -l -h

Here are some command line tools that focus on monitoring CPU and memory usage:

4. top

You can use top to get information about CPU and memory usage on your system. After issuing the following command, you will see all running services on your system, along with cache and buffer information:


top

If a memory usage problem appears on the monitor, you can optimize your RAM performance to solve it.

5. crest

htop is another tool that works as an alternative to top. This utility is not preinstalled on Linux. To install it, run the following command on Ubuntu and Debian:


sudo apt install htop

On ArchLinux:


sudo pacman -S htop

On Fedora, CentOS, and RHEL:


sudo dnf install htop

Run this command to check CPU usage on your system using htop:


htop

6. mpstat

Another tool you can use to get CPU information on Linux is mpstat. This utility provides a report of each available processor activity. You can also view the full CPU usage report of all processes using this command.

This tool is not pre-installed on Linux. You first need the systemstat package on your system to use mpstat:


sudo apt install sysstat

Now run the following command to view the CPU usage on your system:


mpstat

7. vmstat

vmstat provides information about RAM, processes, buffer, cache, CPU activity and much more. Run this command to use this tool:


vmstat

8. iostat

iostat is a system monitoring tool that you can use to view Linux storage input and output statistics.

By using this command-line utility, you can view reports on the loading of I/O devices. Run this command to use this tool:


iostat

9. sar

With sar you can check the CPU usage after a certain time. To use this tool you need to install the sysstat package.

To check the CPU usage after every 10 seconds, run the command like this:


sar 10

Not only that, but you can also instruct the tool to perform a certain number of iterations. For example, to check CPU usage every two seconds and for eight iterations, run the command like this:


sar 2 8

Here are some command line tools that focus on monitoring network usage:

10. NetHogs

NetHogs is a popular command line utility that you can use to monitor real-time network traffic, including the bandwidth used by each process in a Linux system.

This tool is not pre-installed in Linux. The following command will install NetHogs on Debian based distributions:


sudo apt install nethogs

Run the following command to use this tool:


nethogs

11. tcpdump

tcpdump is a network packet analyzer used to capture TCP/IP packets sent or received over a particular interface over the network.

To use this tool, run the following command and specify the interface you want to inspect the traffic on:


tcpdump -i interface

12. netstat

netstat monitors and outputs statistics of incoming and outgoing network traffic. This is one of the most important network tools to inspect any bottlenecks in a network. It also provides information about the interfaces and ports used on the system.

This command line utility is pre-installed on modern Linux systems. However, if you don’t have it, you can install it by running the following command:


sudo apt install net-tools

Run this command to see active internet connections on your system:


netstat -a | more

Linux management made easy

Precaution is better than cure. The goal is to identify any problem in the system by checking CPU, RAM, disk and network usage before it messes up the system’s performance.

Linux administration is not an easy task. But thanks to these simple command-line tools, you can now monitor the health of Linux and troubleshoot any problems in the network or system.

Leave a Reply

Your email address will not be published. Required fields are marked *