Purge packages using dpkg
dpkg can be used to
- install packages
- remove packages
- 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.
Comments: