Packages and services

Command dpkg

Work with deb packages directly

Linux · Bash examples · commands run on the selected server

When to use dpkg

Use dpkg to inspect locally installed Debian packages and their file ownership. It is a lower-level package tool than apt and does not replace repository dependency resolution for ordinary installation workflows.

Syntax

dpkg [PARAMETERS] [PACKAGE...]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-l
List of known packages and states.
-L PACKAGE
List of files of the installed package.
-S PATH
Find the package that owns the path.

Usage examples

Check package

dpkg -l bash

The package's recorded installation state and version are listed.

Show package files

dpkg -L bash

Files recorded as belonging to the installed package are displayed.

Find the owner of a binary file

dpkg -S /bin/bash

The package database is searched for ownership of the specified path.

Notes and limitations

  • dpkg is Debian's low-level package tool. Installing a .deb file with -i does not resolve dependencies automatically.
  • Use apt for installation with dependency resolution. Do not delete dpkg database files manually.

Common questions and troubleshooting

Why does dpkg list a path that is not present?

The package database records expected ownership; files may have been removed, replaced or relocated. Inspect actual state and package integrity separately.

Does dpkg download missing dependencies automatically?

Not as a general repository resolver. Use the distribution's higher-level package manager for supported dependency handling.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man dpkg.