How to install, delete and purge packages with dpkg:

Debian/Ubuntu or Linux Mint are dpkg based. dpkg is a low level tool, mostly for installing and removing packages.

If you fail to install/delete a package with the Apt package manager, try that with dpkg:

Listing the files in the .deb package before installing it with dpkg-deb –contents:

$ ls transmission*
transmission_2.33-0ubuntu2_all.deb
$ dpkg-deb --contents transmission_2.33-0ubuntu2_all.deb
drwxr-xr-x root/root 0 2011-08-05 10:23 ./
drwxr-xr-x root/root 0 2011-08-05 10:23 ./usr/
drwxr-xr-x root/root 0 2011-08-05 10:23 ./usr/share/
drwxr-xr-x root/root 0 2011-08-05 10:23 ./usr/share/doc/
lrwxrwxrwx root/root 0 2011-08-05 10:23 ./usr/share/doc/transmission -> transmission-common

Installing a .deb package with dpkg -i:

$ ls transmission*
transmission_2.33-0ubuntu2_all.deb
$ sudo dpkg -i transmission_2.33-0ubuntu2_all.deb

Checking if a package is installed or not with dpkg -l or dpkg -s:

$ dpkg -s transmission | grep -i status
Status: install ok installed

OR

$ dpkg -l | grep transmission
ii transmission 2.33-0ubuntu2 lightweight BitTorrent client
ii transmission-common 2.33-0ubuntu2 lightweight BitTorrent client (common files)
ii transmission-gtk 2.33-0ubuntu2 lightweight BitTorrent client (GTK interface)

ii means installed.

Uninstall / Purge .deb packages with dpkg -r or dpkg -P:

With dpkg -r the package will be uninstalled, but the configuration files will still remain on your system, in order you want to install it back and keep your settings.
dpkg -P both the package and the configuration files

$ dpkg -r sudo dpkg -r transmission
(Reading database ... 131164 files and directories currently installed.)
Removing transmission ...

If you want to purge transmission, use: dpkg -P transmission

$ dpkg -l transmission | grep un
un transmission

un means uninstalled.

Share and Enjoy

  • Twitter
  • Facebook
  • Google Plus
  • Email
  • RSS
Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

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

*

Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!