Linuxlab

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 .deb

How it works: apt sits on top of dpkg

The low-level dpkg is what actually installs a package: it unpacks one .deb and records it in a database. But dpkg cannot find packages on the internet or pull in dependencies on its own. apt does that: it downloads the package and everything it needs from the repositories and calls dpkg to install them. So day to day you use apt, and dpkg -i is for when you already have a .deb file in hand. On Fedora and RHEL the same job is done by dnf and rpm.

In the book

This topic is covered in full in the chapter Packages and software.

See also

which, type, whereis.