Skip to content

Instantly share code, notes, and snippets.

@AfroThundr3007730
Last active February 17, 2026 20:31
Show Gist options
  • Select an option

  • Save AfroThundr3007730/ad7d4cef10063028717be1fbb2aecf2a to your computer and use it in GitHub Desktop.

Select an option

Save AfroThundr3007730/ad7d4cef10063028717be1fbb2aecf2a to your computer and use it in GitHub Desktop.
A quick analysis of the package composition of the Ubuntu Noble Numbat (24.04) universe repository
#!/bin/bash
# 2024-04-16
# Note: Current size of noble/universe is 145G,
# while all of noble is 170G.
# Downloaded ubuntu noble universe package list
gunzip Packages.gz
# Extracted package names
awk '/Package:/ {print $2}' Packages > Packages.names
wc -l Packages.names
# 66290 Packages.names
# Sort packages by common prefix (if applicable)
awk -F- '{count[$1]++}END{for(i in count){print i" "count[i]}}' Packages.names |
sort -rnk 2 > Packages.prefixes
wc -l Packages.prefixes
# 18960 Packages.prefixes
# Get the top 50 prefixes
ex=$(awk 'BEGIN{str="_"}NR<=50 {str=str "|" $1}END{print str}' Packages.prefixes)
echo $ex
# _|python3|libghc|librust|golang|node|ruby|r|python|gcc|php|elpa|fonts|libjs|libstdc++|gobjc++|gobjc|gfortran|g++|gccgo|gdc|libgm2|task|dict|libtest|tryton|libnet|qt6|lua|tesseract|librte|libgcc|cl|gir1.2|qml|cpp|gm2|gnat|libobjc|libmono|libgfortran|libboost|libgnat|libstdc++6|gnome|ubuntu|libc6|libeclipse|libgo|libgphobos|libglobus
# Prune out the top 50 prefixes
grep -vE "^$ex(-|$)" Packages.names > Packages.least
wc -l Packages.least
# 13280 Packages.least
# Keep only the top 50 prefixes
grep -E "^$ex(-|$)" Packages.names > Packages.most
wc -l Packages.most
# 53010 Packages.most
# Proportion of top packages / all packages
bc -l <<< '53010/66290'
# .79966812490571730276
# Proportion of top prefixes / all prefixes
bc -l <<< '50/18960'
# .00263713080168776371
# Single packages (occur only once)
awk '$2 < 2' Packages.prefixes | wc -l
# 13524
# Prefixes with 2-10 occurrences
awk '2 <= $2 && $2 <= 10' Packages.prefixes | wc -l
# 4955
# Prefixes with 11-100 occurrences
awk '11 <= $2 && $2 <= 100' Packages.prefixes | wc -l
# 428
# Prefixes with 101-500 occurrences
awk '101 <= $2 && $2 <= 500' Packages.prefixes | wc -l
# 43
# Prefixes with 500-1000 occurrences
awk '501 <= $2 && $2 <= 1000' Packages.prefixes | wc -l
# 3
# Prefixes with 1000+ occurrences
awk '1001 <= $2' Packages.prefixes | wc -l
# 7
# All prefixes with occurrence > 100
awk '100 <= $2' Packages.prefixes
# python3 4130
# libghc 3315
# librust 2590
# golang 2169
# node 1694
# ruby 1405
# r 1325
# python 740
# gcc 582
# php 540
# elpa 403
# fonts 398
# libjs 320
# libstdc++ 292
# gobjc++ 268
# gobjc 268
# gfortran 251
# g++ 246
# gccgo 244
# gdc 236
# libgm2 233
# task 223
# dict 208
# libtest 203
# tryton 174
# libnet 173
# qt6 167
# lua 164
# tesseract 163
# librte 160
# libgcc 159
# cl 159
# gir1.2 157
# qml 154
# cpp 152
# gm2 151
# gnat 149
# libobjc 146
# libmono 146
# libgfortran 145
# libboost 144
# libgnat 143
# libstdc++6 142
# gnome 139
# ubuntu 133
# libc6 130
# libeclipse 125
# libgo 124
# libgphobos 115
# libglobus 114
# libxml 108
# gambas3 105
# puppet 104
# postgresql 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment