Debian

Remove all packages marked as rc by dpkg

Let’s see all the packages marked as rc by dpkg. Know more about the state rc. This state means that the configuration files are not yet removed. You can see how a single package can be removed.

What does rc mean?

For detailed information on interpreting the status, you can refer State of a Package. rc corresponds to:

1. r: the package was marked for removal
2. c: the configuration files are currently present in the system
In nutshell, it means that the package is not completely removed. The configuration files are still present. To completely remove a package, refer Remove packages marked as rc.

dpkg --list |grep "^rc"
dpkg --list |grep "^rc"
rc  bind9                            1:9.10.3.dfsg.P4-12.3+deb9u4   amd64        Internet Domain Name Server
rc  ca-certificates                  20161130+nmu1                  all          Common CA certificates
rc  cmake                            3.7.2-1                        amd64        cross-platform, open-source make system
rc  cmake-data                       3.7.2-1                        all          CMake data files (modules, templates and documentation)
rc  fail2ban                         0.9.6-2                        all          ban hosts that cause multiple authentication errors
rc  fetchmail                        6.3.26-3                       amd64        SSL enabled POP3, APOP, IMAP mail gatherer/forwarder
rc  isc-dhcp-client                  4.3.5-3+deb9u1                 amd64        DHCP client for automatically obtaining an IP address
rc  libcwidget3:amd64                0.5.17-2                       amd64        high-level terminal interface library for C++ (runtime files)
rc  libpython3.4-minimal:amd64       3.4.2-1                        amd64        Minimal subset of the Python language (version 3.4)
rc  libpython3.5-minimal:amd64       3.5.3-1                        amd64        Minimal subset of the Python language (version 3.5)
rc  libsigc++-2.0-0c2a:amd64         2.4.0-1                        amd64        type-safe Signal Framework for C++ - runtime
rc  lsb-release                      9.20161125                     all          Linux Standard Base version reporting utility
rc  module-init-tools                18-3                           all          transitional dummy package (module-init-tools to kmod)
rc  perl-modules                     5.20.2-3+deb8u9                all          Core Perl modules
rc  pkg-config                       0.29-4+b1                      amd64        manage compile and link flags for libraries
rc  postfix-sqlite                   3.1.8-0+deb9u1                 amd64        SQLite map support for Postfix
rc  python                           2.7.13-2                       amd64        interactive high-level object-oriented language (default version)
rc  python3                          3.5.3-1                        amd64        interactive high-level object-oriented language (default python3 version)
rc  python3.4                        3.4.2-1                        amd64        Interactive high-level object-oriented language (version 3.4)
rc  python3.4-minimal                3.4.2-1                        amd64        Minimal subset of the Python language (version 3.4)
rc  python3.5-minimal                3.5.3-1                        amd64        Minimal subset of the Python language (version 3.5)
rc  sasl2-bin                        2.1.27~101-g0780600+dfsg-3     amd64        Cyrus SASL - administration programs for SASL users database
rc  snmp                             5.7.3+dfsg-1.7                 amd64        SNMP (Simple Network Management Protocol) applications

Let’s extract out the packages marked as rc

dpkg --list |grep "^rc" | cut -d " " -f 3
bind9
ca-certificates
cmake
cmake-data
fail2ban
fetchmail
isc-dhcp-client
libcwidget3:amd64
libpython3.4-minimal:amd64
libpython3.5-minimal:amd64
libsigc++-2.0-0c2a:amd64
lsb-release
module-init-tools
perl-modules
pkg-config
postfix-sqlite
python
python3
python3.4
python3.4-minimal
python3.5-minimal
sasl2-bin
snmp

Now let’s remove all the packages marked as rc.

dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge

See how we have used xargs and the command dpkg –purge in combination.