How to list package download size for those that need to be updated by pacman?

pacman -Syu outputs a list of packages that need be updated. It then prints the total update size (i.e. how much data to download).

My question is: is there a way to get the download size for each packet that needs to be updated? I thought that could be done maybe via expac and some text handlin, but I couldn’t figure out how.

I was thinking an output print like:

package1-name X MB
package2-name X MB
...
Asked By: edmz

||

Yes there is.

All that’s needed is to enable VerbosePkgLists in pacman.conf, which according to the documentation:

Displays name, version and size of target packages formatted as a table for upgrade, sync and remove operations.

This for instance produces

Package (183)                    Old Version            New Version            Net Change  Download Size

core/bash                        5.1.004-1              5.1.008-1                0.01 MiB       1.65 MiB
Answered By: edmz
pacman -Qui | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h

from a slightly modified version of this command from the wiki

Answered By: 1I1III1
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.