Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
A simple way to count the total size of installed packages?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1572
Location: KUUSANKOSKI, Finland

PostPosted: Thu Oct 25, 2018 5:09 pm    Post subject: A simple way to count the total size of installed packages? Reply with quote

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 :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
AJM
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 99
Location: Aberdeen, Scotland

PostPosted: Thu Oct 25, 2018 5:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10353
Location: Somewhere over Atlanta, Georgia

PostPosted: Thu Oct 25, 2018 5:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14281

PostPosted: Fri Oct 26, 2018 1:15 am    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5961

PostPosted: Fri Oct 26, 2018 2:41 am    Post subject: Reply with quote

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
View user's profile Send private message
khumba
n00b
n00b


Joined: 16 Jun 2011
Posts: 43

PostPosted: Sat Oct 27, 2018 4:01 am    Post subject: Reply with quote

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. :roll:

The initial command reports 21GiB here. The largest are blender and ghc, 1.38GiB and 1.09GiB respectively.
Back to top
View user's profile Send private message
i4dnf
Apprentice
Apprentice


Joined: 18 Sep 2005
Posts: 266
Location: Bucharest, Romania

PostPosted: Sat Oct 27, 2018 7:02 am    Post subject: Reply with quote

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
View user's profile Send private message
khumba
n00b
n00b


Joined: 16 Jun 2011
Posts: 43

PostPosted: Sat Oct 27, 2018 9:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 117

PostPosted: Sat Oct 27, 2018 10:47 am    Post subject: Re: A simple way to count the total size of installed packag Reply with quote

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
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1572
Location: KUUSANKOSKI, Finland

PostPosted: Sat Oct 27, 2018 7:43 pm    Post subject: Re: A simple way to count the total size of installed packag Reply with quote

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 :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum