Jaime Frutos Morales's blog


How to purge removed DEB packages

Filed under: SysAdmin, Ubuntu — acidborg @ 12:55

When you remove a package in a DEB-based system using apt-get remove package-name (or dpkg -r package-name), if that package has config files, they usually remain in your system.

The best way to remove a package and its config files is using this command: apt-get --purge remove package-name (or dpkg -P package-name).

You can check whether you have removed DEB packages with installed config files using this command: dpkg -l | grep '^rc' (the ‘r’ means ‘removed’ and the ‘c’ means that it has config files installed)

So, if you want to get rid of these config files, just type: dpkg -l | grep '^rc' | awk '{print $2;}' | xargs dpkg --purge

Create a free website or blog at WordPress.com.

%d bloggers like this: