Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #269910
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: tree with dir size |
| Date | 2024-06-04 00:30 +0200 |
| Message-ID | <ILolH-p9f-13@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <IKfXb-hhoO-1@gated-at.bofh.it> <IKgJz-hhTQ-25@gated-at.bofh.it> <ILgo9-kbf-1@gated-at.bofh.it> <ILh0R-kDd-7@gated-at.bofh.it> <ILmMV-o6h-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jun 03, 2024 at 10:45:28PM +0200, Franco Martelli wrote:
> On 03/06/24 at 16:32, Greg Wooledge wrote:
> > duhs() {
> > (
> > shopt -s dotglob
> > printf '%s\0' "${1:-.}"/*/ | xargs -0 du -sh
> > )
> > }
>
> I've some issue with this function. It doesn't show the size of the
> directory specified as argument, it follows the output of my original
> function:
I started writing a response to this, because it seemed easy enough to
fix -- just add "${1:-.}" to the printf arguments, so it gets passed
along to du -sh, and included in the output.
But then I tested it.
hobbit:~$ du -sh /usr/local /usr/local/bin
684M /usr/local
What? Where's the second line?
hobbit:~$ du -sh /usr/local/bin /usr/local/etc
81M /usr/local/bin
4.0K /usr/local/etc
Multiple arguments are allowed....
hobbit:~$ du -sh /usr/local/bin /usr/local/etc /usr/local
81M /usr/local/bin
4.0K /usr/local/etc
603M /usr/local
You're even allowed to have a parent directory after its children...
hobbit:~$ du -sh /usr/local /usr/local/bin /usr/local/etc
684M /usr/local
... but if the parent is FIRST, the children get... swallowed up by
it? Huh? And if the parent is last, then the value shown for the
parent excludes the children that were already reported on?
Why the HELL is it like this?!
It doesn't even match its own documentation. Here's what the info
page says:
‘-s’
‘--summarize’
Display only a total for each argument.
There's supposed to be a total *FOR EACH ARGUMENT*. There isn't.
OK, I officially wash my hands of ANY solution based on du -s. If
you want to try to make it work sensibly, more power to you. As far
as I'm concerned, though, this is broken. Irreparably broken.
It looks like tree(1) is less broken, so it might be better to stick
with that, even if you have to pipe the output through grep to get what
you want.
*Sigh*.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
tree with dir size Northwind <nw@secubox.org> - 2024-05-31 00:30 +0200
Re: tree with dir size eben@gmx.us - 2024-05-31 01:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 01:00 +0200
Re: tree with dir size Northwind <nw@secubox.org> - 2024-05-31 01:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 01:10 +0200
Re: tree with dir size eben@gmx.us - 2024-05-31 02:10 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 02:20 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-05-31 21:20 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-05-31 22:10 +0200
Re: tree with dir size David Wright <deblis@lionunicorn.co.uk> - 2024-06-01 04:40 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-01 05:20 +0200
Re: tree with dir size Lee <ler762@gmail.com> - 2024-06-01 16:20 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 16:00 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-03 16:40 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-03 21:10 +0200
Re: tree with dir size David Wright <deblis@lionunicorn.co.uk> - 2024-06-04 02:40 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 22:50 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 00:30 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 03:50 +0200
Re: tree with dir size Greg Wooledge <greg@wooledge.org> - 2024-06-04 16:50 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-04 16:50 +0200
Re: tree with dir size Andy Smith <andy@strugglers.net> - 2024-06-03 16:40 +0200
Re: tree with dir size <tomas@tuxteam.de> - 2024-06-03 19:10 +0200
Re: tree with dir size Franco Martelli <martellif67@gmail.com> - 2024-06-03 23:00 +0200
Re: tree with dir size <tomas@tuxteam.de> - 2024-06-03 16:40 +0200
Re: tree with dir size Sridhar M A <alaymari@gmail.com> - 2024-05-31 02:50 +0200
Re: tree with dir size Felix Miata <mrmazda@earthlink.net> - 2024-05-31 03:30 +0200
csiph-web