I removed lot of packages over the time from system using apt remove instead of apt purge. Once I removed a package using apt remove and cleaned my system using bleachbit. After somedays I ran the apt purge command to remove files that were left by old package which was removed week ago. So, my question is that, how can I use apt purge to get rid of all the files of packages that I ever removed using apt remove?

1 Answer 1


As of 12.04 you can just do

sudo apt-get remove --purge {packagename}

for packages that already have been removed.

This will do them all in 1 nifty command ...

dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`

Old skool:

If you want to do this visually: install Synaptic Install Synaptic from the Software Center and run synaptic. You ca find what you want to remove in the "Not Installed (residual config)" section.

  • 1
    That nifty command works perfectly :)
    – user588576
    Aug 30, 2016 at 15:14

You must log in to answer this question.