Finding all file sizes with the “du” command of current directory

The following command will display all files and folders sorted by MegaBytes.

du –max-depth=1 | sort -n | awk ‘BEGIN {OFMT = “%.0f”} {print $1/1024,”MB”, $2}’

You should see an output of all your folders with the size of them in megabytes similar to the following:

This output shows that all files over 1 MB are in the /public_html. You can run this command on a directory basis to find folders that are large. Also, this command can be customized to refne your search.