[Shell command] Show a directory's total disk usage

Created on November 30, 2026

Use du -sh to summarize a directory's disk usage in units such as K, M, or G.

mkdir -p sample
printf 'hello\n' > sample/message.txt
du -sh sample

The output may look like this, depending on the filesystem and its allocation.

8.0K    sample

-s reports the total and -h formats it in human-readable units. du reports disk space used, which can differ from the apparent size of the files.

Reference

Shell command du