Back to the command reference

dpkg

SystemFundamentalsReference only

Install and query .deb packages

Name: dpkg = Debian package

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

dpkg is the low-level tool of the Debian package system: it installs, removes and queries .deb files directly. It doesn't fetch dependencies, so if some are missing afterwards run sudo apt -f install.

Syntax

dpkg [OPTION]... ACTION

Common options

-i / --installInstall a .deb file
-r / --removeRemove a package (keeping its configuration)
-P / --purgeRemove a package and its configuration
-l / --listList installed packages
-s / --statusShow a package’s status and details
-L / --listfilesFiles installed by a package
-S / --searchWhich package owns a file
-c / --contentsList the files in a .deb (without installing it)

Examples

  • $ sudo dpkg -i google-chrome.deb

    Install a downloaded .deb

    Explain
  • $ dpkg -l | grep nginx

    Check whether nginx is installed

    Explain
  • $ dpkg -S /bin/ls

    Which package provides ls

    Explain

Related