gslewis.id.au:~
The Bedlington Ape

Identifying large packages in Slackware

The Slackware repository includes the PACKAGES.TXT file which lists in alphabetic order all the packages in the distribution, their package set, description, and compressed and uncompressed sizes.

A sample PACKAGES.TXT entry
PACKAGE NAME:  llvm-20.1.6-x86_64-2.txz
PACKAGE LOCATION:  ./slackware64/d
PACKAGE SIZE (compressed):  231772 K
PACKAGE SIZE (uncompressed):  2383930 K
PACKAGE DESCRIPTION:
llvm: llvm (LLVM compiler toolkit)

The "PACKAGE SIZE (uncompressed)" value gives an idea of how much space the installed package will use. The following awk script will print the uncompressed package size in kilobytes, the package set, and the package name.

pkg_size_list.awk - Awk script to extract package size
/PACKAGE NAME/ { NAME=$3 }
/PACKAGE LOCATION/ { split($0, parts, "\\/"); SET=parts[3] }
/PACKAGE SIZE \(uncompressed\)/ { SIZE=$4 }
/PACKAGE DESCRIPTION/ { printf("%-7d %4s  %s\n", SIZE, SET, NAME) }

To get the list of package sizes, sorted from largest to smallest, run as:

awk -f pkg_size_list.awk path/to/PACKAGES.TXT | sort -nr > pkg_list.sorted

The resulting list can be used to find packages that could potentially be removed to free up disk space. Don’t break your system though! It’s OK to remove kernel-source to free up 1.5 GB but perhaps don’t remove kernel-generic to save 400 MB.

pkg_list.sorted
2383930    d  llvm-20.1.6-x86_64-2.txz
1581090    a  kernel-firmware-20250529_167118c-noarch-1.txz
1519180    k  kernel-source-6.12.31-noarch-1.txz
653160     l  qt6-6.8.3_20250319_bab1fecd-x86_64-3.txz
603920     d  rust-1.87.0-x86_64-2.txz
483880     l  glibc-i18n-2.41-x86_64-2.txz
425680     a  kernel-generic-6.12.31-x86_64-1.txz
421580     d  google-go-lang-1.24.2-x86_64-1.txz
385820    ap  mariadb-11.4.7-x86_64-2.txz
375670     t  texlive-2024.240409-x86_64-4.txz
...

The other use for this package size list is to estimate the installed size of a Slackware tagfile set. See the calc_install_size.sh script in my Slackware Tagfile Manager utility.

Note
If you are using slackpkg, the PACKAGES.TXT file can be found locally at /var/lib/slackpkg/PACKAGES.TXT however this is a concatenation of the PACKAGES.TXT files from the base (eg., slackware64/), patches/, extra/ and testing/ directories. The above awk script will still work but packages in the non-base directories are not arranged in package sets so second column will contain a variety of other values like "packages" for patches/ and testing/ packages and the package name/group for extra/ packages.