DOS sums up the sizes of all the files it lists when using the dir command, but Linux ls does not. Here’s an awk script that will calculate that information.

1
ls -la [filenames] | awk '{ sum += $4 } END { print sum }'

An easier command (thanks Sunny):

1
du -hs * --total
 

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>