du

The command that adds up how much disk space a directory and everything below it uses.

In more detail

du -sh dir gives one readable total. Where df asks how full the disk is, du asks what is filling it.

Examples

du -sh data
du -sh /var/* ranks the directories under /var. It walks names, so it cannot see deleted files still held open, and if df and du disagree, look for those next. Add -x to stay on one filesystem.
log=8G cache=2G next=handles ranks directories, then checks open handles if totals disagree.

Related terms

Taught in

References

Certification courses