Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

Linux Check Disk Space: df, du, and Finding the Largest Files

Sean

Platform Writer

Jul 05, 2026
5 min read

Check Linux disk space with df -h for filesystem usage and du -sh /path for directory usage. Find large files with find / -size +100M. The team that runs these on a schedule catches full disks before services crash.

Linux Check Disk Space: df, du, and Finding the Largest Files

Table of contents

df - the filesystem view

df -h

Shows every mounted filesystem with size, used, available, and use%:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       100G   87G   13G  87% /
/dev/sda2       500G  200G  300G  40% /data
tmpfs            16G  1.2M   16G   1% /dev/shm

The team that runs df -h gets a quick overview. The team that uses df -h /var checks a specific mountpoint.

du - directory usage

du -sh /var/log        # size of /var/log
du -sh /var/*          # size of each top-level dir
du -h --max-depth=1 /  # size of top-level dirs

The team that uses du -sh finds which directories are biggest.

Finding large files

# Files over 100M
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null

# Top 10 largest files in /var
find /var -type f -exec du -h {} + 2>/dev/null | sort -rh | head -10

The team that uses find -size finds the offenders.

du with sorted output

du -h /var/* | sort -rh | head -10

The team that sorts du output finds biggest first.

ncdu - interactive

ncdu is an interactive ncurses-based disk usage analyzer:

sudo apt install ncdu
ncdu /

Navigate with arrows. The team that uses ncdu on servers with no GUI has visual disk exploration.

Free space alerts

Common cron job:

# Daily check, alert if < 10% free
df -h / | tail -1 | awk '{ if (substr($5, 1, length($5)-1) + 0 > 90) print "Disk almost full: " $0 }' | mail -s "Disk alert" [email protected]

The team that has disk alerts catches full disks before they cascade.

The ‘no space left’ trap

No space left on device errors can come from:

  • Filesystem full (check df).
  • Inodes exhausted (check df -i).
  • Reserved blocks (ext4 reserves 5% for root).

The team that checks inodes catches the ‘looks empty but isn’t’ case.

FAQ

What’s the difference between df and du?

df = filesystem-level (total/used/free for mounted volumes). du = directory/file-level (size of a specific path). The team that uses df for overview and du for drill-down has the right mental model.

Why does df show different sizes for the same disk?

Different mount points show different used/free (e.g., / vs /home). The team that runs df per mountpoint sees each filesystem’s usage.

How do I check inode usage?

df -i. The team that has ‘filesystem full’ errors but df shows free space has an inode exhaustion issue.

How do I find what filled up the disk?

du -sh /* | sort -rh | head to find the largest directory, then drill in. The team that uses this finds log files that exploded overnight.

Can I delete files but not free space?

Yes - if a process has the file open, the space isn’t freed until the process closes it. The team that restarts the process (e.g., logrotate + service restart) frees the space.

If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.

Useful related references:

#linux#disk#df#du#dev-infra