Debian – How to find unused packages in debian

debianpackage-management

As a typical debian user I install some packages over time for several reasons:

  1. I want to test the package
  2. I want to use it for a short time
  3. I mis-spelled its name
  4. I copy/pasted a long apt install command from Internet, but I only need some of the packages.

Is there any (intelligent) tool to find packages installed previously and probably no longer needed?

This tool should guess the need to the package from current behavior and probably should use some kind of artificial intelligence. I don't expect that tool to be accurate, it only suggests.

I already know about deborphan and apt autoremove but they are useless in this scenario.

Best Answer

popularity-contest is a debian tool which help the Debian developer to improve future versions of the distribution it can be used to achieve your goal. the popcon-largest-unused command will list the unused packages.

The popularity-contest package sets up a cron job that will periodically anonymously submit to the Debian developers statistics about the most used Debian packages on this system.

man popularity-contest

The popularity-contest command gathers information about Debian packages installed on the system, and prints the name of the most recently used executable program in that package as well as its last-accessed time (atime) and last-attribute-changed time (ctime) to stdout.

apt install popularity-contest
popularity-contest > /var/log/popularity-contest
popcon-largest-unused

DESCRIPTION: popcon-largest-unused

Based on the list of unused packages reported by popularity-contest, this program extract the package size from the APT cache, and list the unused packages sorted by size.