Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .