Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm basically looking for an apt-get purge for programs that are already uninstalled.

(I'm running Debian squeeze and using aptitude for package management.)

share|improve this question

2 Answers 2

The following sequence will list your deinstalled packages,

dpkg --get-selections | grep deinstall

You can switch that to purge with a sed replace.
Is that what you are looking for?

You can run that purge list through dpkg --set-selections and
run dpkg --purge --pending on the marked packages...

Or, something like,

for pkg in $(dpkg --get-selections | grep deinstall | awk '{print $1}'); 
do 
  dpkg -L $pkg; 
done

will list the files hanging around from these deinstall'ed packages.

share|improve this answer
    
Actally, it seems like if you apt-get remove a package that has configuration files, you can later remove them just with apt-get purge $package. IIRC, I'd tried that and it didn't work, through, giving me a package-not-installed error… –  Blacklight Shining Jul 13 '12 at 19:00
    
Hmm. Did you try dpkg -L on these packages? Does it show any files? –  nik Jul 13 '12 at 20:11
    
Just tested this again. Did a dpkg --get-selections | grep deinstall, then picked one of the packages from that output. dpkg -L $package listed several configuration files the package had created. apt-get remove $package returned a not-installed-so-not-removed warning, but apt-get purge $package asked if I wanted to continue with removing the package, then did so. After that, it did not show up in dpkg --get-selections | grep deinstall. –  Blacklight Shining Jul 18 '12 at 6:26
    
Hmm, that is not my experience. When I run purge, it says "Package $package is not installed, so not removed", and then it still shows up in the list. –  Trejkaz Oct 17 '13 at 23:21

In aptitude you filter just the packages that are deinstalled but still have configuration files remaining (which are in state 'c').

  1. press L

  2. filter for ~c

  3. purge all listed packages by pressing _

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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