I often use
du --max-depth=n -h | sort --human-numeric-sort
Now I want to use tree
, in a similar manner.
I found here a partial answer
tree -sh --sort=size --du
where --du
makes tree
reporting the cumulative size for each directory (as du
).
This reports each file as well.
If I want to report only directories, I should add -d
to tree
.
But -d
seems to do two things:
- Remove files from the report.
- Remove the size of files from the cumulative total computed for each dir.
Of course, I want only 1, not 2 (as du
does).
So
tree -sh --sort=size --du -d
would always report "small" sizes, without considering file sizes.
Can tree
overcome this? Is there any alternative?
tree
,tree
only summarizes what it sees... – pLumo Jul 13 '20 at 09:52du --max-depth=n -h | sort --human-numeric-sort
is really what I want. Thank you alot. Most of other tutorials on the internet just talk aboutdu
, and using it just show vague info like /sda... which is not helpful at all. – Thang Nguyen Mar 04 '22 at 04:52