9

This sounds like it should be a fairly straightforward question to answer but I haven't found it yet, only figures of main + universe, which is various figures over 24,000 depending on release.

4 Answers 4

12

You can run the following command line:

for f in /var/lib/apt/lists/*Packages; do 
  printf '%5d %s\n' $(grep '^Package: ' "$f" | wc -l) ${f##*/}
done | sort -n

that on my machine show the following output

27433 it.archive.ubuntu.com_ubuntu_dists_oneiric_universe_binary-i386_Packages
 7768 it.archive.ubuntu.com_ubuntu_dists_oneiric_main_binary-i386_Packages
 1944 it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_main_binary-i386_Packages
  664 it.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages
  632 security.ubuntu.com_ubuntu_dists_oneiric-security_main_binary-i386_Packages
  605 it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_universe_binary-i386_Packages
  167 security.ubuntu.com_ubuntu_dists_oneiric-security_universe_binary-i386_Packages
   67 it.archive.ubuntu.com_ubuntu_dists_oneiric-backports_universe_binary-i386_Packages
   24 it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_multiverse_binary-i386_Packages
   21 it.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages
   13 extras.ubuntu.com_ubuntu_dists_oneiric_main_binary-i386_Packages
   12 archive.canonical.com_ubuntu_dists_oneiric_partner_binary-i386_Packages
   11 it.archive.ubuntu.com_ubuntu_dists_oneiric-backports_main_binary-i386_Packages
   10 security.ubuntu.com_ubuntu_dists_oneiric-security_multiverse_binary-i386_Packages
    6 it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_restricted_binary-i386_Packages
    0 security.ubuntu.com_ubuntu_dists_oneiric-security_restricted_binary-i386_Packages
    0 it.archive.ubuntu.com_ubuntu_dists_oneiric-backports_restricted_binary-i386_Packages
    0 it.archive.ubuntu.com_ubuntu_dists_oneiric-backports_multiverse_binary-i386_Packages
3
  • Thanks for that command-fu. 7768 in oneiric main is quite impressive. As is 1944 in oneiric-updates main. Apr 10, 2012 at 13:28
  • You comment works on Ubuntu 12.04 too. Awesome solution. Sep 24, 2015 at 1:08
  • 53000 for 18.10 May 21, 2018 at 4:38
2

Each distribution is different. But you can get a good idea of what is available by using "aptitude" and looking at the numbers.

as an example (not installed packages 32180)

enter image description here

1
  • 1
    This is not the answer to the particular question. Apr 10, 2012 at 14:53
2

You can check it here on repology.org.

1
  • Nice website, didn't know this! Has a nice very nice search function!!!
    – abu_bua
    Oct 6, 2018 at 12:44
1

The Package files are now Package.lz4 files, so the answer from 2012 needed a brief update.

Depends: lz4

I also refactored the code slightly to prefer grep -c over grep | wc -l

# FIXME: wrong numbers; see below
for f in /var/lib/apt/lists/*Packages.lz4; do
    printf '%5d %s\n' $(lz4cat "$f" | grep -c '^Package: ') ${f##*/}
done | sort -rn

There are some duplicates in the output, so I guess a better number would be obtained by

for f in /var/lib/apt/lists/*Packages.lz4; do
    lz4cat "$f" | awk -v file="${f##*/}" '/^Package: / && !p[$2]++ { ++n } END { print n, file}'
done | sort -rn

For Focal (20.04) with Universe enabled, this produces

53206 archive.ubuntu.com_ubuntu_dists_focal_universe_binary-amd64_Packages.lz4
10768 archive.ubuntu.com_ubuntu_dists_focal-updates_main_binary-amd64_Packages.lz4
9037 security.ubuntu.com_ubuntu_dists_focal-security_main_binary-amd64_Packages.lz4
7345 archive.ubuntu.com_ubuntu_dists_focal-updates_restricted_binary-amd64_Packages.lz4
6848 security.ubuntu.com_ubuntu_dists_focal-security_restricted_binary-amd64_Packages.lz4
6090 archive.ubuntu.com_ubuntu_dists_focal_main_binary-amd64_Packages.lz4
4275 archive.ubuntu.com_ubuntu_dists_focal-updates_universe_binary-amd64_Packages.lz4
3373 security.ubuntu.com_ubuntu_dists_focal-security_universe_binary-amd64_Packages.lz4
813 archive.ubuntu.com_ubuntu_dists_focal_multiverse_binary-amd64_Packages.lz4
198 archive.ubuntu.com_ubuntu_dists_focal-backports_main_binary-amd64_Packages.lz4
142 archive.ubuntu.com_ubuntu_dists_focal_restricted_binary-amd64_Packages.lz4
102 archive.ubuntu.com_ubuntu_dists_focal-updates_multiverse_binary-amd64_Packages.lz4
93 security.ubuntu.com_ubuntu_dists_focal-security_multiverse_binary-amd64_Packages.lz4
86 archive.ubuntu.com_ubuntu_dists_focal-backports_universe_binary-amd64_Packages.lz4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.