WEBSITE & App Builder

Lorem Ipsum is simply dummy text of the printing and type setting industry. Lorem Ipsum has been the industry’s standard dummy text.

Finding the heaviest files or folders in Debian.

Keeping the server clean is quite an activity and for me where my companies DNA is to create SAAS based platforms. Users are responsible for most of the uploads.

I needed a quickly find out which folders or files are taking most of the space on our server and I found the following command.

sudo du -a /var/www/ | sort -n -r | head -n 500

Basically it gives you an output with

  1. Size of the File.
  2. Name of the file
42638348        /var/www/
33049436        /var/www/sites
5245756 /var/www/access.log
4889300 /var/www/sites/instance_2221
4870372 /var/www/sites/instance_2221/instance_2220
4797768 /var/www/sites/instance_2221/instance_2220/gallery

Well, the size is quite not readable so we need a way to display in KB, MB, or GB.

 sudo du -h   -a  /var/www/ | sort -h -r | head -n 10

The output of this is much easier to understand.

You can use these commands on Debian or other Linux variants.