In this article we show you the basics of Debian package management and how to manage software packages using dpkg.

Understanding Debian Package Management

The Debian package management employs a couple of diverse package management tools – such as “apt-get,” “aptitude,” “dpkg,” “apt-file,” “dselect,” “tasksel,” and “gdebi” – to manage software on the system. These tools are known as package managers. Some, if not all, of these tools utilize the low-level tool dpkg to provide high-level functionality. The dpkg command allows you to easily install and remove software and manipulate and upgrade software in a seamless fashion.

Usage of dpkg Command

How to Install a Software/Package

You can make use of dpkg to install software by using the following command. This command can also upgrade a package if it is already installed. The above command requires you to have a physical .deb file on your computer.

List Currently Installed Packages

To list or display currently installed packages on a Debian-based distro, you can use the commands below:

If you want to list all installed packages, just omit [search_pattern].

Remove Installed Packages

If you have already installed a package but do not use it anymore, you can use the following command to uninstall it. This command removes the entire package except configuration files.

List Content of a Package

You can use the commands below to list content of a package on your Linux computer: You can also use -c in place of –contents.

Check Whether a Package Is Installed or Not

Assuming you want to check whether you have installed a specific package on your computer, use the following command to check.

Check the Location of the Installed Package

If you just want to find out the location where the package will be installed, use the -L flag.

Display Detailed Information About a Package

This command displays or shows detailed information about a package.

Install Multiple Packages Simultaneously

If you have a number of deb files that you want to install, you can run the following command to install them all at one go. Do note that for this to work, you have to place all the .deb files in the same folder.

Unpack a deb Package

Sometimes you might want to unpack a deb package so you can make changes to its files. Use this command to unpack a deb file.

Reconfigure an Unpacked deb Package

After you have made changes to the files, use this command to configure and repack it into a deb file for installation.

In Need of Extra Information About dpkg Commands?

If you want to know more about dpkg commands, you can use the command below. It displays detailed information about dpkg commands and options.

Conclusion

Most of the Debian-based package managers rely solely on dpkg to get things done. With the above commands, you can get down to the basics when all other installation methods fail. Image credit: Debian – Wooden 3D rendered letters/message by christitzeimaging.com/Shutterstock