How to Check Directory Size in Linux Using du

The du command is the quick way to check how much disk space a directory is using on Linux or Unix systems.

Check the size of a directory

du -sh /path/to/directory

Example:

du -sh /var/www/

Example output:

1.5G    /var/www/

Options used

  • -s: show only the total size for the directory.
  • -h: show the result in a human-readable format such as KB, MB or GB.

This is useful when checking log directories, web roots, backup folders or any path that may be consuming unexpected disk space.

Leave a Comment