You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Capacity planning β predict when you'll run out of resources
Troubleshooting β diagnose problems after they occur
Linux System Monitoring
Resource Monitoring Commands
CPU and Memory
# CPU and process monitor
top # Interactive process list (press q to quit)
htop # Enhanced top (needs install)
atop # Advanced resource monitor# Inside top:# P = sort by CPU# M = sort by memory# k = kill process (enter PID)# 1 = show per-CPU stats# q = quit# CPU info
lscpu # CPU architecture details
cat /proc/cpuinfo # Raw CPU info
nproc # Number of CPU cores# Memory
free -h # Memory usage (human readable)
free -m # In megabytes
vmstat 1 5 # Virtual memory stats (1s interval, 5 times)
cat /proc/meminfo # Detailed memory info# Real-time resource stats
sar -u 1 5 # CPU utilization (1s, 5 samples)
sar -r 1 5 # Memory utilization
sar -n DEV 1 5 # Network interface stats
Disk Monitoring
# Disk space
df -h # Filesystem usage (human readable)
df -i # Inode usage
du -sh /var/log/ # Size of directory
du -sh *| sort -h # Sort by size
ncdu /var/ # Interactive disk usage# Disk I/O
iostat -x 1 5 # I/O statistics (extended, 1s, 5 samples)
iotop # Interactive I/O per process# Disk health
smartctl -a /dev/sda # SMART data (needs smartmontools)
Network Monitoring
iftop # Interactive bandwidth per connection
nethogs # Bandwidth per process
nload eth0 # Network interface load
vnstat # Historical bandwidth usage
vnstat -l # Live monitoring
watch -n 1 'cat /proc/net/dev'# Raw network counters
System Load
uptime # Load averages (1, 5, 15 min)# Example: load average: 0.5, 0.3, 0.2# Numbers = avg processes in run/wait queue# Rule: load > CPU count = overloaded
w # Uptime + who's logged in
cat /proc/loadavg # Raw load average
# vmstat: Virtual Memory Statistics
vmstat 1 10 # 1 second interval, 10 samples# r = run queue, b = blocked, swpd = swap used# us = user CPU%, sy = system CPU%, id = idle CPU%# si/so = swap in/out per second# sar: System Activity Reporter
sar -u 1 10 # CPU (1s interval, 10 samples)
sar -r 1 10 # Memory
sar -b 1 10 # Disk I/O
sar -n DEV 1 10 # Network per interface
sar -q 1 10 # Load average and run queue# iostat: I/O Statistics
iostat 1 5 # CPU + disk I/O
iostat -x 1 5 # Extended disk stats# %util = percentage of time device was busy (>80% = saturated)# await = average I/O wait time (ms)