I know I can use du -h to output the total size of a directory. But when it contains other subdirectories, the output would be something like:
du -h /root/test
.
.
.
.
24K /root/test/1
64K /root/test/2
876K /root/test/3
1.1M /root/test/4
15M /root/test/5
17M /root/test
I only want the last line because there are too many small directories in the /root/test
directory. What can I do?
Add the --max-depth
parameter with a value of 0:
du -h --max-depth=0 /root/test
Or, use the -s
(summary) option:
du -sh /root/test
Either of those should give you what you want. For future reference, man du
is very helpful.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments