du
estimates the size of a directory by recursively traversing and stating its files.
Examples
All these examples use -h
for better readability. Without -h
, du
will output the
size in # of 1k blocks.
Standard Usage
Get the current directory size
$ du -h ./
8.0K ./scss
336K ./img/thumbnails
2.6M ./img
2.6M ./
Limit output directory depth
Just this directory’s contents
$ du -h -d 1 ./
8.0K ./scss
2.6M ./img
2.6M ./
Just this directory
$ du -h -d 0 ./
2.6M ./
Include Files in Output
$ du -h -a ./
4.0K ./scss/style.scss
8.0K ./scss
1.4M ./img/my-rice.png
60K ./img/thumbnails/charcoal-engine-screenshot.png
16K ./img/thumbnails/discord-sandboxed-screenshot.png
136K ./img/thumbnails/tab-yoinker-screenshot.png
120K ./img/thumbnails/cordis-screenshot.png
336K ./img/thumbnails
712K ./img/beefslab.kra
180K ./img/beefslab.png
2.6M ./img
2.6M ./