How do I determine the size of a directory?
Author: Deron Eriksson
Description: This tutorial demonstrates how to determine the size of a directory.
Tutorial created using: CentOS release 4.6


The size of a directory and its contents can be determined using the "du" command in Linux. It has a variety of options that you can view via "du --help".

Below, we can see several du examples. The first example displays a summary of the contents of the "abbot" directory.

du -s abbot

The "h" switch can be used to display the reported sizes in a "human-readable" form. The following command displays the summary of the abbot directory in human-readable form.

du -hs abbot

The following command displays the sizes of the abbot directory and its subdirectories in human-readable form.

du -h abbot

The last command displays the sizes of the abbot directory and all its subdirectories and files in human-readable form.

du -ha abbot
du commands

The du command can be run with a variety of switches. For more information on du, consult "man du" or "du --help".