Check disk usage on Linux with df, du and ncdu

Find out how full your disks are and which directories use the most space with df, du and ncdu. Every command tested on Debian, Ubuntu, Fedora and Arch.

Tools Published 2 min read

When a disk fills up, two questions matter: which file system is full, and what is taking up the space. df answers the first, du answers the second, and ncdu lets you explore the answer interactively. df and du are part of GNU coreutils, so they are already installed on every mainstream distribution.

See how full each file system is with df

df reports used and available space per mounted file system. The -h option prints sizes in human-readable units such as G and M:

✓ tested · debian,ubuntu,fedora,arch
df -h /

Without a path, df -h lists every mounted file system. Adding -T shows the file system type, which helps you tell real disks apart from virtual file systems like tmpfs:

✓ tested · debian,ubuntu,fedora,arch
df -hT

Find what uses the space with du

du adds up the space used by files and directories. To get one total for a directory, use -s (summarize) together with -h:

✓ tested · debian,ubuntu,fedora,arch
du -sh /usr/share

To find the biggest subdirectories, limit the depth with --max-depth=1 and sort the result. sort -h understands human-readable sizes, so 2G correctly sorts above 900M:

✓ tested · debian,ubuntu,fedora,arch
du -h --max-depth=1 /usr | sort -h | tail -n 5

On a real system, run this as root (with sudo) on directories such as /var, otherwise du skips folders you are not allowed to read and prints “Permission denied” warnings.

Explore interactively with ncdu

ncdu scans a directory once and then lets you browse the results with the arrow keys, sorted by size. It is not installed by default. On Debian and Ubuntu:

✓ tested · debian,ubuntu
sudo apt-get update
sudo apt-get install -y ncdu
ncdu --version

On Fedora:

✓ tested · fedora
sudo dnf install -y ncdu
ncdu --version

Then start it on the directory you want to inspect. Use the arrow keys to move, Enter to open a directory and q to quit:

sudo ncdu /

Quick reference

TaskCommand
Free space on all file systemsdf -h
Free space with file system typedf -hT
Total size of one directorydu -sh DIR
Five biggest subdirectoriesdu -h --max-depth=1 DIR | sort -h | tail -n 5
Interactive browserncdu DIR

Sources

  1. GNU Coreutils manual: df invocation
  2. GNU Coreutils manual: du invocation
  3. ncdu project page

#Df #Du #Ncdu #Disk Usage #Coreutils

This article was drafted with AI assistance, fact-checked against the sources listed above and reviewed by a human editor before publication. Spotted an error? See our corrections policy.