Tips & Tricks

Howto check the estimate file space usage of a directory recursively

This tutorial will guide you how to check the estimate file space usage of directory recursively.

This is pretty simple to be done.

Just enter the directory and execute the following command:

TheDude@TheBox ~# du -ah

This should output something like this:

TheDude@TheBox test# du -ah
12K ./test
20K ./test4
168K ./test3
168K ./test2folder/secondOne
172K ./test2folder
8.0K ./test2
384K .
TheDude@TheBox test#

More information about the switches:

-a, –all
write counts for all files, not just directories
-h, –human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

You can also use it like this:

TheDude@TheBox test# du -sh
384K .
TheDude@TheBox test#

This skips the -a switch and executes the -s switch which is skipping the file listing.

-s, –summarize
display only a total for each argument

There are many other switches that you can use. You can preview them using the command:

TheDude@TheBox test# man du

Leave a Reply