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.
Asked
Active
Viewed 3.0k times
13
-
1du -sh /etc < example – Qasim Nov 03 '13 at 06:28
-
2perhaps someone can expand on that, explain the parts, and post it as an answer that can be accepted? – bcsteeve Nov 03 '13 at 22:50
1 Answers
21
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
Running:
du -Shs /path/to/dir
should give you what you want.

Eric Carvalho
- 54,385
-
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