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. Show
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 ImportantAs 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. dfYou 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:
2. duThis 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: 3. The ls CommandThe 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: 4. topYou 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. 5. htophtop 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: 6. mpstatAnother 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:
7. vmstatvmstat provides information about RAM, processes, buffer, cache, CPU activity, and much more. To use this tool, run this command:
8. iostatiostat 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: 9. sarsar 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: 10. NetHogsNetHogs 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:
11. tcpdumptcpdump 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: 12. netstatnetstat 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:
Linux Administration Made EasyPrecaution 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. What command will display running processes on Linux?To list processes in Linux, use one of the three commands: ps, top or htop. Ps command provides static snapshot of all processes, while top and htop sorts by CPU usage.
What is the name of a Linux command used for reporting statistics on running processes?Virtual memory statistics reporter, also known as vmstat , is a Linux command-line tool that reports various bits of system information. Things like memory, paging, processes, IO, CPU, and disk scheduling are all included in the array of information provided.
Which Linux utility is used to display any active Linux processes?The procs utility is a useful and informative alternative to the original Linux ps (process status) command. Like ps, procs displays information about the active processes running on the system, including their CPU and memory usage.
Which command is used to view running processes?You can use the ps command to find out which processes are running and display information about those processes. The ps command has several flags that enable you to specify which processes to list and what information to display about each process.
|