Skip to content

Instantly share code, notes, and snippets.

@RealYukiSan
Last active August 8, 2024 14:14
Show Gist options
  • Save RealYukiSan/e3aef90c01fcd0c9a73911baa4abd677 to your computer and use it in GitHub Desktop.
Save RealYukiSan/e3aef90c01fcd0c9a73911baa4abd677 to your computer and use it in GitHub Desktop.
on Arch Linux, there's a meta package, and a group package. this script will looking for installed meta package on your system with pacman.
#!/bin/bash
# Script to search for meta-packages in the local system
# Function to search for meta-packages
search_meta_packages() {
echo "Searching for meta-packages..."
for pkg in $(pacman -Qq); do
# Check if the package has dependencies but no installed files
files=$(pacman -Ql $pkg) # List package files
# if no contain any file, then it must be a meta package.
if [[ -z "$files" ]]; then
echo "Meta-package found: $pkg"
fi
done
}
search_meta_packages
@RealYukiSan
Copy link
Author

RealYukiSan commented Aug 8, 2024

You can easily list all available group packages with just a single command: pacman -Qg | cut -d ' ' -f 1 | uniq

@RealYukiSan
Copy link
Author

One-liner version: echo "Searching for meta-packages..."; for pkg in $(pacman -Qq); do if [[ -z "$(pacman -Ql $pkg)" ]]; then echo "Meta-package found: $pkg"; fi; done

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