主存储库中有多少个软件包?

主存储库中有多少个软件包?

这听起来像是一个相当简单的问题,但我还没有找到,只有主要+宇宙的数字,根据版本的不同,有超过 24,000 的各种数字。

答案1

您可以运行以下命令行:

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

在我的计算机上显示以下输出

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

答案2

每个发行版都不同。但是,您可以使用“aptitude”并查看数字来了解可用的内容。

作为示例(未安装软件包 32180)

在此处输入图片描述

答案3

你可以检查一下这里在 repology.org 上。

答案4

这些Package文件现在是Package.lz4文件,因此 2012 年的答案需要进行简要更新。

Depends: lz4

我也稍微重构了代码,以便grep -c更喜欢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

输出中有一些重复项,因此我猜想可以通过以下方式获得更好的数字

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

对于启用 Universe 的 Focal (20.04),这将产生

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

相关内容