Re: tree with dir size
- To: debian-user@lists.debian.org
- Subject: Re: tree with dir size
- From: David Wright <deblis@lionunicorn.co.uk>
- Date: Fri, 31 May 2024 21:35:59 -0500
- Message-id: <ZlqJD/Fe9/gY3t6L@axis.corp>
- Reply-to: debian-user@lists.debian.org
- In-reply-to: <ZlotCghtYnUYbcGQ@wooledge.org>
- References: <2125e140-e373-4bcb-905a-dba541c0eaad@secubox.org> <dcf9a8b2-247d-4479-94e8-310b26b706a5@gmx.us> <ZlkDoTCAvfB4xIbD@wooledge.org> <90f5af69-e4ef-4d4f-bf7f-c2948f421fbf@gmx.us> <ZlkXaaY0k_6dbQ3q@wooledge.org> <064d4db1-c7c3-4f86-aa19-b102711d4280@gmail.com> <ZlotCghtYnUYbcGQ@wooledge.org>
On Fri 31 May 2024 at 16:03:22 (-0400), Greg Wooledge wrote:
> On Fri, May 31, 2024 at 09:18:03PM +0200, Franco Martelli wrote:
> > On 31/05/24 at 02:18, Greg Wooledge wrote:
> > > Confusing and useless. I still don't have a better answer than this:
> > >
> > > hobbit:~$ tree --du -Fh /tmp/x | grep /$
> > > [7.8M]/tmp/x/
> > > └── [4.0K] y/
> >
> > It could be improved adding the "-a" switch to show also the hidden
> > directories and the "--color" switch to the "grep" command but this sadly
> > doesn't show the expected result (colorized directories) I don't know why:
> >
> > ~$ tree --du -Fah /tmp/x | grep --color /$
>
> You're only coloring the trailing / characters. If you want everything
> from after the last space to the end of the line, you'd want:
>
> tree --du -Fh /usr/local | grep --color '[^[:space:]]*/$'
>
> Of course this fails to colorize the entire directory name if there's
> a space in it.
If a coloured ] is unimportant, I suppose you could use:
tree --du -Fh whatever | grep --color '][[:space:]][[:space:]].*/$'
Cheers,
David.
Reply to: