Search code examples
linuxbash

How to show the disk usage of each subdirectory in Linux?


I have a directory, /var/lib/docker, which contains several subdirectories:

/var/lib/docker$ sudo ls
aufs  containers  image  network  plugins  swarm  tmp  trust  volumes

I'd like to find out how big each directory is. However, using the du command as follows,

/var/lib/docker$ sudo du -csh .
15G .
15G total

I don't see the 'breakdown' for each directory. In the examples I've seen in http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/, however, it seems that I should see it. How might I obtain this overview to see which directory is taking up the most space?


Solution

  • Use asterisk to get info for each directory, like this:

    sudo du -hs *
    

    It will output something like the below:

    0       backup
    0       bin
    70M     boot
    0       cfg
    8.0K    data
    0       dev
    140K    docs