13

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.

6
  • I'd look at access times in /usr/bin, and pick off the less-recently used programs, ranked by package size. That would require some scripting work (ymmv). Commented Nov 24, 2018 at 17:37
  • thanks, this is good idea. but doesn't work for packages that have services installed.
    – gopy
    Commented Nov 24, 2018 at 17:40
  • nor for packages that doesn't have binary files.
    – gopy
    Commented Nov 24, 2018 at 17:48
  • Have you looked in /var/log/apt/history* to see what you installed when?
    – doneal24
    Commented Nov 24, 2018 at 17:59
  • 1
    Only if a package is marked with manual installation (as opposed to auto installation) is it kept on executing apt autoremove. I suggest that you change to auto some packages selected on a date range from /var/log/history (that will remove nothing) and then check that the list does not include applications you have grown to like (that will not remove either) before answering Yes (which will commit the changes).
    – user232326
    Commented Nov 24, 2018 at 19:31

2 Answers 2

7

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.

3
  • Thanks, its an interesting tool, but not intelligent enough.
    – gopy
    Commented Nov 24, 2018 at 18:40
  • what if I install apache and do not use http port for a long time? popularity-contest can't detect that. same is true for library packages and documentation packages.
    – gopy
    Commented Nov 25, 2018 at 7:01
  • @gopy As the manpage say the debian tool will track the used executable program to generate the list.
    – GAD3R
    Commented Nov 25, 2018 at 16:33
1

Yes, this is an existing project, called deborphan.

Description: program that can find unused packages, e.g. libraries

   deborphan  finds  packages that have no packages depending on them. The
   default operation is to search within the libs, oldlibs and  introspec‐
   tion sections to hunt down unused libraries.
1
  • 1
    "I already know about deborphan". Commented Nov 24, 2018 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .