Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #269730 > unrolled thread
| Started by | Northwind <nw@secubox.org> |
|---|---|
| First post | 2024-05-31 00:30 +0200 |
| Last post | 2024-05-31 03:30 +0200 |
| Articles | 7 on this page of 27 — 10 participants |
Back to article view | Back to linux.debian.user
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
Page 2 of 2 — ← Prev page 1 [2]
| From | Franco Martelli <martellif67@gmail.com> |
|---|---|
| Date | 2024-06-04 16:50 +0200 |
| Message-ID | <ILDE5-yuR-3@gated-at.bofh.it> |
| In reply to | #269914 |
On 04/06/24 at 03:48, Greg Wooledge wrote:
> On Mon, Jun 03, 2024 at 07:42:17PM -0500, David Wright wrote:
>> On Mon 03 Jun 2024 at 18:29:17 (-0400), Greg Wooledge wrote:
>>> ‘-s’
>>> ‘--summarize’
>>> Display only a total for each argument.
>>>
>>> There's supposed to be a total *FOR EACH ARGUMENT*. There isn't.
>>
>> Try adding -l. The idea is that du is trying to avoid double-counting,
>> so when the subdirectories come first, those ones are "used up" by
>> the time it reaches the parent. When the parent is first, it's (all)
>> the subdirectories instead that have been "used up".
>
> ‘-l’
> ‘--count-links’
> Count the size of all files, even if they have appeared already (as
> a hard link).
>
> This documentation leaves a lot to be desired.
>
> Anyway, you are correct about the result, even if the documentation gives
> no realistic way to conclude such a result.
>
> hobbit:~$ printf '%s\0' "${1:-.}" "${1:-.}"/*/ | xargs -0 du -shl
> 684M /usr/local
> 81M /usr/local/bin/
> 4.0K /usr/local/etc/
> 4.0K /usr/local/games/
> 136K /usr/local/include/
> 45M /usr/local/lib/
> 29M /usr/local/man/
> 8.0K /usr/local/sbin/
> 31M /usr/local/share/
> 484M /usr/local/src/
> 44M /usr/local/tcl8.6/
>
FYI the revision of duhs() I adopt is:
duhs() { ( shopt -s dotglob; printf '%s\0' "${1:-.}" "${1:-.}"*/ | xargs
-0 du -shl ) } ↑
Please note that I dropped a "/" in the "${1:-.}"/*/ block because the
directories listed had a double "//" in their names:
~# duhs /usr/local/
88K /usr/local/
4,0K /usr/local//bin/
4,0K /usr/local//etc/
4,0K /usr/local//games/
4,0K /usr/local//include/
4,0K /usr/local//man/
4,0K /usr/local//sbin/
60K /usr/local//share/
4,0K /usr/local//src/
Thank again,
Cheers,
--
Franco Martelli
[toc] | [prev] | [next] | [standalone]
| From | Andy Smith <andy@strugglers.net> |
|---|---|
| Date | 2024-06-03 16:40 +0200 |
| Message-ID | <ILh0R-kDd-9@gated-at.bofh.it> |
| In reply to | #269866 |
Hi, On Mon, Jun 03, 2024 at 03:52:54PM +0200, Franco Martelli wrote: > "tree" detects that its std output goes through a pipe and > therefore it disables the escaped code to colorize (like also > "dmesg" does). To avoid this behavior you must use the "unbuffer" > command: > > unbuffer tree --du -Fah /usr/local | grep /$ If that's the only thing you're using unbuffer for, why not just use the -C option of tree? It's a bit like the "--color=always" of ls. > You can also try: > > ~# unbuffer dmesg | grep snd Similarly dmesg has "--color=always". I guess one advantage of unbuffer for this purpose is that you don't need for an option to exist or to know what it is if it does. Thanks, Andy -- https://bitfolk.com/ -- No-nonsense VPS hosting
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2024-06-03 19:10 +0200 |
| Message-ID | <ILjm1-m8Q-1@gated-at.bofh.it> |
| In reply to | #269869 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jun 03, 2024 at 02:36:43PM +0000, Andy Smith wrote: [...] > If that's the only thing you're using unbuffer for, why not just use > the -C option of tree? It's a bit like the "--color=always" of ls. Oh, and the complementary option for `less', while we're at it, would be -R: tree -C | less -R (I tend to add -SX to less: people might like those or not). Cheers -- t
[toc] | [prev] | [next] | [standalone]
| From | Franco Martelli <martellif67@gmail.com> |
|---|---|
| Date | 2024-06-03 23:00 +0200 |
| Message-ID | <ILmWB-o9C-7@gated-at.bofh.it> |
| In reply to | #269869 |
On 03/06/24 at 16:36, Andy Smith wrote: >> unbuffer tree --du -Fah /usr/local | grep /$ > If that's the only thing you're using unbuffer for, why not just use > the -C option of tree? It's a bit like the "--color=always" of ls. > Yeah, RTFMB4 I've all the "aliases" with the "unbuffer" command… Cheers, -- Franco Martelli
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2024-06-03 16:40 +0200 |
| Message-ID | <ILh0R-kDd-3@gated-at.bofh.it> |
| In reply to | #269866 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jun 03, 2024 at 03:52:54PM +0200, Franco Martelli wrote: > > > > > > ~$ 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:]]*/$' > > I realized why "tree" command doesn't colorized the directories: "tree" > detects that its std output goes through a pipe and therefore it disables > the escaped code to colorize (like also "dmesg" does). That's what the "-C" option to tree is for. Cheers -- "if everything else fails, read the man page" tomas
[toc] | [prev] | [next] | [standalone]
| From | Sridhar M A <alaymari@gmail.com> |
|---|---|
| Date | 2024-05-31 02:50 +0200 |
| Message-ID | <IJYCZ-h0O9-3@gated-at.bofh.it> |
| In reply to | #269730 |
On Fri, May 31, 2024 at 3:59 AM Northwind <nw@secubox.org> wrote: > > is there a command that shows dir/subdir structure like `tree`, but for > each dir has the size in results as well? > You can try the program broot (https://dystroy.org/broot/) which does things you have mentioned and much more. Regards, -- Sridhar M. A.
[toc] | [prev] | [next] | [standalone]
| From | Felix Miata <mrmazda@earthlink.net> |
|---|---|
| Date | 2024-05-31 03:30 +0200 |
| Message-ID | <IJZfH-h1hW-1@gated-at.bofh.it> |
| In reply to | #269730 |
Northwind composed on 2024-05-31 06:28 (UTC+0800): > is there a command that shows dir/subdir structure like `tree`, but for > each dir has the size in results as well? Is ncdu any use to your need? -- Evolution as taught in public schools is, like religion, based on faith, not based on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.debian.user
csiph-web