Purge packages using dpkg

Posted by Joys of Programming on in dpkg, Linux, Ubuntu

dpkg can be used to

  1. install packages
  2. remove packages
  3. know the current status of packages

When we decide to remove a package, we must be clear that we want to remove or purge a package. When we purge packages using dpkg, it removes not only the binaries but also the configuration files and the state of a package will be pn.

Let’s remove a package called vim (assuming it is present in your system)

$ sudo dpkg --purge vim
(Reading database ... 239395 files and directories currently installed.)
Removing vim ...
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode.
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/view (view) in auto mode.
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/ex (ex) in auto mode.
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode.

Let’s see the status of the package

dpkg --list vim
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                 Version                              Description
+++-====================================-====================================-========================================================================================
un  vim                                  <none>                               (no description available)

The state is un, because there were no configuration files corresponding to vim and the package is now completely uninstalled. Read more about package states.


Tags: , ,

Comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.