To check system performance metrics in Linux

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.

top

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
htop

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
dstat

5. Checking Network Usage

Using ifstat

ifstat reports network interfaces statistics.

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

Using nload

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

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

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:
top
htop
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
dstat

Network Usage:

ifstat
nload
sudo iftop

Related Posts

Linux Interview questions that are commonly asked in interviews

Basic Questions Intermediate Questions Advanced Questions Scenario-Based Questions Advanced Questions Scenario-Based Questions Mohammad Gufran Jahangir

Read More

Log Rotation in Linux

Managing log files is a critical task in maintaining server health and preventing disk space issues. Enabling log rotation helps manage the size of log files, but…

Read More

Troubleshooting a database server in Linux

Troubleshooting a database server in Linux involves a systematic approach to identify and resolve issues related to configuration, performance, connectivity, security, and more. Below are steps and…

Read More

Common errors encounter in web server in Linux

When troubleshooting a web server in Linux, a variety of errors can arise. These errors can be related to configuration issues, resource limitations, network problems, security settings,…

Read More

Common errors encounter for applications in Linux

When troubleshooting applications in Linux, a wide range of errors can occur due to various reasons such as configuration issues, resource limitations, dependency problems, and more. Below…

Read More

Types of errors encounter in virtual machine (VM) in Linux

When managing a virtual machine (VM) in Linux, you may encounter various types of errors that necessitate checking the logs in the /var/log directory, particularly the syslog…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x