5

I am new to Ubuntu and Linux in general. I am trying to determine what is taking so much disk space, so I run the following command:

du / -h -d 2 | sort -hr

which outputs the following

7.3G    /
5.1G    /var
3.8G    /var/www
1.1G    /usr
635M    /var/lib
573M    /var/cache
570M    /lib
474M    /lib/modules
354M    /usr/share
308M    /usr/src
262M    /usr/lib
135M    /usr/bin
118M    /var/log

What does the first line of output mean? why or how could / (nothing?) be taking up 7GB of space?

3
  • 6
    have you noticed if you add up all those values they equal 7.3G?
    – zeitue
    Feb 27, 2014 at 5:20
  • 1
    @TaylorBioniks of course you mean all of the 1 level deep values. Feb 27, 2014 at 7:54
  • 3
    To complement the answers, your error lies in / (nothing?). In fact / contains everything.
    – Calimo
    Feb 27, 2014 at 13:00

2 Answers 2

14

Everything you see is under / so its the sum up value of everything :P

3
  • Thank you for explain it in diagrammatically i should have explain like this i am sure that this diagram will help any one to understand the scenario. Feb 27, 2014 at 5:28
  • 5
    Need to give image citation linuxplanet.com/linuxplanet/tutorials/6666/1
    – user13107
    Feb 27, 2014 at 7:21
  • Now I feel stupid, thank you for this, makes total sense.
    – kisonay
    Feb 27, 2014 at 12:04
4

The numbers du gives are cumulative. I.e. it's the space taken up by everything in the directory plus everything underneath the directory. The number for / therefore is how much space all the files on the filesystem are taking.

If you don't want cumulative numbers, you can use du -S.

2
  • Understood. I was basically looking to see which root folders had the most space. Thank you for the response.
    – kisonay
    Feb 27, 2014 at 12:05
  • 1
    @kisonay For that use Baobab or Filelight, two common disk usage analyzers (there are command line tools too). Feb 27, 2014 at 15:17

You must log in to answer this question.

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