dpkg Command Reference: Flags, Usage & CI Examples
dpkg installs and queries individual Debian .deb packages.
dpkg is the low-level Debian package tool that apt-get builds on. It installs a local .deb directly, queries installed packages, and lists which package owns a file.
Common flags and usage
- -i <file.deb>: install a local package
- -r / -P <pkg>: remove / purge a package
- -l [pattern]: list installed packages
- -L <pkg>: list files a package installed
- -S <path>: find which package owns a file
- --configure -a: finish configuring unpacked packages
Example
shell
dpkg -i ./mytool_1.2.3_amd64.deb || apt-get install -f -yIn CI
dpkg -i does not resolve dependencies; a missing dependency leaves the package unconfigured, so follow it with apt-get install -f -y to pull the rest in. Use dpkg -S to debug "which package provides this binary" in an image.
Key takeaways
- dpkg -i installs a local .deb but does not resolve dependencies.
- Run apt-get install -f -y afterward to fix missing dependencies.
- dpkg -L and -S map packages to and from files.
Related guides
apt-get Command Reference: Flags, Usage & CI ExamplesReference for apt-get: update, install, -y, DEBIAN_FRONTEND, --no-install-recommends, and a CI example that i…
apt-key Command Reference: Usage, Deprecation & CI ExamplesReference for apt-key: add, adv, the modern signed-by keyring replacement, and a CI example that installs a r…
rpm Command Reference: Flags, Usage & CI ExamplesReference for rpm: -i, -U, -e, -q, -ql, -qf, and a CI example that installs a local .rpm and queries which pa…