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.)
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.
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…
Commented
Jul 13, 2012 at 19:00
dpkg -L
on these packages? Does it show any files?
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
.
Commented
Jul 18, 2012 at 6:26
In aptitude you filter just the packages that are deinstalled but still have configuration files remaining (which are in state 'c').
press L
filter for ~c
purge all listed packages by pressing _
I found this answer the simplest.
The following should do what you want:
aptitude purge \~c
This purges all packages with the c
(package removed, configuration files still present) state flag. Flag documentation is here.