ubuntu:packages:purge_removed_unpurged_packages
Table of Contents
Ubuntu - Packages - Purge removed, unpurged packages
When a package is removed, but not purged, the configuration files are usually not removed.
- But at some stage there may be a need to remove this configuration data too.
Obtain a list of removed, unpurged packages
dpkg --list | grep ^rc
returns:
rc linux-image-5.11.0-25-generic 5.11.0-25.27~20.04.1 amd64 Signed kernel image generic rc linux-image-5.11.0-27-generic 5.11.0-27.29~20.04.1 amd64 Signed kernel image generic ...
NOTE: The ^rc pattern means that only lines beginning with rc should be output.
- The r part means that the package was removed.
- The c part means that the config files remain.
Use AWK to get a listing of just the package names
dpkg --list | grep ^rc | awk '{ print $2; }'
returns:
linux-image-5.11.0-25-generic linux-image-5.11.0-27-generic ...
Purge the removed, unpurged packages
sudo apt purge `dpkg --list | grep ^rc | awk '{ print $2; }'`
NOTE: Some warnings may be seen stating that specific directories were not removed.
- These directories can be checked if they are empty and then removed manually if required.
ubuntu/packages/purge_removed_unpurged_packages.txt · Last modified: 2022/09/18 22:56 by peter