Disk Usage 🧮 in Linux: Tools, Tips, and That One Mysterious 20GB Log File
You’re running your awesome website, crunching data, hosting memes, or running your secret AI overlord project. Then bam! Your server politely informs you that your disk is full. Time to go hunting!
Good news: Linux (and macOS too, btw – shout out to our UNIX cousin) comes packed with tools to help you figure out what’s eating your precious NVMe space.
Let’s meet the usual suspects.
du – Disk Usage (a.k.a. “Where the heck is my space?!”)
Use this to find out how much space your folders are taking.
du -sh /var/*The -s gives you a summary, the -h makes it human-readable (unless you like reading “4287432K” and pretending it’s normal). Add –max-depth=1 for broader directory scanning.
Example: du -h –max-depth=1 / Instant overview of what’s fattening your filesystem. Spoiler: It’s usually /var/log.
df – Disk Free (no, not “Download Festival”)
Want to see how much disk space is left on all mounted filesystems?
df -hThis command is your go-to for the “how much space do I have left?” panic check. Bonus: Works beautifully on your Mac too!
lsblk – List Block Devices
A fancier way to see your drives and partitions. Unlike df, this doesn’t show usage, but it gives you a clear view of device structure.
lsblkEspecially useful if you’re dealing with multiple volumes or attached storage. Want filesystem types?
lsblk -f Now you’re really flexing.
fdisk -l – Old School Drive Detective
Want a retro vibe? This command lists all disks and their partitions, straight from the 90s.
sudo fdisk -lIt’s like the lsblk of yesteryear, but still super handy for detecting drives and partitions. Warning: Requires root.
Bonus Round: find – The File Treasure Hunter
Need to find what’s really clogging your space? Try this:
find / -type f -size +20M -exec ls -lh {} \; | sort -k 5 -hr | head -n 10Translation: Find all files bigger than 20MB, list them with sizes, sort by size, and show top 10. You’ll be amazed (and slightly horrified) at what you forgot to delete.
🧼 Before You Purge: A Word of Warning (From Experience 😅)
If you’re not a million percent sure what a file is, don’t delete it. Accidentally deleting system logs? Meh. Accidentally deleting your database? Oops. Accidentally nuking /etc? You better hope your support team loves puzzles.
If you’re hitting disk space limits, here’s a pro tip: upgrading your ITLDC NVMe/SSD VDS is quicker, safer, and cheaper than two cups of fancy coffee. Scaling up is literally a few clicks away, and we’ll keep your server happy and humming.
Final Thought 💡
Whether you’re managing a VDS, a bare metal beast, or just your MacBook, these tools are your best friends. Keep them close, keep your filesystem cleaner than your desktop, and remember: du is your new disk whisperer.
Happy sysadmining 💽