8

du -hc *zip shows me total size of zip files in a folder, but it shows also every single file size of the folder. I only need total size.

Is there way to show the total size of a folder without showing single file sizes?

8
 du -ch *zip | grep total

Just add a grep statement in the end.

If you are against grep, you can use,

du -s *zip
-s, --summarize
display only a total for each argument
  • du -s *zip does not work for me and no need of grep anyhow du -ch *zip last line itself is total. see my answer. correct me if I am wrong. – harish.venkat May 29 '14 at 4:52
  • 1
    The -s flag summarises each argument, so if you run du -s *zip it still runs du on each .zip file, summarising each of them. It's very useful for getting a summary of how big a directory is, though. – rainbowgoblin May 29 '14 at 6:59
6

you can use du -ch *.zip | tail -1 . last line of du -ch is total. If the files have total.zip grep total will return that one as well.

  • I missed that point. Good catch :) – Ramesh May 29 '14 at 5:06

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.