remove residual config packages/files from the command line
In synaptic, there's an option in the package manager to mark residual config files/packages for complete removal, and I'm wondering how to do this from the command line. I ran
Code:
sudo deborphan | xargs sudo apt-get purge -y
sudo apt-get autoremove -y
sudo apt-get clean
but some packages still show up in synaptic, so clearly, these commands aren't removing everything. My main laptop runs a command line ubuntu interface with icewm on top, so I primarily use the command line, and I'd like to know how to remove residual config packages from the command line. Maybe something using dpkg -l to search for packages labeled "rc?" Thanks!
Re: remove residual config packages/files from the command line
Hi
For complete removal
sudo apt-get purge packagename
more info
Re: remove residual config packages/files from the command line
I know about apt-get purge, but what if I don't remember what the packages are? When I looked in synaptic in gnome, there were packages from a while back that still had config files left all over my system, so is there a way from the command line to run purge for all packages that have already been installed? Thanks!
Re: remove residual config packages/files from the command line
Re: remove residual config packages/files from the command line
Let me rephrase my question... How can I use "dpkg -l" or "dpkg-query" so it will only show the output of packages labeled as "rc?" (As opposed to those labeled "ii" etc). Thanks!
Re: remove residual config packages/files from the command line
Maybe this will do?
Code:
dpkg-query -W -f='${Package}\t${Status}\n' | awk '/deinstall/{print $1}'
Re: remove residual config packages/files from the command line
The CLI equivalent of Synaptic is aptitude. Run sudo aptitude in a terminal. More info here: http://algebraicthunk.net/~dburrows/...titude/doc/en/
It's a few years old, but the commands are still the same.
Re: remove residual config packages/files from the command line
Quote:
Originally Posted by
unutbu
Maybe this will do?
Code:
dpkg-query -W -f='${Package}\t${Status}\n' | awk '/deinstall/{print $1}'
Thank you! I really appreciate the help!
Re: remove residual config packages/files from the command line
Code:
aptitude search '~c'
will show you uninstalled packages that still have configuration around. With the -F option you can have it only print the package name (%p)
Code:
aptitude -F %p search '~c'
See the aptitude readme for more; /usr/share/doc/aptitude/README
Re: remove residual config packages/files from the command line
To save space in on my laptop, I've actually uninstalled aptitude... because I tend to use apt-get. Once I get back to my apartment, I'll check to see if similar commands apply. Thanks for the help!