dpkg — Debian Package Tool
apt is a friendly wrapper; dpkg is the lower-level tool that actually installs .deb files. You'll reach for it when you have a package file directly, or need details apt doesn't show as easily.
Install a local .deb file
sudo dpkg -i package.deb
If it fails due to missing dependencies:
sudo apt install -f # "Fix" — installs missing dependencies
List all installed packages
dpkg -l
dpkg -l | grep python
Get info about an installed package
dpkg -s curl
List files installed by a package
dpkg -L curl
Find which package a file belongs to
dpkg -S /usr/bin/ls
Packages record where a file really is. On Debian 13 /bin is only a link to /usr/bin, so dpkg -S /bin/ls finds nothing — ask about /usr/bin/ls (which ls shows the real path).
Remove a package with dpkg
sudo dpkg -r package-name # Remove
sudo dpkg -P package-name # Purge (remove + configs)
apt vs dpkg
| apt | dpkg | |
|---|---|---|
| Resolves dependencies | Yes | No |
| Downloads from repos | Yes | No (needs local .deb) |
| Use case | Day-to-day package management | Installing a downloaded .deb, low-level inspection |