Dpkg Command - Debian Package Management

Learn how to use the dpkg command for installing, upgrading, removing, and listing Debian packages. Essential tool for Linux package management.

Dpkg Command Reference

The dpkg command is a fundamental tool for managing Debian packages on Linux systems. It handles the installation, removal, and information retrieval of individual package files (.deb). While apt is often used for higher-level package management, understanding dpkg is crucial for deeper system administration.

Install or Upgrade a Debian Package

To install a new Debian package or upgrade an existing one, use the -i or --install option followed by the path to the .deb file.

dpkg -i <deb-file>

Remove a Debian Package

To remove a package, including its configuration files, use the -P or --purge option. This is a more thorough removal than simply uninstalling.

dpkg -P <deb-file>

List All Installed Packages

To get a comprehensive list of all installed packages on your system, along with their versions and brief descriptions, use the -l or --list option.

dpkg -l

Check if a Debian Package is Installed

You can determine if a specific Debian package is installed by using the -s or --status option and piping the output to grep to search for the 'Status' field.

dpkg -s <deb-file> | grep Status

External Resources