User Tools

Site Tools


old_ubuntu_packages

Find and remove old and non-Ubuntu packages

current=$(lsb_release -cs)

for pkg in $(dpkg-query -W -f='${binary:Package}\n'); do
    if ! apt-cache policy "$pkg" | grep -q "$current"; then
        echo "$pkg"
        apt autoremove --purge "$pkg"
    fi
done

For each package, select y or n to remove it and any dependencies.

old_ubuntu_packages.txt · Last modified: 2026/05/20 20:44 by ian

free spam filter