how to auto purge automatically installed packages using aptitude?

Cameron Hutchison lists at
Fri Jul 16 05:16:51 UTC 2010

>Is there an equivalent command for aptitude which works like
>$ apt-get --purge autoremove pkg

>I have tried 
>$ sudo aptitude --purge-unused remove xpdf

>and found that aptitude just removed xpdf package only and had other
>automatically installed packages left.

>In other words, 
>$ aptitude remove xpdf 
>is different with 
>$ aptitude --purge-unused remove xpdf. The former would remove related
>packages which xpdf depends on. But the latter would not. I am not sure
>the actual meaning of --purge-unused. Or there is a bug revealed.

I'm not sure how --purge-unused is meant to work, so I'm not sure if my
answer here is addressing what you want, but there is a config variable
you can set to make aptitude purge unused packages when it removes them:

Aptitude::Purge-Unused "true";

Put this in /etc/apt/apt.conf (or in a file in /etc/apt/apt.conf.d).

Furthermore, when I find myself with a bunch of packages removed but not
purged and there are no packages I want to keep removed, I fire up the
aptitude UI, move the cursor to "Not Installed Packages" and press _
(underscore), then g. This will purge all not installed packages, which
includes all those in the "rc" state.

More information about the ubuntu-users mailing list