Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Last active October 14, 2025 17:13
Show Gist options
  • Select an option

  • Save ThinGuy/0ced4a8d7e356f30aacabefae311da30 to your computer and use it in GitHub Desktop.

Select an option

Save ThinGuy/0ced4a8d7e356f30aacabefae311da30 to your computer and use it in GitHub Desktop.
Quickly check what component (main, universe,etc) . Supports simple regex (via 'apt-cache search -n').
pkgcmp() {
for P in $(apt-cache search -n "${@}"|awk -F' - ' '{print $1}');do
[[ -z ${P} ]] && { continue; };
printf "${P}: $(apt-cache show ${P}|awk '/^Section:/&&!/^$/{if ($2 !~ /\//) print "main";else {gsub(/\/.*/,"",$2);print $2}}')\n";
done
};export -f pkgcmp
@ThinGuy
Copy link
Author

ThinGuy commented Oct 10, 2025

Example:

craigbender@cbpc:~$ pkgcmp ^openstack
openstack-dashboard: main
openstack-dashboard-common: main
openstack-dashboard-debian-theme: universe
openstack-dashboard-ubuntu-theme: universe
openstack-debian-images: universe
openstack-debian-images-build-farm: universe
openstack-debian-images-updater: universe
openstack-pkg-tools: universe
openstack-release: universe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment