How to Check Disk Space and Find What's Using It on Linux
Use df -h to check overall disk usage and du -sh to find which directories are taking up the most space on a Linux server.
Published September 21, 2026
df -h shows overall disk usage per mounted filesystem, while du -sh shows how much space specific directories are using — the two together let you find what's filling up a disk.
df -h
du -sh /var/log/*
du -sh --max-depth=1 / 2>/dev/null | sort -rhSteps
- Run df -h to see which filesystem/partition is actually full — 'h' means human-readable sizes (GB/MB)
- Once you know which mount is full (e.g. /), run du -sh --max-depth=1 /path to list the size of each top-level directory inside it
- Sort the output with sort -rh to see the largest directories first, then repeat du one level deeper inside the biggest offender to narrow it down
How it works
df reports space at the filesystem level (based on what's actually allocated on disk), while du calculates space by walking directory trees and summing file sizes — they can occasionally disagree slightly due to deleted-but-still-open files.
Things to watch for
- Log files (/var/log) and package caches are common silent disk hogs on long-running servers
- A file that's deleted but still held open by a running process won't be freed by rm, and won't show up in du — restarting the holding process is often required
FAQ
Why does df show a disk as full but du can't find anything large?
A common cause is deleted files still held open by a running process — the space isn't released until that process closes the file handle or is restarted.