Breaking News

Even a small error can risk the stability of your system. Luckily, there are tools that help you monitor the health of your Linux machine.
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.
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:
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:
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:
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:
Here are some command-line tools that focus on monitoring CPU and memory usage:
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:
If a memory usage issue appears on the monitor, you can optimize your RAM performance to fix it.
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:
On Arch Linux:
On Fedora, CentOS, and RHEL:
To monitor CPU usage on your system using htop, run this command:
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:
Now run the following command to view CPU usage on your system:
vmstat provides information about RAM, processes, buffer, cache, CPU activity, and much more. To use this tool, run this command:
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:
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:
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:
Here are some command-line tools that focus on monitoring network usage:
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:
To use this tool, run the following command:
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:
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:
To see active internet connections on your system, run this command:
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.

Azeefa is a Security Operations Engineer by day and a Technical Content Writer by night. She loves to explore Linux and write tutorials on it. Besides that, she is a movieholic and also appreciates good photography.

source

Leave a Reply

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

Share Article: