Skip to main content

Module 8: Package Management

Lesson 74: dpkg Command

In this lesson, you'll learn how to use the dpkg command to install, remove, and manage .deb packages in Debian-based Linux distributions.

dpkg is the main package management program in Debian and Debian-based systems. It is used to install, build, remove, and manage packages. Aptitude is the primary front-end to dpkg.

dpkg Command Syntax

# dpkg [OPTIONS] [COMMAND]

dpkg Command Options

Option Description
-i Install a .deb package
-l List all installed packages
-r Remove a package (keeping configuration files)
-p Purge a package (removing configuration files)
-c View the contents of a .deb package
-s Display the status of an installed package
-L List the installation location of files in a package
-R --install Recursively install all .deb packages from a directory
--unpack Unpack a package without configuring it
--configure Reconfigure an already unpacked package
--update-avail Replace available package information
--clear-avail Erase current information about available packages
--forget-old-unavail Forget uninstalled and unavailable packages
--licence Display the dpkg license
--version Display dpkg version information
--help Display help information

Some of the most commonly used dpkg commands along with their usages are listed here.

1. Install a Package

For installing a .deb package, use the command with the -i option. For example, to install a .deb package called flashpluginnonfree_2.8.2+squeeze1_i386.deb, use the following command.

[root@tecmint~]# dpkg -i flashpluginnonfree_2.8.2+squeeze1_i386.deb
Selecting previously unselected package flashplugin-nonfree.
(Reading database ... 465729 files and directories currently installed.)
Unpacking flashplugin-nonfree (from flashplugin-nonfree_3.2_i386.deb) ...
Setting up flashplugin-nonfree (1:3.2) ...
--2013-10-01 16:23:40--  http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.310/install_flash_player_11_linux.i386.tar.gz
Resolving fpdownload.macromedia.com (fpdownload.macromedia.com)... 23.64.66.70
Connecting to fpdownload.macromedia.com (fpdownload.macromedia.com)|23.64.66.70|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6923724 (6.6M) [application/x-gzip]
Saving to: '/tmp/flashplugin-nonfree.FPxQ4l02fL/install_flash_player_11_linux.i386.tar.gz'

2. List All Installed Packages

To view and list all the installed packages, use the -l option along with the command.

[root@tecmint~]# dpkg -l
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  accerciser                             3.8.0-0ubuntu1           all             interactive Python accessibility explorer for the GNOME desktop
ii  account-plugin-aim                     3.6.4-0ubuntu4.1         i386            Messaging account plugin for AIM
ii  account-plugin-facebook                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - facebook
ii  account-plugin-flickr                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - flickr
ii  account-plugin-generic-oauth           0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - generic OAuth
ii  account-plugin-google                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon
rc  account-plugin-identica                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - identica
ii  account-plugin-jabber                  3.6.4-0ubuntu4.1         i386            Messaging account plugin for Jabber/XMPP
....

To view whether a specific package is installed or not, use the -l option along with the package name. For example, check whether the apache2 package is installed or not.

Updated on Apr 2, 2026