Debian Software Package Management(dpkg) in Linux (original) (raw)

Last Updated : 18 May, 2026

Debian Software Package Management(dpkg) is the low-level package management system used in Debian-based Linux operating systems. It installs, removes, configures, and manages software packages in the .deb format without handling dependencies automatically.

**Example: Listing the debian packages

dpkg -l

This command displays a list of all installed Debian packages on the system.

**Output:

Listing debain packages

Syntax

dpkg [options] action

Key Features

1. Low-Level Package Control

2. Package Database Management

3. System-Level Operation

4. Backend for Higher-Level Tools

Common dpkg Commands

1. Installing a standalone package

To install a package, -i flag is used. To install a standalone package using the Debian package.

**Syntax:

sudo dpkg -i name_of_package.deb

**Command:

sudo dpkg -i atom-amd64.deb

This command installs a standalone .deb package for Atom, an open-source text editor.

**Output:

Installing a stand-alone package using the Debian package

2. Removing a package

To remove a package, the -r flag is used with the dpkg command.

**Syntax:

sudo dpkg -r name_of_package

**Command:

sudo dpkg -r atom

This command is used to remove the Atom text editor package from the system while keeping its configuration files intact.

**Output:

removing package using debian package manager

3. Purging a Package

The -P (purge) flag removes the package along with all configuration files.

**Command:

sudo dpkg -P googler

This command completely removes the package and its configuration files from the system.

**Output:

Listing debain packages

4. Finding a Specific Installed Package

To search for a particular package, the output of dpkg -l can be filtered using the grep command.

**Command:

dpkg -l | grep atom

This command displays information only about the specified package if it is installed on the system.

**Output:

Searching for debian packages

5. Listing All Available dpkg Commands

To list all available options and commands supported by dpkg, the --help option is used.

**Command:

dpkg -–help

This command displays a help menu containing all available dpkg commands and options.

**Output:

Listing the dpkg commands

dpkg options

6. View the content of a particular package

To view the content of the particular package -c flag is used

**Command:

dpkg -c flashplugin-nonfree_3.2_i386.deb

This command lists all files that will be installed by the specified Debian package.

**Output:

viewing the content of paticular package

7. Printing the System Architecture

The --print-architecture option displays the system architecture

**Command:

dpkg --print-architecture

This command outputs the system architecture, such as amd64, i386, or arm64.

**Output:

print architecture of dpkg installations

8. Unpacking a Package

To unpack a package without configuring it, the --unpack flag is used.

**Command:

dpkg --unpack flashplugin-nonfree_3.2_i386.deb

This command extracts the package files but does not configure the package.

**Output:

Unpacking the packages

**Command:

dpkg --configure flashplugin-nonfree

**Output:

setting up flashplugin

9. Checking Whether a Package Is Installed

To check if a particular package is installed or not -s flag is used.

**Command:

dpkg -s git

**Output:

checking whether package is installed or not

10. Reconfigure the installed package

To reconfigure the already installed package dpkg-reconfigure command is used

**Command:

dpkg-reconfigure [package-name]

This command re-runs the configuration process for the specified package.

11. Locating Installed Package Files

The location of the installed package can be found using -L flag.

**Syntax:

dpkg -L [package-name]

**Command:

dpkg -L git

**Output:

locating the installed packages

12. Checking for Package Issues

To check for partially installed or broken packages, the --audit option is used.

**Command:

dpkg --audit

This command reports any issues related to package installation or configuration.

13. Clearing Available Package Information

To erase stored information about available packages, the --clear-avail option is used.

**Command:

dpkg –-clear-avail

This command clears cached information about available packages from the system.

14. Display dpkg version

dpkg –version is used to display dpkg version information.

**Command:

sudo dpkg --version

This command shows the current version of the Debian package manager installed on the system.

**Output:

checking version of dpkg