Introduction
I’m continuing my 30-day Linux challenge as part of my preparation for the RHCSA exam, and today’s topic might just be a lifesaver for system admins and everyday users alike: understanding disk space usage with df, du and how to find what’s clogging up your system.
Index
- Why Disk Space Awareness Matters
 - What is df
 - What is du
 - Real Time Scenario
 - Industrial Insight
 - Recommendations
 - Quick Summary
 
🧱 Why Disk Space Awareness Matters
Running out of disk space can silently break a system whether it's preventing new files from being written, blocking services or even crashing processes. Being proactive is key.
That’s where df and du come in, they give you a clear picture of what's full, why, and how to fix it.
🔍 What is df?
df (Disk Free) reports available and used disk space on file systems.
🔧 Syntax:
df -h
✅ Example:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        40G   20G   18G  53% /
- 
-h: Human-readable format (MBs, GBs) - Quickly helps you know which partition is getting full
 
✅ Pro Tip: Use
df -Thto also show filesystem types like ext4, tmpfs, etc.
📦 What is du?
du (Disk Usage) shows how much space a directory or file consumes.
🔧 Syntax:
du -sh /path/to/folder
✅ Example:
$ du -sh /var/log
1.2G    /var/log
- 
-s: Summary only (don’t dive into subfolders) - 
-h: Human-readable 
🛠 Tip: Run
du -sh *inside a directory to compare which folders are space hogs.
🧰 Real Time Scenario
You log into a server and see alerts about low disk space. You use:
df -h
to check overall usage — /var is 90% full.
Then:
du -sh /var/*
to locate the culprit — it’s /var/log.
Then:
sudo du -ah /var/log | sort -rh | head -n 10
to find which specific log files are bloating. You clear old logs or rotate them. Problem solved.
🧠 Industrial Insight
In cloud deployments and containerized environments (like Docker), disk bloat is common. Backups, logs, caches — they add up silently. Keeping df and du in your toolbox can save hours of debugging.
🛡️ Recommendations
- 🔁 Set up cron jobs to monitor disk usage weekly
 - 📉 Automate cleanup with logrotate
 - 🚀 Combine 
find,duandxargsto identify and clean files older than X days - 🧪 Always use 
-hin scripts that will be reviewed by humans 
✨ Quick Summary
| Command | Purpose | Best Option | 
|---|---|---|
df | 
Check disk usage | 
df -h or df -Th
 | 
du | 
Folder/file size usage | du -sh | 
Today was all about staying in control, disk space issues don’t wait. Now I know exactly what’s filling up my system and more importantly, how to clean it up before it becomes a problem.
I'd love to hear your thoughts, insights or experiences with Linux. Feel free to share and join the conversation [ Connect with me on LinkedIn www.linkedin.com/in/techwithsana ]💜
#30dayslinuxchallenge #redhat #networking #cloudcomputing #cloudengineer #cloudarchitect #cloud #RHCSA #RHCE #RHEL #WomeninTech #Technology
              





    
Top comments (0)