While checking the status of packages using dpkg, it is possible to see a ‘rc’ state for some unused packages, this corresponds to:
- r: the package was marked for removal
- c: the configuration files are currently present in the system
In other words: the package is not completely removed (config files are still present), but not installed anymore (and obviously not used).
To see a list of packages marked as ‘rc’:
dpkg --list | grep "^rc"
Or, to see only package names:
dpkg --list | grep "^rc" | cut -d " " -f 3
It is now time to remove all the marked packages (WARNING: All configuration data will be lost!):
dpkg --list | grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge
or you just do
apt purge ~c
(yes, that's a tilde, not a dash)