TechMende.com
Easy Technology Tips, Tricks & Guides

The 12 Best Tools to Monitor System Health on Linux

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


Let’s see 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 issue could be due to some bottlenecks in disk storage, CPU, RAM, or in the network.


Why Monitoring Linux Health Is Important

As a system admin, you must make sure your machine is working fine by monitoring its health frequently. In case an issue arises, you must quickly trace the problem and prepare a fix so that the system starts functioning again, and the downtime can be ignored.

To monitor a system’s health, you can make use of a few command-line tools and utilities that help you keep an eye on the system resources and their usage. When an issue comes up, you can again consult these tools to diagnose the problem and troubleshoot it in minimum 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 machine to execute 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 filename, df tells you about the free space on the disk partition that stores the file. To check free disk space on Linux, run this command:


df

2. du

This command-line utility allows you to see disk space that is already consumed by files. Note that it doesn’t display available space as df does. It only displays space that has been used.

To check the consumed space, run this command:


du

du command displaying consumed space by files

3. The ls Command

The ls command lists down all directory contents and the space they are consuming. To check the size of the files in a particular directory, go inside that directory and issue the following command:


ls -l -h

ls command displaying size of each file in a directory

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 utilization on your system. After issuing the following command, you will see all the running services on your system, along with cache and buffer information:


top

cpu and memory usage of each running process

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

5. htop

htop is another tool that works as an alternative to top. This utility doesn’t come pre-installed on Linux. To install it, execute the following command on Ubuntu and Debian:


sudo apt install htop

On Arch Linux:


sudo pacman -S htop

On Fedora, CentOS, and RHEL:


sudo dnf install htop

To monitor CPU usage on your system using htop, run this command:


htop

cpu and memory usage of all the running processes

6. mpstat

Another tool that you can use to get CPU information on Linux is mpstat. This utility provides a report of each available processor activity. You can also see the complete CPU utilization report of all processes with this command.

This tool doesn’t come pre-installed on Linux. You first need to install the sysstat package on your system to use mpstat:


sudo apt install sysstat

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


mpstat

mpstat command displaying cpu details

7. vmstat

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


vmstat

process, memory, swap, system and cpu information

8. iostat

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

By using this command-line utility, you can see reports on I/O device loading. To use this tool, run this command:


iostat

input/output loading information iostat command

9. sar

sar allows you to monitor CPU utilization after a specified amount of time. To use this tool, you need to install the sysstat package.

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


sar 10

sar command displaying cpu usage after every 10 seconds

Not only that, but you can also instruct the tool to run for a specified number of iterations. For example, if you want to monitor CPU utilization after every two seconds and for eight iterations, run the command like this:


sar 2 8

cpu usage after every 2 seconds and for 8 iterations

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 utilized by each process in a Linux system.

This tool doesn’t come pre-installed in Linux. The following command will install NetHogs on Debian-based distributions:


sudo apt install nethogs

To use this tool, run the following command:


nethogs

Linux command

11. tcpdump

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

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


tcpdump -i interface

12. netstat

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

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


sudo apt install net-tools

To see active internet connections on your system, run this command:


netstat -a | more

netstat active internet connections on a system

Linux Administration Made Easy

Precaution is better than cure. The goal is to identify any issue in the system by monitoring 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 straightforward command line utilities, you can now monitor Linux health and troubleshoot any issues in the network or system.

Linux,Linux Apps,System Administration,Best Of

>>Here is the Original Post!

Leave A Reply

Your email address will not be published.