Skip to content
Latchkey

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 -y

In 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →