The 6 Best Command Line Tools to Monitor Linux Performance in the Terminal

The 6 Best Command Line Tools to Monitor Linux Performance in the Terminal

Linux is an open-source, UNIX-like operating system that drives a large portion of the internet. The Linux kernel sits underneath many new technologies and platforms such as Android, SDN controllers, containers, and its services as a network OS and server. These high demands require the proper management, reliability, and availability of the hosted applications, websites, and underlying Linux OS.

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 top command output

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.

Related: Ways to Use the top Command in Linux​​​​​​

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:

which tcpdump

Check if the tcpdump tool is available by default.

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

sudo apt-get update
sudo apt-get install tcpdump

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

sudo tcpdump -D

Check all the system interfaces.

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:

sudo tcpdump -c 10 -i ens33
sudo tcpdump -i ens33 dst port 22
sudo tcpdump -i ens33 host -w /tmp/capture_1.pcap
sudo tcpdump -w /tmp/capture_1.pcap

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:

sudo apt-get update -y && apt-get install net-tools -y

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

netstat -s | less

Netstat command output for all protocols.

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

netstat -st | less

Netstat command output for TCP protocol.

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

netstat -tp | less

Netstat command output with process 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.

Htop Command Output

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.

Acct Examples to initiate accountability and check user accounts.

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


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.

sudo iotop

Iotop command output.

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.

managing system monitor ubuntu
How to Manage Processes on Ubuntu Using System Monitor

Feeling uncomfortable while managing processes using the Linux command line? System Monitor is there to help you out.

Read Next

About The Author

Original Link

Leave a Comment

Your email address will not be published.