Linux package managers: APT, DNF, and pacman
Ubuntu instructions often use apt, while Fedora and Arch Linux use different commands. Once you know which package manager your distribution uses, you can find software and check whether your installed version has been updated.
What packages and repositories do
A package bundles software files with information such as the version and dependencies. Dependencies are other packages that the program needs to work. A package manager looks for suitable packages in its configured repositories and installs any dependencies it needs. APT is common on Debian and Ubuntu, DNF on Fedora and the RHEL family, and pacman on Arch Linux. Compare Linux distributions
Compare commands using curl
Start by searching for the software and checking what is installed. Searches use repository information. Installed-package queries use the local package database. The search and query commands in the table do not install or upgrade packages. When installing or upgrading, review the proposed package changes before confirming. On a narrow screen, scroll the table sideways to see each tool’s column.
Search, query, install, and upgrade
| Task | APT-based | DNF-based | Arch Linux |
|---|---|---|---|
| Search repository information | apt search curl |
dnf search curl |
pacman -Ss curl |
| Query the installed package | dpkg-query -l curl |
rpm -q curl |
pacman -Q curl |
| Install the package | sudo apt install curl |
sudo dnf install curl |
sudo pacman -Syu curl |
| Upgrade installed packages | sudo apt update then sudo apt upgrade |
sudo dnf upgrade |
sudo pacman -Syu |
Read the package name and version
A search can also find related packages. For example, some systems use curl-minimal in place of curl. If the query returns no match, use the search results to help identify the package name. In dpkg-query -l, an i in the second status position means the package is installed. When checking for a security fix, read the full version, including the distribution’s revision. dpkg-query and rpm
Distinguish refreshing the index from upgrading software
Run APT update before upgrade
apt update refreshes package information from the configured sources. apt upgrade uses that information to install available upgrades. If an upgrade would require removing an installed package, apt upgrade holds that upgrade back. Check the resulting list for packages that were held back. APT manual
Use DNF upgrade to update packages
dnf upgrade checks the enabled repositories and applies upgrades that satisfy dependencies. It can refresh repository metadata as needed during that operation. Run dnf --version to identify your version when options differ between DNF and DNF5. DNF reference and DNF5 upgrade
Refresh and upgrade together on Arch Linux
pacman -Syu synchronizes the repository databases and upgrades the system. Arch Linux does not support partial upgrades, in which only a subset of packages is upgraded against a newly refreshed database. Libraries can get out of step with the applications that use them. The pacman -Syu curl example combines a full system upgrade with installing curl. pacman manual and Arch Linux update policy
Check the distributor’s advisory for fixed versions
To check a security update, match the installed package name and version against the advisory from the distribution or other source you use. A fix might be present in a new distribution revision even when the upstream version looks the same. For packages from an external repository, check the publisher’s update information. How to identify the source and fixed version