Linux System Monitoring | df du free uptime Commands
df command, du command, free command, uptime, vmstat, iostat, system monitoring
Linux System Monitoring
Monitoring system resources is a core responsibility of Linux system administrators. Knowing how to check disk usage, memory consumption, CPU load, and system uptime allows you to identify bottlenecks, prevent outages, and maintain healthy Linux systems. These terminal commands are essential Linux basics for any operations role.
Disk Usage with df and du
The df command reports file system disk space usage. The -h flag makes sizes human-readable. The df command shows you how much space is used and available on each mounted file system.
df -h
df -h /var
df -TThe du command estimates the disk space used by files and directories. The -s flag summarizes (total only), -h makes it human-readable, and combining with sort gives you a ranked view of disk consumers.
du -sh /var/log
du -sh /home/*
du -h --max-depth=1 /var | sort -hMemory Usage with free
The free command displays the total, used, and available memory in the system. The -h flag shows human-readable sizes. The output includes both RAM and swap space.
free -h
free -mThe available column (not the free column) shows how much memory is actually usable for new applications, accounting for cached memory that the kernel can reclaim quickly.
System Uptime and Load Average
The uptime command shows how long the system has been running, the number of logged-in users, and the load average for the past 1, 5, and 15 minutes. A load average equal to the number of CPU cores means the system is fully utilized.
uptime
nproc
cat /proc/cpuinfo | grep "model name" | head -1vmstat and iostat
The vmstat command reports virtual memory statistics, including processes, memory, paging, I/O, CPU activity. The iostat command reports CPU and disk I/O statistics. These are essential for diagnosing performance problems.
vmstat 2 5
iostat -x 2 3The arguments 2 5 mean: report every 2 seconds, 5 times. These commands reveal whether a system is CPU-bound, memory-bound, or I/O-bound โ essential diagnostic knowledge for production Linux systems.
