dpkg Command: Tutorial & Examples
Install, remove, and manage Debian package files
dpkg
is a package management system for Debian and Debian-based Linux distributions such as Ubuntu, Linux Mint, and Raspbian. It is used to install, remove, and manage software
packages in the .deb
format.
dpkg
can be used to perform a variety of package management tasks, such as:
- Installing a new package:
dpkg -i package_name.deb
- Removing a package:
dpkg -r package_name
- Listing all installed packages:
dpkg -l
- Searching for a package:
dpkg -S file_name
- Getting information about an installed package:
dpkg -s package_name
However, for updating a package, dpkg
is not recommended as it operates at a lower level than other package managers like apt
and aptitude
. It doesn't resolve dependencies between packages automatically, so if you want to install a package that depends on other packages, you
need to install those packages first. Also, dpkg
doesn't automatically remove packages that are no longer needed.
While dpkg
is a powerful tool, it's often recommended to use higher-level package management tools like apt
or aptitude
,
which provide more advanced features such as dependency resolution and automatic removal of orphaned packages.