Created
January 22, 2025 09:08
-
-
Save mal1kc/81f8b7a144552cdf911892b7ee209466 to your computer and use it in GitHub Desktop.
clean unused packages with aur helper yay ( archlinux ) https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Removing_unused_packages_(orphans)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env dash | |
unused_packages_file="$HOME/gecici/unused_packages.txt" | |
echo "do you want a clean $unused_packages_file file ? y/N" | |
read -r clean_file | |
if [ "$clean_file" = "y" ]; then | |
echo "" >"$unused_packages_file" # clean up | |
fi | |
echo "deleting" | |
yay -Qdtq | gawk '{print $1}' | while read -r pkg; do | |
yay -Qi "$pkg" | grep -E '^(Name|Description)' >>"$unused_packages_file" | |
done | |
echo "deleting" | |
yay -Qdtq | yay -Rns - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment