I am able to get a size of a directory at the end of the du -h directoryname. But is there a way to get the size without it listing the files/directories within?

I'm currently doing it like this:

du -h directoryname | tail -n1

How to keep an index of directory sizes? Is there an Ubuntu application/software for that?

2 Answers 2


The -s option for du will give you an output which is just the summary, so swap your command to:

du -sh /path/to/directory

You can use:

du -d 0 -h directoryname

From man du:

-d, --max-depth=N
print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument;

If you want a GUI application to do that, you can use Disk Usage Analyzer (or baobab), to check:

enter image description here

Or use the 'Properties' feature (in most file managers):

enter image description here

The last one I think caches a bit unless a noticeable change occurs (in Nemo anyway).

  • 1
    I'm curious to know what theme are you using? Aug 17, 2015 at 17:50
  • 1
    @RahilWazir Arc-Darker on Gnome 3.14 :)
    – Wilf
    Aug 17, 2015 at 18:16
  • The -S switch is equivalent to -d 0, (and shorter); for details see info du | sed -n "/‘-\(S’$\|d \)/,/^$/p".
    – agc
    Jun 14, 2019 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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