The guide covers the best command-line Linux performance monitoring tools. Learn how these CLI tools can help resolve system, network, CPU, and disk bottlenecks.

1. Top

The top command lists real-time active processes based on CPU time consumption that updates every five seconds. It displays the general information at the top of the command output with data relevant to the currently running processes, system uptime/load, RAM, and swap space. Following general information, the command displays process lists with PID, actual memory, and CPU/Memory usage percentage.

The common practice you can utilize is to list the processes consuming excessive CPU and memory resources. If it appears that a process is consuming too much memory or is at maximum CPU, as a system administrator, you can kill the process based on the assigned PID or set it to low priority.

Besides, the top command also allows you to display and modify the running processes by sorting its output based on various other metrics like memory usage via pressing, process PID, and running time, etc.

2. Tcpdump

TCPdump is the most commonly used network troubleshooting utility of Linux network administrators. It is an open-source command-line packet sniffer/analyzer that captures TCP/IP packets transferred/received over the network over a specified interface.

The tool is native to the Linux distributions with versatile capabilities that include various filters and flags. Use the following command to check whether it’s already available:

If not, use your distribution’s package manager for installation. For Ubuntu Linux:

You can list the available interfaces to begin the network capture process:

The tcpdump utility allows you to capture, write and read traffic via various filter combinations to store only the required details, for instance, traffic on a specific port and a protocol into/from a pcap file. Some of the useful commands are as follows:

To make the most of tcpdump, you should have some prior understanding of packet analysis.

3. Netstat

As the name suggests, is a powerful command-line utility for network statistics that provides detailed network configuration and troubleshooting-related information. It displays incoming/outgoings connections, interface statistics, listening/open ports, routing table, etc.

Read More: A Simple Guide to netstat

You can use this utility by installing the net-tools package:

You can check the network stats sorted based on protocol to identify and resolve problems with the help of an -s flag, as follows:

Similarly, you can pull and view statistics for a specific (only TCP) protocol, as follows:

Another handy trick to troubleshoot is to view services by PID:

Even though the tool is deprecated in place of the ss/ip route command, it is a powerful yet easy-to-use tool always available in the arsenal of any Linux network administrator.

4. Htop

Htop is another command-line utility in Linux to monitor system-process and storage, which unlike the top command offers an interactive user interface. As a top command alternative, it divides the output into three main sections with clear visuals to represent CPU, memory, and swap sections.

It supports shortcut keys and allows you to scroll across the interface vertically and horizontally to view the commands against each process. Unlike the top tool, it is not available by default in all Linux distributions and requires installation via your system’s package manager.

Best of all, it allows you to kill or re-prioritize the system process without the need to leave the htop interface and use of a process PID, as it supports mouse operations.

5. Acct/Psacct

Acct or psacct is an ideal program for a multi-user environment like Linux as it allows you to monitor user and applications activity status. The user activity monitoring tool runs in the background to track your application activities and resource consumption. It displays the time duration of user access to the server, the commands in use, and the running processes.

To use, install the program on your Linux system via its package manager. The acct utility requires you to initiate the accounting process by enabling the option with the accton command, and it stores the details in the /var/account/pacct file.

As a command-line tool, you can utilize it with other tools like ps or who to identify various other system resource-related problems.

6. IOTOP

Iotop is a Python-based utility that relies on kernel accounting functionality to monitor input/output utilization of system threads and processes. It’s a helpful tool that can help you identify the process high on disk usage or input/output read or writes. Install this tool and use root privileges to monitor real-time I/O usage.

Iotop can become very handy in identifying processes with high swap memory consumption and heavy disk activity.

More to Explore for Effective System Monitoring

The article lists some must-have tools for efficient Linux system performance monitoring. We cover pre-built tools to third-party programs: each with its unique use case and functionality to keep a keen eye on your system resources and usage.

The article also shows how to install and make use of each utility for better system monitoring. As a beginner, learning these tools might be a steep curve, but monitoring Linux systems or servers for good health and efficient performance pays well in the long run.

As a beginner, learning these tools might be a steep curve, but monitoring Linux systems or servers for good health and efficient performance pays well in the long run.