How to list all packages which remained configured on the system after apt-get remove a.k.a in the rc state?

What is the easiest and reliable way to check, if the system has a package in an different state than ii?


I'll start with a disclaimer that this is based on Ubuntu (15.10) and not vanilla Debian, but I would tentatively guess that it will work the same. Confirmations, or corrections if I'm wrong, are of course most welcome.

Your mention of "the rc state" suggests you are familiar with dpkg. I don't know if you had something more fancy in mind, but why not just use that and filter the output to show what you want? For example:

List all removed packages where config files remain (line starts with rc):

dpkg -l | awk '/^rc/ { print }'

List packages that are not currently installed (line does not start with ii):

dpkg -l | awk '!/^ii/ { print }'

The second one is based on the assumption that dpkg -l does not include packages that have never been installed, which may not hold true in all cases, perhaps especially with older versions.

  • Thanks, I'm doing it the same way, just using grep instead to filter. I'm asking to accumulate all possible answers here and to really learn something "more fancy", shorter (if possible) to reduce my typing and to get rid of brackets, escapes, regexps, etc. Cheers. – SkyRaT Feb 25 '16 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.