Skip to content

Instantly share code, notes, and snippets.

@zhiguangwang
Created August 26, 2018 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhiguangwang/e565398b0c0c999a70b95354281e1f72 to your computer and use it in GitHub Desktop.
Save zhiguangwang/e565398b0c0c999a70b95354281e1f72 to your computer and use it in GitHub Desktop.
Remove / Uninstall packages marked ‘rc’ on Debian / Ubuntu.

Remove / Uninstall packages marked ‘rc’ on Debian / Ubuntu.

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

Original Author

https://blog.bravi.org/?p=1296

@DanielGibson
Copy link

or you just do apt purge ~c (yes, that's a tilde, not a dash)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment