August 1, 2013

Purge Old apt Packages Using dpkg

When you apt-get remove packages it can still leave behind old configs and other crap you’d probably want to get rid of, here’s how you do it.

Firstly you can have a look at what’s been removed but not completely by running the following:

dpkg -l | grep "^rc"

You can then extract the names from the list using:

dpkg -l | grep "^rc" | cut -d " " -f 3

If we want to purge them all then we just run:

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

Leave a Reply

Your email address will not be published.

css.php