To check system performance metrics in Linux

Posted by

To check system performance metrics such as CPU, RAM, disk, I/O, and network in Linux, you can use a combination of built-in tools and utilities. Here are some of the most commonly used tools and commands:

1. Checking CPU Usage

Using top

top provides a real-time view of the system’s CPU usage along with other metrics.


Using htop

htop is a more user-friendly version of top. It may need to be installed first.

sudo apt install htop   # Debian/Ubuntu
sudo yum install htop   # CentOS/RHEL

Using mpstat

mpstat is part of the sysstat package and shows CPU usage.

sudo apt install sysstat   # Debian/Ubuntu
sudo yum install sysstat   # CentOS/RHEL
mpstat -P ALL

2. Checking RAM Usage

Using free

The free command displays the amount of free and used memory in the system.

free -h

Using vmstat

vmstat reports information about processes, memory, paging, block I/O, traps, and CPU activity.

vmstat 2

3. Checking Disk Usage

Using df

df reports the amount of disk space used and available on filesystems.

df -h

Using du

du displays disk usage of files and directories.

du -sh /path/to/directory

Using iostat

iostat reports CPU and I/O statistics. It is also part of the sysstat package.

iostat -xz 1

4. Checking Disk I/O

Using iotop

iotop displays I/O usage by processes. It may need to be installed first.

sudo apt install iotop   # Debian/Ubuntu
sudo yum install iotop   # CentOS/RHEL
sudo iotop

Using dstat

dstat is a versatile resource statistics tool that shows various system metrics, including I/O.

sudo apt install dstat   # Debian/Ubuntu
sudo yum install dstat   # CentOS/RHEL

5. Checking Network Usage

Using ifstat

ifstat reports network interfaces statistics.

sudo apt install ifstat   # Debian/Ubuntu
sudo yum install ifstat   # CentOS/RHEL

Using nload

nload is a real-time network traffic and bandwidth monitor.

sudo apt install nload   # Debian/Ubuntu
sudo yum install nload   # CentOS/RHEL

Using iftop

iftop shows bandwidth usage on an interface by host. It may need to be installed first.

sudo apt install iftop   # Debian/Ubuntu
sudo yum install iftop   # CentOS/RHEL
sudo iftop

Summary of Commands

Here’s a summary of the commands for quick reference:

  • CPU Usage:
mpstat -P ALL

RAM Usage:

free -h
vmstat 2

Disk Usage:

df -h
du -sh /path/to/directory
iostat -xz 1

Disk I/O:

sudo iotop

Network Usage:

sudo iftop

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x