is there a way to read the cumulative size of all files in a folder?

7

4

I want to read the size of a folder from the command line. ls -lh shows all folders as being 4k, which presumably is the size of the footprint of the folder itself, rather than the contained files. I would like to read the size of all contained files within the folder. is this possible?

ewok

Posted 2012-05-10T15:08:09.927

Reputation: 2 743

Answers

8

You can use the du command:

du -sh foldername

Annie

Posted 2012-05-10T15:08:09.927

Reputation: 101

4

du -s folder

-s stands for summarize.

johnshen64

Posted 2012-05-10T15:08:09.927

Reputation: 4 399

2

You can also use

du -csh foldername/*

which gives file and folder sizes under "foldername" separately and the total size in last row.

user471130

Posted 2012-05-10T15:08:09.927

Reputation: 21