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?
Add a comment
|
3 Answers
You can also use
du -csh foldername/*
which gives file and folder sizes under "foldername" separately and the total size in last row.
-
1The
-c
is helpful if you are selecting a subset of files in a folder. For example, if you're trying to see how big your web assets are, you could usedu -csh folder/*.js
to measure only the JS files, omitting CSS and HTML.– user9320Commented Apr 9, 2020 at 16:14