View previous topic :: View next topic |
Author |
Message |
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3342 Location: Rasi, Finland
|
Posted: Thu Oct 25, 2018 5:09 pm Post subject: A simple way to count the total size of installed packages? |
|
|
So today, was, quite frankly, shocked as I needed to install M$ Office for one customer and the installation package was about 6,5Gb worth of data. I told my co-worker that my system is probably smaller than the installation package.
I quickly ssh'd to my PC and put together a cli command to calculate the size: Code: | qlist -qCa | while read line; do printf '%s\x00' "$line"; done | du --files0-from=- -hc --apparent-size | tail -n 1 | , but then thought that there must be much simpler way. I didn't came up with any, but maybe one replacing the while -loop with awk printf line.
Anyone? There must be a more neat way. Right?
BTW, my system is 7Gb, so I lost to M$ Office a bit. Although I have full LibreOffice suite installed too... _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
AJM Apprentice
Joined: 25 Sep 2002 Posts: 189 Location: Aberdeen, Scotland
|
Posted: Thu Oct 25, 2018 5:27 pm Post subject: |
|
|
It is shocking isn't it? A fairly run of the mill Windows 10 update can be several Gb in size. I don't care much about that of course since I don't use it myself, but it's sad that the same hideous bloat is slowly swamping the Linux world too - it's a mindset.
My own system is 6.4Gb using your command - this is my all-purpose full desktop machine with audio / video software, browser, mail clients, accounts software, libreoffice and much more. RAM usage on startup is about 110Mb once fully logged in to my desktop (out of 16Gb - I like to leave some for caching, tmpfs etc!) |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10589 Location: Somewhere over Atlanta, Georgia
|
Posted: Thu Oct 25, 2018 5:59 pm Post subject: |
|
|
Not shorter, but probably faster: Code: | equery size --bytes '*' | perl -n -e 'm/size\((\d+)\)/; $total += $1; END { $totalk = int($total / 1024); print "Total is $totalk\k.\n" }' | "equery size" should really have a --total option.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21624
|
Posted: Fri Oct 26, 2018 1:15 am Post subject: |
|
|
Depending on how you laid out your filesystems, this could be as simple as checking df and summing up the usage of the filesystems that host system files. If you let /home be part of /, or if you install a substantial amount of out-of-tree content that you want to exclude from the count, then this approach will not be accurate. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Fri Oct 26, 2018 2:41 am Post subject: |
|
|
A bit faster (10×):
Code: | perl -nE '$total += (stat $1)[7] if /^obj (\S+)/; END { say $total }' /var/db/pkg/*/*/CONTENTS |
Roughly 17GB here, but that's including games-* packages (9GB), and various half-gigabyte things scattered around (wine, go, noto fonts). |
|
Back to top |
|
|
khumba n00b
Joined: 16 Jun 2011 Posts: 51
|
Posted: Sat Oct 27, 2018 4:01 am Post subject: |
|
|
John R. Graham wrote: | "equery size" should really have a --total option. |
I was about to suggest "qsize --sum[-only]", but it doesn't understand hard links. It says Git is 884MiB rather than 68MiB, because it shares a binary for all of its commands.
The initial command reports 21GiB here. The largest are blender and ghc, 1.38GiB and 1.09GiB respectively. |
|
Back to top |
|
|
i4dnf Apprentice
Joined: 18 Sep 2005 Posts: 271 Location: Bucharest, Romania
|
Posted: Sat Oct 27, 2018 7:02 am Post subject: |
|
|
khumba wrote: | The initial command reports 21GiB here. The largest are blender and ghc, 1.38GiB and 1.09GiB respectively. |
O.T.: something's weird there, as here blender is only ~135MiB _________________ "The only difference between me and a madman is that I am not MAD" (SALVATOR DALI) |
|
Back to top |
|
|
khumba n00b
Joined: 16 Jun 2011 Posts: 51
|
Posted: Sat Oct 27, 2018 9:46 am Post subject: |
|
|
i4dnf wrote: | O.T.: something's weird there, as here blender is only ~135MiB |
It looks like it's USE=doc being egregious, causing Blender to ship multi-megabyte HTML pages containing Blender's source. The API doc pages aren't small either.
Code: | $ du -sh /usr/share/doc/blender-2.79b-r1/
1.2G /usr/share/doc/blender-2.79b-r1/
$ find /usr/share/doc/blender-2.79b-r1/ | wc -l
27547 |
|
|
Back to top |
|
|
Blind_Sniper Guru
Joined: 20 Apr 2018 Posts: 340
|
Posted: Sat Oct 27, 2018 10:47 am Post subject: Re: A simple way to count the total size of installed packag |
|
|
Zucca wrote: |
I needed to install M$ Office for one customer and the installation package was about 6,5Gb worth of data. |
Hmm, I have a full installation package of MS Office Suite with the size of 968 Mb.
It includes Word, Excel, Access, Publisher, Outlook, PowerPoint, InfoPath, SharePoint, Lync and OneNote.
Just wondering where did you get that 6,5 Cb package? |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3342 Location: Rasi, Finland
|
Posted: Sat Oct 27, 2018 7:43 pm Post subject: Re: A simple way to count the total size of installed packag |
|
|
Blind_Sniper wrote: | Just wondering where did you get that 6,5 Cb package? | From Microsoft.
The size you gave is more sensible. I wonder why the installer file is that big... _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
|