dpkg is the low-level package manager on Debian-derived systems. It installs, removes, and queries individual .deb files but does not handle dependency resolution—that is apt's job. In everyday use, users interact with apt and only rarely reach for dpkg directly, usually to install a downloaded .deb file or to query package contents.
sudo dpkg -i package.deb # install a local .deb
sudo dpkg -r package # remove
dpkg -l # list all installed packages
dpkg -L nginx # list files owned by a package
dpkg -S /etc/nginx/nginx.conf # which package owns this file?
dpkg --configure -a # finish interrupted installs
dpkg -i fails if dependencies are missing—you then run sudo apt --fix-broken install to let apt pull them in. The complementary dpkg-query is what apt and scripts use to get structured package information.
dpkg's database lives in /var/lib/dpkg/, with status listing every known package, info/ holding per-package scripts, and available caching the full archive metadata. Understanding dpkg helps demystify what apt is doing under the hood, and occasionally lets you recover from broken states where apt itself gets stuck.
Related terms: apt, Debian, Package Manager
Discussed in:
- Chapter 11: Package Management — apt: The Debian Way
Also defined in: Textbook of Linux