Who's online

How to find total size of a directory and all its sub directories in Linux or Unix

The command to find out the total size of a directory, files contained in it and all its subdirectories is as follows:

du -ch | grep total

This will sit chugging for a while and then finally output only the total size of the directory and its subdirectories.

The -c option basically asks it to produce a "grand total" of all the directories. h simply is for human readable and | grep total just outputs the line which has total next to it, omitting everything else