Display Human Readable File + Directory Size Summaries on the *nix Command Line

Chris Simpkins
sweetmeat
Published in
1 min readOct 12, 2017

This article demonstrates how to display the size of any combination of files and directories in a human readable format on the *nix command line with the disk usage statistics du executable.

The following commands work on both Linux and OS X platforms.

Size Summaries by File or Directory Path

Usage

Add one or more file and/or directory path arguments to the du -sh command:

$ du -sh [file/dir path 1] ([file/dir path 2] ...)

Example

$ du -sh test.py builddir

Size Summaries by Filepath Wildcard

Usage

Use a wildcard argument with the du -sh command:

$ du -sh [wildcard]

Example

$ du -sh *.png

--

--