Take the 2-minute tour ×

I have AWS linux instance, Currently there are many folders in the instance.
I would like to map all the folders and their size, so i could come back in 1 month and check which folder occupy high amount of storage (maybe the logging folder).

What is the best way to achieve this ?
so i could compare the size of this month and next month more easily.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

As Ignacio said, you need du, more specifically:

du -ch / > ~/folder_sizes

This will print list of the folders in / and their respective sizes in human readable format (i.e. 9.6M instead of 9796, remove the h if you do not want this). You can repeat the command a month later and compare the output.

What I usually do is a simple gawk script:

du -ch / > ~/folder_sizes.june
du -ch / > ~/folder_sizes.july
gawk '$1~/G/' ~/folder_sizes.june > big.june
gawk '$1~/G/' ~/folder_sizes.july > big.july

The gawk commands will print only those folders whose size is >=1GB, these are usually the ones you are interested in.

share|improve this answer

You're looking for the du command.

share|improve this answer

Your Answer


