At a high level, the disk space debugging process looks like this:

  1. Use df to see total disk usage and remaining available space.
  2. Use du to drill down into specific directories and locate the largest files.
  3. Keep narrowing the search until you find the offending files or directories.

These example commands give you a quick diagnostic toolkit that can be run on almost any Linux or Unix system.

Back to top

Check overall disk usage

To see total disk space and remaining available space across all mounted filesystems use:

df -h
Back to top

Identify large files and directories

To list the top 10 largest files/directories in the current directory in a human-readable format:

du -sh * | sort -rh | head -10
du -sh *Summarizes (-s) the disk usage of all files and directories in the current location in a human-readable format (-h).
sort -rhSorts the output in reverse order (-r) based on human-readable numerical values (-h).
head -10Displays only the top 10 entries from the sorted list.

This helps you quickly reveal the biggest files and directories so you know where to continue debugging. You can navigate into a large directory and rerun the command to further drill down to narrow the results.

Back to top

Additional examples worth knowing

These additional examples help expand the debugging toolkit and are commonly used when tracking down disk space problems.

Show disk usage for a specific filesystem

df -h /var

This limits the output to the filesystem containing /var, which can be helpful on systems with many mounted volumes.

Show inode usage

Sometimes disks appear full even when space remains because inodes are exhausted.

df -i

If inode usage hits 100%, the system cannot create new files even though disk space exists.

Find the largest files across the entire filesystem

find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

This lists files larger than 500 MB across the entire system.

Drill into a single directory more interactively

du -h --max-depth=1

This shows directory sizes one level deep, making it easier to navigate large trees step by step.

Sort files by size using ls

ls -lhS

This sorts files in the current directory by size, largest first.

Back to top