List & Sort File & Folder Sizes in Current Directory

The cPanel file manager is extremely useful in most circumstances. However it has a hard time displaying accurate information about total folder sizes. For example if you go to the file manager and look at the size of public_html directory you’ll notice it doesn’t show the actual size.

The following command makes its easy to see folder sizes for an account so you can quickly determine where the large files may be hiding. This is useful for cleaning hacked websites, or when an account is over-quota.

#first navigate to the directory you wish to get information about
cd /home/username/
du -a -h --max-depth=1 | sort -hr