Package management in Linux: apt and dpkg
Updated July 3, 2026
apt installs, updates and removes packages from repositories, while dpkg handles a single .deb file.
Common cases
sudo apt update # refresh the package list
sudo apt install nginx # install a package
sudo apt remove nginx # remove a package
apt search nginx # find a package by name
dpkg -l # list installed packages
sudo dpkg -i ./pkg.deb # install from a local .debHow it works: apt sits on top of dpkg
The low-level
dpkgis what actually installs a package: it unpacks one.deband records it in a database. Butdpkgcannot find packages on the internet or pull in dependencies on its own.aptdoes that: it downloads the package and everything it needs from the repositories and callsdpkgto install them. So day to day you useapt, anddpkg -iis for when you already have a.debfile in hand. On Fedora and RHEL the same job is done bydnfandrpm.
In the book
This topic is covered in full in the chapter Packages and software.