How to Find What Is Using Disk Space on Linux

Linux 2 min readUpdated Oct 29, 2026
0 views0 comments

A full disk breaks things in strange ways: databases stop writing, mail queues grow, services refuse to start. Here is a reliable routine to find out what is eating the space and free it safely.

Step 1: Which filesystem is full?

df -h

Look at the Use% column. Note the mount point of the full filesystem, for example / or /var. Everything below walks down from there.

Also check inodes. A disk can be “full” because it holds millions of tiny files even when there is free space:

df -i

Step 2: Find the biggest folders

Run this from the full mount point. -x stops du from crossing into other filesystems:

sudo du -xh / --max-depth=1 2>/dev/null | sort -rh | head -10

Pick the largest folder and repeat inside it:

sudo du -xh /var --max-depth=1 2>/dev/null | sort -rh | head -10

Two or three rounds usually lead you to the culprit.

Step 3: Use ncdu for an interactive view

ncdu does the same job with a navigable interface, which is far faster when you are exploring:

# Debian / Ubuntu
sudo apt install ncdu
# AlmaLinux / Rocky / RHEL
sudo dnf install ncdu

sudo ncdu -x /

Use the arrow keys to move, Enter to open a folder and d to delete (be careful).

Step 4: Find individual huge files

sudo find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null

Step 5: The classic trap, deleted files that are still open

You deleted a huge log, but df still shows the disk full. A running process still holds the file open, so the space is not released until it closes. List them:

sudo lsof +L1

Restart the service that owns the file (or truncate the file instead of deleting it next time, with : > /path/to/file.log).

Common space hogs and how to clean them

Where Check Clean
systemd journal journalctl --disk-usage sudo journalctl --vacuum-size=200M
Package cache du -sh /var/cache sudo dnf clean all or sudo apt clean
Docker docker system df docker system prune
Old logs du -sh /var/log/* Configure logrotate

Prevent it from happening again

  • Make sure logrotate covers your application logs.
  • Set a monitoring alert at 80% disk usage, not at 100%.
  • Put /var or your data directory on its own volume so one runaway process cannot take down the whole system.
Did you find this helpful?Tap the heart to let us know. It takes one second and no account.

More tutorials like this

Leave a Comment

Your email address will not be published. Required fields are marked *

Bigland Network IT

Practical tutorials for people who run, build and fix things: operating systems, databases, development, networking and security.

Topics

More

Site

© 2026 Bigland Network. All rights reserved.Always test commands on a non-production system first.
Scroll to Top