Packages
dpkg
Install, inspect, and remove Debian package files.
debianpackagedebinstall
Additional Notes
dpkg is the low-level Debian package tool. It installs, removes, lists, and inspects .deb packages, but it does not automatically resolve dependencies from repositories the way apt and apt-get do.
Use dpkg when you already have a local .deb file, need to inspect package contents, or need to ask which package owns a file. For normal package installation from repositories, use apt or apt-get instead.
Syntax
dpkg [options] action [package-or-file]
Parameters
action: Operation such as-i,-r,-l,-L,-S, or-s.package: Installed package name such asbashorcoreutils.file: Local.debfile or filesystem path.
Common Options
-i FILE.deb: Install a local Debian package file.-r PACKAGE: Remove an installed package but keep configuration files.-P PACKAGE: Purge a package and its configuration files.-l [PATTERN]: List installed packages.-s PACKAGE: Show package status and metadata.-L PACKAGE: List files installed by a package.-S PATH: Find which installed package owns a path.--configure PACKAGE: Configure an unpacked package.
Examples
sudo dpkg -i ./package.deb
Install a local package file.
dpkg -l | less
Browse installed packages.
dpkg -L bash
Show files installed by the bash package.
dpkg -S /bin/ls
Find the package that owns /bin/ls.
sudo dpkg --configure -a
Continue configuring packages after an interrupted install.
Practical Notes
dpkg -ican leave dependency problems. Repair them withsudo apt-get install -f.- Use
dpkg -Sfor installed files only. It cannot search packages that are not installed. - Prefer
apt removeorapt purgeunless you specifically need low-level package control.