Skip to content

Instantly share code, notes, and snippets.

@n-st
Created January 26, 2022 02:31
Show Gist options
  • Save n-st/758801b7aa49096ecf9ce95be315c93a to your computer and use it in GitHub Desktop.
Save n-st/758801b7aa49096ecf9ce95be315c93a to your computer and use it in GitHub Desktop.
Arch Linux pacman: List all "groups" that are "fully installed", i.e. all their member packages are installed on this system
#!/bin/sh
set -e -u
tempprefix="$(basename "$0")"
tempdir="$(mktemp -d -t "${tempprefix}.XXXXXXXXXX")"
trap 'rm -rf "$tempdir"' EXIT
cd "$tempdir" || exit
pacman -Qgq | sort \
> "installed_pkgs_plus_groupnames.txt"
cat "installed_pkgs_plus_groupnames.txt" \
| awk '{print $1}' \
| sort -u \
> "installed_groups_including_partial.txt"
pacman -Sg $(cat "installed_groups_including_partial.txt") \
| sort \
> "all_group_pkgs_plus_groupnames.txt"
comm -13 "installed_pkgs_plus_groupnames.txt" "all_group_pkgs_plus_groupnames.txt" \
| awk '{print $1}' \
| sort -u \
> "partially_installed_groups.txt"
comm -23 "installed_groups_including_partial.txt" "partially_installed_groups.txt" \
> "fully_installed_groups.txt"
cat "fully_installed_groups.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment