Aptitude trick : Delete The Packages That Were Removed But Not Purged

First, I need to make sure that everybody knows the difference between apt-get remove and apt-get purge.

apt-get remove <package> — will remove the binaries but will keep the files associated with the package. Also, the dependencies remain untouched.

apt-get purge <package> — will remove the binaries and all the files associated with them, but will leave the dependencies untouched.

None of the two commands do not delete the configuration files of the package, stored in your ~/.* .

If you want to remove a package completelly, use apt-get purge (or apt-get remove –purge, they are synonyms), if you want to keep files associated to the program, in order to reinstall it later and use them use apt-get remove.

But if use apt-get remove to uninstall packages, how do you get rid of the remaining files, (as apt-get purge would have done) ?

Use locate / find and delete them by hand? No.

You can use this aptitude trick (if you don’t have aptitude installed do sudo apt-get install aptitude):

$ sudo aptitude purge '~c'

~c finds the packages that were removed but not purged. the single quotes prevent the bash from expanding ~c as $HOME/c

root + apt-get + aptitude = GODLIKE.

Liked it? Take a second to support Geekster on Patreon!
Tagged with: , , , , ,
Posted in The Linux and Unix Articles!
One comment on “Aptitude trick : Delete The Packages That Were Removed But Not Purged
  1. Tom Allen says:

    Excellent help code. Thank you so very much. You saved me a complete reinstallation.

    Enjoy your day and life, my Friend.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!