Purge old packages from Linux

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

For deb based distributions like Debian, Ubuntu, it is advisable to purge old packages (have status rc, r=removed, c=config).

List all removed packages that have config files:

dpkg -l | awk '/^rc/ { print $2 }'

Remove all old and unnecessary packages using apt-get:

apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')
apt-get autoremove

Can also be done with dpkg

Please remember the terms for blog comments.