Tuesday, February 10, 2026

disk size linux

Linux Root Disk Usage Checker

Linux Root Disk Usage Checker

Quick reference for checking and cleaning up a 100% full root (/) filesystem. Use with caution—avoid deleting system files!

Check Overall Usage

df -h /
df -h

Shows root filesystem usage in human-readable format (GB/MB).

Find Largest Directories

sudo du -h --max-depth=1 / | sort -rh | head -n 10

Lists top 10 largest top-level directories under /. Drill deeper: sudo du -h --max-depth=1 /var | sort -rh.
Common culprits: /var/log, /var/cache, /tmp, /home.

Locate Largest Files

sudo du -ah / 2>/dev/null | sort -rh | head -n 20

Shows 20 largest files system-wide (ignores permission errors).

Large files only: sudo find /var -type f -size +100M -exec ls -lh {} \;

Interactive Analyzer (ncdu)

Install:

# Debian/Ubuntu
sudo apt update && sudo apt install ncdu

# Fedora/RHEL
sudo dnf install ncdu

Run:

sudo ncdu /

Navigate with arrows, 'd' to delete, 'q' to quit. Perfect for visual exploration.

Safe Cleanup Tips

  • Logs: sudo journalctl --vacuum-time=7d (systemd) or sudo rm -rf /var/log/*.old
  • Cache: sudo apt autoclean (Debian) or check /var/cache
  • Temp: sudo rm -rf /tmp/* (safe if no processes using files)
  • Never delete: /bin, /etc, /lib, /sbin, /usr

Quick Copy-Paste Workflow

  1. df -h /
  2. sudo du -h --max-depth=1 / | sort -rh | head -n 10
  3. sudo ncdu /

Copy this entire HTML file and paste into your Google Blogger/HTML editor for instant blog post!