Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.
Thanks.

share|improve this question
add comment

2 Answers

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
add comment

You're looking for the du command.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.