Skip to main content

Remove Packages marked as "rc"

Introduction

Packages marked as "rc" (removed but with residual config files) on Ubuntu can be cleaned up by purging their configuration files.

Problem Description

It is recommended to verify the packages before purging if you want to be cautious, but generally this cleanup is safe for old unused package residues. Regular use of this purge command helps keep the system tidy from obsolete config files.

Solution

The easiest way to remove all such "rc" packages automatically is by running

sudo apt purge '~c'

This command purges all packages that are marked as removed but still have configuration files present on the system.

Alternatively, you can do it step-by-step in the terminal:

  1. List all "rc" packages

dpkg --list | grep '^rc'
  1. Remove all config files of these packages

dpkg --list | grep '^rc' | awk '{print $2}' | xargs sudo apt purge

This safely removes leftover configuration files from previously removed packages, freeing up disk space.