Can I show how much disk space a directory's contents are using, not including its sub directories (and their contents)? If so, what commands(s) please? Thanks.

  • 1
    du -sh /etc < example – Qasim Nov 3 '13 at 6:28
  • 1
    perhaps someone can expand on that, explain the parts, and post it as an answer that can be accepted? – bcsteeve Nov 3 '13 at 22:50

Excerpt of du --help:

-h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
-S, --separate-dirs   do not include size of subdirectories
-s, --summarize       display only a total for each argument


du -Shs /path/to/dir

should give you what you want.

| improve this answer | |
  • Thanks. When I asked that question, I hadn't yet discovered the wonder that awaits with "--help" on many commands :) – bcsteeve Nov 12 '13 at 15:43
  • Wow that was a lot easier than I thought. --separate-dirs I've never heard of. – Sridhar Sarnobat Aug 31 '19 at 17:01

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.