Disk Usage Summary in Linux or macOS

Here is a simple way to get a disk usage summary in Linux or Mac OS X using the command-line. The “du” command is the conventional choice but gives a lot of information by default.

So, here is the exact syntax for “du” to return just the single, bottom-line, disk usage value in <somedir>:

du -chs <somedir>

An example, for the current directory, where <somedir> is replaced with a period:

du -chs .

Options Summary

-c, --total (produce a grand total)
-h, --human-readable (print sizes in human readable format (e.g., 1K 234M 2G))
-s, --summarize (display only a total for each argument)

The key word here is “summarize”, that is, providing just the disk total usage for each argument.

Leave a comment

Your email address will not be published. Required fields are marked *