Skip to content

Linux System Monitoring Guide: Master Resource Management Tools

Published: at 01:30 PMSuggest Changes

Effective system monitoring is crucial for maintaining healthy Linux systems. This guide covers essential tools for monitoring system resources.

Table of Contents

Open Table of Contents

Disk Usage Monitoring

Check Filesystem Space

df -h

Output:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        98G   48G   45G  52% /
/dev/sda2       146G   98G   41G  71% /home

Directory Size Analysis

du -sh */

Memory Management

View Memory Usage

free -m

Output:

$ free -m
              total        used        free      shared  buff/cache   available
Mem:          15951        4589        7855         524        3506       10582
Swap:          2047           0        2047

Interactive Quiz

Question 1

How would you find the top 5 largest directories in /home?

Click to see answer
du -h /home | sort -rh | head -n 5

Question 2

What command shows real-time CPU and memory usage?

Click to see answer
top
# or
htop

Performance Analysis

CPU Usage

mpstat 1

I/O Statistics

iostat -x 1

Best Practices

  1. Regular monitoring schedule
  2. Set up alerting thresholds
  3. Keep historical data
  4. Monitor all critical systems
  5. Document baseline performance

Practical Examples

Find Large Files

find / -type f -size +100M -exec ls -lh {} \;

Monitor System Load

watch -n 1 'cat /proc/loadavg'

Complete System Analysis Script

#!/bin/bash
echo "=== System Resources Overview ==="
date
echo -e "\n=== Disk Usage ==="
df -h
echo -e "\n=== Memory Usage ==="
free -m
echo -e "\n=== CPU Load ==="
uptime
echo -e "\n=== Most Memory Intensive Processes ==="
ps aux --sort=-%mem | head -n 5

Common Monitoring Scenarios

  1. High CPU Usage
top -b -n 1 | head -n 12
  1. Disk Space Issues
df -h | awk '{ if($5 > "80") print $0 }'
  1. Memory Problems
vmstat 1 5

Conclusion

Effective system monitoring is essential for maintaining reliable Linux systems. Regular monitoring and proactive management help prevent system issues.

Quick Reference Guide

CommandPurposeCommon Options
dfDisk space-h (human readable)
duDirectory usage-sh (summary)
freeMemory info-m (megabytes)
topProcess activity-b (batch mode)
iostatI/O statistics-x (extended)

Complete Linux Command Line Series

  1. Find Command Guide
  2. Process Management
  3. Text Processing
  4. Network Commands
  5. System Monitoring (Current Article)

Additional Resources


Next Post
Essential Linux Network Commands: A Complete Guide