4

My / is running low. So I am considering freeing up some space by uninstalling some packages. “Which installed software packages use the most disk space on Debian?” already covers sorting by size, but I'd like to sort by how frequently I use each package.

How can I sort installed applications according to their usage frequencies? I'd like to consider uninstalling the least-frequently used apps.

I checked the dpkg manpage, and couldn't find anything. I'm running Ubuntu.

  • 1
  • @Tim: Since you asked two questions in your question (please don't do that) and one of them is already answered on the site, I've taken the liberty of editing out that question, leaving only the question about least frequently used. – derobert Jul 29 '14 at 17:48
2

According to the Debian Popularity Contest README,

This package contains a script, /usr/sbin/popularity-contest, which generates a list of the packages installed on your system, in order of most-recently-used to least-recently-used. The simplest way to use this information is to help clean up your hard drive by removing unused packages.

For example,

popularity-contest | grep '<OLD>'

will show you a list of packages you haven't used in a while. Note that this output isn't totally accurate: some packages appear "old" but you can't remove them because other (non-old) packages depend on them.

| improve this answer | |
2

There isn't a standard mechanism to keep track of how often you run programs.

If your system keeps track of file access times, you can check the last read date for programs in /usr/bin or for their data files. This can only tell you how long it is since the program was last executed, not how often it had been executed before that.

ls -rtu /usr/bin | head -n 30

To find out which package provides these programs:

dpkg -S $(ls -rtu /usr/bin/* | head -n 30)

You can log when applications are executed by installing the acct package. The command lastcomm reports the times executables were started. To see the most frequent ones since the logs were last rotated:

lastcomm | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 30

For end-user programs, looking at the list of large packages and removing the ones whose name doesn't ring a bell works reasonably well. Just make sure that you only remove a package if it isn't an interactive application (according to the package description): don't remove system utilities since you can't know what might be using them under the hood. And of course pay attention to dependencies: only remove something if you've determined that everything that depends on it is also not something you care about.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.