How to Get Size of Folder (and all its contents) in Linux / Unix via PuTTy Terminal

Robin ScottLinux Tutorials0 Comments

If you ever wanted to know “how big is that directory?” and by this you mean the entire directory, and you have access over SSH, via PuTTy or similar, to your Linux machine, then there is a little command which will tell you, in useful units, exactly what the contents of a directory add up to… in total.

Get Size of Folder (and all its contents) via Terminal

du -msh FolderName

Where FolderName = the name of the folder you would like to assess the size of!

This is a good alternative to using just

du -h FolderName

Which will output a list of folder content(s), with the relative size(s). So, depending on the circumstances, you may find either of the above helpful implementations of the du command.

du is the command for “disk usage” which basically means “how much disk does this use???”.

For more on this, see here.

Leave a Reply

Your email address will not be published. Required fields are marked *