find-orphans.sh 266 B

123456789101112
  1. #!/bin/sh
  2. for pkg in $(dpkg --get-selections |\
  3. grep -Ee '[[:space:]]install$' |\
  4. grep -Eoe '^[^[:space:]]+'); do
  5. if ! apt-cache showpkg "$pkg" |\
  6. grep -q '/var/lib/apt/lists/'; then
  7. # Found an orphan. Print its name.
  8. echo "$pkg"
  9. fi
  10. done