Jumping between Debian and RedHat based Linux distros can be confusing sometimes for me. This is why I decided to create this short Debian Package Management guide. But, first I need to brew a good cup of Catimor coffee variety at home.

Brief terms:

dpkg – Low-level tool to manage .deb packages.

apt, apt-get, apt-cache – High-level front ends for package management (use online repositories).

Install, Upgrade, and Uninstall Debian Packages

Install a .deb package (local file):

sudo dpkg -i package-name.deb

Fix missing dependencies (after installing a .deb manually):

sudo apt -f install

Upgrade an installed package:

sudo apt upgrade package-name

Or all upgrade ALL packages:

sudo apt update && sudo apt upgrade

Uninstall a package (local):

sudo dpkg -r package-name

Remove completely with configuration files:

sudo dpkg -P package-name

Install from the repository:

sudo apt install package-name

Find Packages Containing Specific Files or Libraries

Search for a file in installed packages:

dpkg -S /path/to/file

For example:

dpkg -S /bin/ln

Obtain Package Info: Version, Content, Dependencies, etc.

Check if a package is installed:

dpkg -l | grep package-name

Show details about a package:

dpkg -s package-name

List files installed by a package:

dpkg -L package-name

Show dependencies of a package:

apt depends package-name

Show reverse dependencies (who depends on it):

apt rdepends package-name

Common apt commands:

TaskCommand
Update repo listsudo apt update
Install a packagesudo apt install htop
Upgrade installed packagessudo apt upgrade
Remove a packagesudo apt remove package-name
Full removal (with config)sudo apt purge package-name
Clean downloaded filessudo apt clean
Autoremove unused packagessudo apt autoremove

If you like this article and want to support me consider buying a T-Shirt or coffee mug from my shop. Thanks.

Leave a comment

Your email address will not be published. Required fields are marked *