Pacman tips
Published (last updated )
# List all locally installed packages which don't exist in a configured repository (anymore):
pacman -Sp $(pacman -Qq) 2>&1 >/dev/null | awk '{ print $NF; }'
# Only upgrade packages from a repository called "custom"
sudo pacman -S --needed $(comm -12 <(pacman -Qq | sort) <(pacman -Slq custom | sort))
# Create a tsv file sorted by date, showing how old packages are and who built them:
pacman -Qq | xargs -n1 expac '%b\t%n\t%p' -t '%F' | sort > ~/Desktop/packages.tsv
# For each package in custom, list the packager of the installed package:
for i in $(pacman -Sl custom | cut -d ' ' -f 2); do printf "%-50s%s\n" "$i" "$(pacman -Qi $i 2>/dev/null | grep Packager | sed 's/.*: //')"; done
# Remove orphaned packages:
pacman -Qtdq | sudo pacman -Rns -
# Clear local package caches:
sudo pacman -Scc