Get Install Size of a Package with Pacman and Apt
Knowing how big a package is with and without dependencies is a handy metric to have before installing something.
Sometimes when thinking about installing a few comparable packages but only picking one, I’ll be curious about how big a package is. I don’t always optimize for extreme minimalism but it’s something I’m generally mindful of.
# Pacman
Here’s a few outputs comparing 2 popular tools to set wallpapers with Wayland:
$ pacman -Si swaybg
...
Depends On : wayland cairo gdk-pixbuf2
Download Size : 14.80 KiB
Installed Size : 33.72 KiB
...
$ pacman -Si swwww
...
Depends On : dav1d gcc-libs glibc lz4
Download Size : 2.33 MiB
Installed Size : 8.43 MiB
...
If you want to see the true install size you can start to install it but then
cancel with n
:
$ pacman -Syu swaybg
Package (1) New Version Net Change Download Size
extra/swaybg 1.2.1-1 0.03 MiB 0.01 MiB
Total Download Size: 0.01 MiB
Total Installed Size: 0.03 MiB
:: Proceed with installation? [Y/n]
On my system, swaybg
’s dependencies didn’t need to be installed because I
already have them. The same thing happened with swww
so in this case the true
install size is the package size reported above.
Confirm a Dependency is Installed
You can run pacman -Q | grep cairo
or whatever package you want to check. If
you get a grep response back it’s already installed:
$ pacman -Q | grep -E "(wayland|cairo|gdk-pixbuf2)"
cairo 1.18.4-1
gdk-pixbuf2 2.44.3-1
wayland 1.24.0-1
# Apt
Like pacman, we can get similar stats. This is for the package itself without dependencies:
$ apt show curl
...
Depends: libc6 (>= 2.34), libcurl4t64 (= 8.14.1-2), zlib1g (>= 1:1.1.4)
Download-Size: 269 kB
Installed-Size: 506 kB
...
$ apt show wget
...
Depends: libc6 (>= 2.38), libgnutls30t64 (>= 3.8.1), libidn2-0 (>= 0.6), libnettle8t64, libpcre2-8-0 (>= 10.22
), libpsl5t64 (>= 0.16.0), libuuid1 (>= 2.16), zlib1g (>= 1:1.1.4)
Download-Size: 984 kB
Installed-Size: 3875 kB
...
To get the true install size, can also start installing a package but cancel it:
$ apt-get install --no-install-recommends curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libbrotli1 libcom-err2 libcurl4t64 libffi8 libgnutls30t64 libgssapi-krb5-2 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap2 libnghttp2-14 libnghttp3-9 libp11-kit0 libpsl5t64 librtmp1 libsasl2-2 libsasl2-modules-db libssh2-1t64 libtasn1-6
libunistring5
Suggested packages:
gnutls-bin krb5-doc krb5-user
Recommended packages:
bash-completion ca-certificates krb5-locales libldap-common publicsuffix libsasl2-modules
The following NEW packages will be installed:
curl libbrotli1 libcom-err2 libcurl4t64 libffi8 libgnutls30t64 libgssapi-krb5-2 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap2 libnghttp2-14 libnghttp3-9 libp11-kit0 libpsl5t64 librtmp1 libsasl2-2 libsasl2-modules-db libssh2-1t64 libtasn1-6
libunistring5
0 upgraded, 23 newly installed, 0 to remove and 2 not upgraded.
Need to get 4905 kB of archives.
After this operation, 14.8 MB of additional disk space will be used.
Do you want to continue?
Keep in mind I ran the apt
examples on a fresh Docker container with docker container run -it --rm debian:stable
where I only ran apt-get update
. On a
real system, you may already have some of curl’s dependencies installed. The
same goes with wget
.
The video below demonstrates running the above commands.
# Demo Video
Timestamps
- 0:32 – Comparing package sizes with pacman
- 1:21 – Seeing the true install size with dependencies
- 2:06 – Double checking if a dependency is installed
- 2:33 – Confirming with a larger package I don’t have installed
- 3:15 – Comparing package sizes with apt
- 4:40 – Seeing the true install size with apt
How often do you use disk space as a deciding factor? Let me know below.