Overview
Common commands for monitoring CPU, memory, disk, network, and overall system health on Linux systems.
CPU Monitoring
Interactive Process Viewer
topEnhanced version:
htopDisplays:
-
CPU usage
-
Memory usage
-
Running processes
-
Load average
Install:
sudo apt install htopCPU Information
lscpuDetailed information:
cat /proc/cpuinfoMemory Monitoring
Quick RAM Usage
free -hExample:
total used free shared buff/cache available
Mem: 3.8Gi 1.2Gi 0.5Gi 50Mi 2.1Gi 2.3GiPay special attention to:
-
available -
used
Detailed Memory Information
cat /proc/meminfoMemory size only:
grep MemTotal /proc/meminfoDisk Monitoring
Filesystem Usage
df -hExample:
Filesystem Size Used Avail Use%
/dev/sda1 40G 18G 20G 48%Directory Sizes
Current directory:
du -sh *Example:
du -sh /var/*Load Average
System Load
uptimeExample:
09:00:00 up 5 days, load average: 0.25, 0.30, 0.40Interpretation:
| Load | Meaning |
|---|---|
| < 1 | Very light |
| 1 - CPU cores | Normal |
| > CPU cores | Potential CPU bottleneck |
Process Analysis
Top CPU Consumers
ps aux --sort=-%cpu | headTop Memory Consumers
ps aux --sort=-%mem | headDisk I/O Monitoring
Real-Time I/O Statistics
iostat -xz 1Install:
sudo apt install sysstatUseful for diagnosing:
-
Slow disks
-
High I/O wait
-
SSD bottlenecks
Network Monitoring
Bandwidth Usage
iftopor
nloadInstall:
sudo apt install iftop nloadOverall Health Check
Quick Server Status
uptime
free -h
df -h
ps aux --sort=-%mem | headOne-Liner Health Check
echo "=== LOAD ==="; uptime; \
echo; echo "=== MEM ==="; free -h; \
echo; echo "=== DISK ==="; df -hvmstat (Highly Recommended)
One of the most valuable Linux performance tools.
vmstat 1Provides:
-
CPU utilization
-
Memory usage
-
Swap activity
-
Disk I/O
-
Context switches
-
Process scheduling
Many experienced Linux administrators can identify performance bottlenecks using vmstat alone.
Lab Server Quick Check
For routine monitoring of lab.domain.com:
uptime
free -h
df -h
vmstat 1
ps aux --sort=-%mem | headIf all of these look healthy:
-
Load is low
-
No swapping
-
Disk usage < 80%
-
Memory available > 10%
-
No runaway processes
then the server is usually in good condition.