SoFunction
Updated on 2025-03-04

Summary of commonly used resource monitoring commands in Linux

The three most commonly used commands

1. Humanized real-time monitoring of the use of resources such as CPU, memory, and processes

htop

2. Real-time monitoring of GPU

watch -n 1 nvidia-smi

3. Check the usage of hard disk partitions in a humanized manner

df -h

Linux System Resource Monitoring Guide

1. CPU monitoring

1.1 Real-time monitoring commands

# top - Classic real-time system monitoring tooltop

# htop - More friendly top alternative, support for interactionhtop

# uptime - View system loaduptime

# mpstat - CPU usage statisticsmpstat 1

# vmstat - Virtual Memory Statisticsvmstat 1

1.2 View CPU information

# View CPU informationcat /proc/cpuinfo

# Check CPU temperaturesensors

# Statistics the number of CPU coresnproc

2. Memory monitoring

2.1 Real-time monitoring commands

# free - Show memory usagefree -h

# vmstat - Virtual Memory Statisticsvmstat 1

# top/htop can also display memory informationhtop

2.2 Memory details

# View detailed memory informationcat /proc/meminfo

# Check process memory usageps aux --sort=-%mem | head

3. GPU monitoring

3.1 NVIDIA GPU

# nvidia-smi - NVIDIA GPU statusnvidia-smi

# Real-time monitoring of GPUswatch -n 1 nvidia-smi

# Detailed GPU informationnvidia-smi -q

# GPU usage statisticsnvidia-smi dmon

3.2 AMD GPU

# rocm-smi - AMD GPU statusrocm-smi

4. Disk monitoring

4.1 Disk Space

# df - Check disk space usagedf -h

# du - View directory sizedu -sh /path/to/directory

4.2 Disk I/O

#iostat - Disk I/O Statisticsiostat -x 1

#iotop - Display disk I/O by processiotop

# pidstat - Process resource usage statisticspidstat -d 1

5. Network monitoring

5.1 Network traffic

# iftop - Real-time network bandwidth monitoringiftop

# nethogs - Display network bandwidth usage by processnethogs

#iptraf - Network statistics tooliptraf-ng

5.2 Network connection

# netstat - Network Connection Statisticsnetstat -tuln

#ss - new version netstatss -tuln

# tcpdump - Network packet analysistcpdump -i eth0

6. Comprehensive monitoring tools

6.1 Command Line Tools

# glances - System monitoring toolglances

# nmon - Performance Monitoringnmon

# atop - System resource monitoringatop

6.2 Graphic interface tools

System Monitor (gnome-system-monitor)
KSysGuard (KDE)
Conky

7. Log monitoring

7.1 System Log

# View system logs in real timetail -f /var/log/syslog

# View system startup logjournalctl -b

7.2 Performance Log

# sar - System Activity Reportsar -u 1 # CPU
sar -r 1 # Memorysar -b 1 # I/O

8. Install the necessary tools

# Ubuntu/Debian
sudo apt-get install htop iftop iotop glances nmon net-tools sysstat

# CentOS/RHEL
sudo yum install htop iftop iotop glances nmon net-tools sysstat

This is the end of this article about the summary of commonly used resource monitoring commands in Linux. For more related contents of Linux resource monitoring commands, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!