Directory size in CentOS

Directory size in CentOS or in any other linux system such as RHEL or Ubuntu can be found by using du (Disk usage command). “du” command not only lists the size of directories, it also lists the subdirectories and all the files that are within the directories and subdirectories but it can be suitably modified to display only directories as shown below

 du -sh file(s) name(s) or du -sh /path/to/dir/*

For e.g Let us say I have a directory structure like this as shown below

And I want to see what is directory size of “SouthPole” directory then I should run the below command as shown below

du -sh /directorypath/

You may also like...