User Tools

Site Tools


old_ubuntu_packages

This is an old revision of the document!


Find and remove old and non-Ubuntu packages

<code> 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 <code>

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

old_ubuntu_packages.1779309819.txt.gz · Last modified: 2026/05/20 20:43 by ian

free spam filter