Tutorial Install and Use Dpkg on Debian 10 & 9

Tutorial Install and Use Dpkg on Debian 10 & 9

Dpkg is a package management command on Linux Operating Systems and Debian-based distributions. this software is used for better packages management, installation, removal, and provide information about .deb packages. It is controlled via command-line parameters. The action-parameters tell dpkg dpkg what to do and options control the behavior of the actions in some way. Also, dpkg maintains some usable information about available packages. this article will present Tutorial Install and Use dpkg on Debian 10 & 9. If you are preparing to buy your own Linux VPS, visit the available packages of Eldernode to purchase the best.


To let this tutorial work better, please consider the below Prerequisites:

A non-root user with sudo privileges.

To set up, follow our Initial Setup with Debian 10.

How to Setup and Use dpkg on Debian 10 and Debian 9

Like Ubuntu and Linux Mint, Debian also uses the dpkg package manager for managing the packages. Dpkg is installed by default on Debian and the derivatives are used to install, build, and remove .deb packages. dpkg is the lowest level tool for Debian package management. It is a very powerful tool that should be used with care.

Recommended Article: Tutorial How to Migration Guide from cPanel to Directadmin

Packages information

The information that dpkg maintains is divided into three classes:

states, selection states, and flags.

However, the values would be changed with dselect. Let’s see what any title means for them.

Package states:

not installed: The package is not installed on your system.

config-files: Only the configuration files of the package exist on the system.

half-installed: The installation of the package has been started but not completed for some reason.

unpacked: The package is unpacked, but not configured.

half-configured: The package is unpacked and configuration has been started, but not yet completed for some reason.

triggers-awaited: The package awaits trigger processing by another package.

triggers-pending: The package has been triggered.

installed: The package is correctly unpacked and configured.

Package selection states

install: The package is selected for installation.

hold: A package marked to be on hold is not handled by dpkg unless forced to do that with option –force-hold.

deinstall: The package is selected for de-installation.

purge: The package is selected to be purged.

Package flags

ok: A package marked ok is in a known state, but might need further processing.

reinstreq: A package marked reinstreq is broken and requires reinstallation. These packages cannot be removed unless forced with option –force-remove-reinstreq.

How to view the list of installed packages

If you wish to list the installed packages on your system before you start the installation use the following command to view a long list of installed packages:

dpkg --list

Install And Use Dpkg on Debian Linux

If you use a package using apt, it first creates a list of all dependencies and downloads it from the repository.

If you use the old apt-get versions, move your deb file to /var/cache/apt/archives/ directory firstly. In this way, it will automatically download its dependencies. Then, install gdebi and open your .deb file using it. It will install your .deb package with all its dependencies.

Note: All these methods will fail to satisfy the software dependency if the dependencies required by the deb is not present in the package index. Because PT maintains the package index which is a database available in repo defined in /etc/apt/sources.list file and in the /etc/apt/sources.list.d directory.

How to Install the .deb package using DPkg

To install the .deb package, you just need to type dpkg followed by the -install or -i option and the .deb file name.

sudo dpkg --install [.deb file]

Note: You must run the above command from the same directory where the .deb package resides. But if you are running it from another one, remember to mention the full path to the .deb file.

sudo dpkg --install [path/to/.deb file]

Since the dpkg command installs the specified package only without any dependencies, you may face an error when you install a package that requires some dependencies. Also because the dpkg does not install the package and leaves it in an unconfigured and broken state.

dpkg: error processing package

Run the command below in Terminal to solve this error:

sudo apt -f install

In this way, you can use this command to fix the broken package and install the required dependencies assuming they are available in the system repository.

How to verify package installation

You can easily verify package installation using Dpkg. You can also verify package installation by searching it through the Debian dash menu. When you see it is available there, you can make sure of package installation. However, as we mentioned, the dpkg could allow you to verify the package installation. To do this, type dpkg with -status or -s option to verify the package installation:

dpkg --status [package-name]

How to remove installed package 

Any time you decide to uninstall the installed package, you can remove it using the dpkg command. Mention the installed package name instead of mentioning the .deb package name that was used to install the package and easily remove an installed package. So, to find out the exact package name, type:

dpkg –l | grep keyword
Note: Keyword is any related word to the package name.

For instance, for the Skype package, you can type skype and the command would be as like below:

dpkg –l | grep skype

In this way, you can remove the package using the following syntax. Use the -remove or -r option when you found the exact name of the installed package.

sudo dpkg --remove [package file]
sudo dpkg --remove skypeforlinux

Note: as you see, you can simply type the Skype installed package name instead of typing the ”skypeforlinux-64.deb”

Recommended Article: How to Activate and use the Sandbox in Windows 10

How to use dpkg manually

There is a very simple way to install a single package you have downloaded is the command dpkg -i that is short for dpkg –install.

When you download the package icewm_0.8.12-1.deb and you want to install it, log on as root user first and then type:

dpkg -i icewm_0.8.12-1.deb

In this way, the icewm version 0.8.12 will be installed. dpkg will upgrade your older version to avoid installing both versions at once.

To remove a package, you will have two options. First is:

dpkg -r icewm

That removes the icewm package (-r is short for –remove)

Note: While you give only the ‘icewm’ for –remove, the –install requires the entire .deb filename.

–remove will leave configuration files for the package on your system. A configuration file is defined as any file you might have edited in order to customize the program for your system or your preferences. This way, if you later reinstall the package, you won’t have to set everything up a second time. However, you might want to erase the configuration files too, so dpkg also provides a –purge option. dpkg –purge icewm will permanently delete every last file associated with the icewm package.b


In this article, you learned How To Install and Use Dpkg on Debian 9 & 10. Now, you can view a list of installed packages, verify the packages when you installed them, and remove a package when you do not need it anymore. And finally, you saw the way you can use dpkg manually.

Debian package management consists of several layers. You will be able to use dpkg under a very bad situation such as an unbootable system without a network connection because it is a very low-level package tool. The lowest layers are made up of dpkg and associated programs.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day