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.

Watch Free Movies

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.

Scroll to Top