Wednesday, April 17, 2013

[ Level 1 ] How to remove rc listed in dpkg -l @Ubuntu.

You could use dpkg -P to remove it.

e.g.
$ dpkg -l virtualbox
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
+++-==================================-======================-======================-=========================================================================
ii  virtualbox                         4.1.18-dfsg-1ubuntu1.1 amd64                  x86 virtualization solution - base binaries

$ apt-get remove virtualbox
...

$ dpkg -l | grep virtual
...
rc  virtualbox                                4.1.18-dfsg-1ubuntu1.1                    amd64        x86 virtualization solution - base binaries
rc  virtualbox-qt                             4.1.18-dfsg-1ubuntu1.1                    amd64        x86 virtualization solution - Qt based user interface

$ package_name="virtualbox" dpkg -l | grep ^rc | grep "$package_name" | cut -d' ' -f3| sudo xargs dpkg -P
...

$ package_name="" dpkg -l | grep ^rc | grep "$package_name" | cut -d' ' -f3| sudo xargs dpkg -P ## clean all unused rc(s).

Wish this helps.

regards,
Stanley Huang