Package managers: Ubuntu, Fedora and Arch
A complete guide to installing, updating and removing software from the terminal on the three big Linux families. Read it once, then use it as a cheat sheet.
This page assumes you've read Level 2 · Meet the terminal and sudo. You can do everything here with the graphical app store too. The terminal is just faster and shows you more.
The basics in 2 minutes
- A package is a program packed up together with information about what it needs to run.
- A repository ("repo") is an online library of packages, checked and signed by your distro.
- A package manager downloads packages from repositories, installs them, keeps them updated and removes them cleanly.
- Dependencies are other packages a program needs. The package manager installs them for you automatically.
The repository is a supermarket that only stocks inspected products. The package manager is your personal shopper: you say "VLC", and it fetches VLC plus everything VLC needs, puts it all away, and later brings you updates for all of it in one trip.
The three big families do exactly the same job with different commands and different package formats:
| Family | Distros | Tool | Package files |
|---|---|---|---|
| Debian | Ubuntu, Linux Mint, Debian, Pop!_OS, Zorin OS | apt (uses dpkg underneath) | .deb |
| Red Hat | Fedora, RHEL, AlmaLinux, Rocky Linux | dnf (uses rpm underneath) | .rpm |
| Arch | Arch Linux, Manjaro, EndeavourOS, CachyOS | pacman | .pkg.tar.zst |
Package files from one family don't work on another. A .deb is for Ubuntu/Mint, not Fedora. Always download the format for your distro, or use Flatpak, which works everywhere.
Which one do I have?
$ cat /etc/os-release
Look at the NAME and ID_LIKE lines. ID_LIKE=debian or ubuntu means apt, fedora means dnf, and arch means pacman.
Side-by-side cheat sheet
Replace pkg with the package name, for example vlc.
| Task | Ubuntu / Mint (apt) | Fedora (dnf) | Arch (pacman) |
|---|---|---|---|
| Update everything | sudo apt updatesudo apt upgrade | sudo dnf upgrade | sudo pacman -Syu |
| Only check for updates | apt list --upgradable(after apt update) | dnf check-upgrade | checkupdates(from pacman-contrib) |
| Search | apt search pkg | dnf search pkg | pacman -Ss pkg |
| Show details | apt show pkg | dnf info pkg | pacman -Si pkg |
| Install | sudo apt install pkg | sudo dnf install pkg | sudo pacman -S pkg |
| Install a downloaded file | sudo apt install ./file.deb | sudo dnf install ./file.rpm | sudo pacman -U file.pkg.tar.zst |
| Reinstall | sudo apt install --reinstall pkg | sudo dnf reinstall pkg | sudo pacman -S pkg |
| Remove | sudo apt remove pkg | sudo dnf remove pkg | sudo pacman -Rs pkg |
| Remove including system-wide settings | sudo apt purge pkg | (remove already does this) | sudo pacman -Rns pkg |
| Remove unneeded dependencies | sudo apt autoremove | sudo dnf autoremove | sudo pacman -Rns $(pacman -Qdtq) |
| List installed packages | apt list --installed | dnf list --installed | pacman -Q |
| List packages you installed | apt-mark showmanual | dnf repoquery --userinstalled | pacman -Qe |
| Which package owns this file? | dpkg -S /usr/bin/vlc | rpm -qf /usr/bin/vlc | pacman -Qo /usr/bin/vlc |
| Which package would provide a file? | apt-file search name(install apt-file) | dnf provides '*/name' | pacman -F name(after sudo pacman -Fy) |
| List a package's files | dpkg -L pkg | rpm -ql pkg | pacman -Ql pkg |
| Clean download cache | sudo apt clean | sudo dnf clean all | sudo paccache -r(from pacman-contrib) |
| Hold a package at its current version | sudo apt-mark hold pkg | sudo dnf versionlock add pkg(older Fedora: install python3-dnf-plugin-versionlock first) | Add to IgnorePkg in /etc/pacman.conf |
| History of changes | less /var/log/apt/history.log | dnf history list | less /var/log/pacman.log |
| Extra software sources | PPAs | RPM Fusion, COPR | AUR |
Ubuntu / Mint / Debian: apt
The everyday routine
$ sudo apt update # 1. refresh the catalogue
$ sudo apt upgrade # 2. install all available updates
$ sudo apt autoremove # 3. tidy up leftovers (now and then)
update only downloads the list of what's available, like fetching the newest menu. upgrade actually installs newer versions. Running upgrade without update first means working from an old menu.
Finding and installing
$ apt search "video editor" # search names and descriptions
$ apt show kdenlive # size, version, description
$ sudo apt install kdenlive
$ sudo apt install vlc gimp inkscape # several at once
Installing a downloaded .deb file
Some companies (Google Chrome, Zoom, Steam…) offer a .deb download. Double-click it to install it with a graphical installer, or use:
$ sudo apt install ./google-chrome-stable_current_amd64.deb
The ./ matters: it tells apt this is a file, not a package name. apt fetches any dependencies automatically. Many such packages also add their own repository, so they'll update along with everything else.
apt vs apt-get
Online guides often use apt-get and apt-cache. These are older tools that do the same job. apt is the newer, friendlier command for people. apt-get is still preferred inside scripts.
PPAs: extra repositories (Ubuntu and Mint)
A PPA (Personal Package Archive) is a repository run by an individual or project, usually to offer a newer version of an app than Ubuntu has.
$ sudo add-apt-repository ppa:some-team/some-app
$ sudo apt update
$ sudo apt install some-app
# to remove it again:
$ sudo add-apt-repository --remove ppa:some-team/some-app
On Linux Mint you can also manage PPAs in Software Sources.
PPAs aren't checked by Ubuntu. Only add PPAs from the official website of the app, and as few as possible. Too many PPAs are the most common reason a big Ubuntu version upgrade fails. Before reaching for a PPA, check whether a Flatpak exists.
Ubuntu's Snap
On Ubuntu (not Mint), some apps like Firefox come as Snaps. Even sudo apt install firefox installs the Snap version. Manage them with:
$ snap list
$ sudo snap refresh # update all snaps (also happens automatically)
$ sudo snap install spotify
$ sudo snap remove spotify
Fixing a broken install
$ sudo apt --fix-broken install # complete half-finished installs
$ sudo dpkg --configure -a # finish configuring interrupted packages
If apt says it "could not get lock", another update is already running (often the automatic updater). Wait a few minutes. Don't delete lock files.
Fedora: dnf
The everyday routine
$ sudo dnf upgrade # refresh AND install updates, in one step
$ sudo dnf autoremove # remove unneeded dependencies
Unlike apt, dnf refreshes its catalogue automatically, so you don't need a separate "update" step. (dnf update also works and means the same as dnf upgrade.)
Finding and installing
$ dnf search kdenlive
$ dnf info kdenlive
$ sudo dnf install kdenlive
$ sudo dnf install ./zoom_x86_64.rpm # a downloaded .rpm file
Groups: install a whole set at once
$ dnf group list
$ sudo dnf group install development-tools
History and undo: dnf's superpower
dnf keeps a numbered history of every change, and can undo one:
$ dnf history list
ID | Command line | Date and time | Action(s) | Altered
12 | install kdenlive | 2026-11-20 14:02 | Install | 38
11 | upgrade | 2026-11-18 09:15 | Upgrade | 112
$ dnf history info 12 # what exactly did #12 change?
$ sudo dnf history undo 12 # reverse it
RPM Fusion: codecs, NVIDIA drivers and more
Fedora only ships fully free software, so it leaves out things like some video codecs and the NVIDIA driver. The RPM Fusion repository provides them. Almost every Fedora desktop user enables it:
$ sudo dnf install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
The \ at the end of a line means "the command continues on the next line". $(rpm -E %fedora) fills in your Fedora version number automatically. See rpmfusion.org for the follow-up steps for codecs and NVIDIA.
COPR: community repositories
COPR is Fedora's equivalent of Ubuntu's PPAs: small repositories built by individuals.
$ sudo dnf copr enable username/project
$ sudo dnf install some-app
$ sudo dnf copr remove username/project
Like PPAs, COPR repositories aren't reviewed by Fedora. Use them only from sources you trust.
Upgrading to a new Fedora version
A new Fedora comes out about every six months. The easiest way to upgrade is the Software app, which shows a banner when a new version is available. Terminal instructions are in the official Fedora documentation. Search for "Fedora upgrading with dnf system upgrade".
Fedora Silverblue, Kinoite and Bazzite are "atomic" editions where the system can't be changed piece by piece. They use rpm-ostree instead of dnf and are meant for Flatpak apps. If dnf install refuses to work, you're probably on one of them.
Arch / Manjaro: pacman
pacman's commands are short letter codes. They look cryptic at first but follow a pattern:
| Capital letter = main action | Small letters = options |
|---|---|
-S Sync: install from the repositories | y refresh the catalogue · u upgrade · s search · i info · c clean cache |
-R Remove | s also remove unneeded dependencies · n also delete system config files |
-Q Query installed packages | e explicitly installed · d installed as dependency · t not needed by anything · i info · l list files · o owner of a file |
-U Upgrade/install from a local file | |
-F search the Files database | y refresh it |
So pacman -Syu reads "Sync, refresh (y), and upgrade everything".
The everyday routine
$ sudo pacman -Syu # update everything
$ pacman -Ss kdenlive # search
$ sudo pacman -S kdenlive # install
$ sudo pacman -Rs kdenlive # remove, with unneeded dependencies
$ pacman -Qdt # list orphans (no longer needed)
$ sudo pacman -Rns $(pacman -Qdtq) # remove all orphans
Keeping the cache small
pacman keeps every downloaded version in /var/cache/pacman/pkg. That's useful for going back to an older version, but it grows forever. Install pacman-contrib and run:
$ sudo paccache -r # keep only the 3 newest versions of each
$ sudo systemctl enable --now paccache.timer # do it automatically every week
Arch-specific habits
- Read the news before updating. Occasionally an update needs a manual step, announced at archlinux.org/news.
- Update the whole system, always. Arch expects every package to be at the latest version together. See the warning below.
- Watch for
.pacnewfiles. When an update brings a new default config file and you've edited the old one, pacman saves the new one assomething.pacnewrather than overwriting your changes. Compare and merge them withpacdiff(frompacman-contrib). - Update regularly. Updating weekly is smooth. Updating after six months is more likely to need manual fixes.
Don't run sudo pacman -Sy somepackage. That refreshes the catalogue but installs only one new package, which may need newer libraries than the rest of your (not upgraded) system has, and things can break. Use sudo pacman -Syu somepackage to update everything and install it in one go, or plain sudo pacman -S somepackage without the y.
Manjaro holds packages back for a couple of weeks for extra testing, and has its own graphical updater (pamac). The pacman commands are the same, but advice written for Arch doesn't always apply.
Arch: the AUR
The AUR (Arch User Repository) is a huge collection of community-contributed build recipes. Almost any Linux program you can think of is there. An AUR package isn't a ready-made program. It's a recipe file (a PKGBUILD) that downloads the source or binary and builds a package on your computer.
Using an AUR helper
An AUR helper like yay or paru automates this and works just like pacman. To install yay the first time:
$ sudo pacman -S --needed git base-devel
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si
After that, use yay without sudo. It asks for your password when needed:
$ yay -S visual-studio-code-bin # install from the repos OR the AUR
$ yay # update everything, repos and AUR together
$ yay -Ss spotify # search both
Packages ending in -bin are pre-built and install quickly. Those ending in -git build the very latest development version from source.
Anyone can upload to the AUR. Before installing, look at the package page on aur.archlinux.org: a high vote count, a recent update date and an active maintainer are good signs. Helpers offer to show you the PKGBUILD; skim it for downloads from strange websites. Never run yay or makepkg with sudo.
Flatpak works everywhere
Flatpak uses exactly the same commands on Ubuntu, Fedora and Arch, which makes it the easiest way to get the same app on any distro. See Level 2 for the full picture.
# one-time setup, if Flathub isn't enabled yet (Mint and Fedora have it already)
$ sudo apt install flatpak # or: sudo pacman -S flatpak
$ flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
$ flatpak install flathub org.gimp.GIMP
$ flatpak run org.gimp.GIMP
$ flatpak list
$ flatpak update
$ flatpak uninstall --unused
On Ubuntu, also install the gnome-software-plugin-flatpak package to see Flatpaks in a graphical store. Then log out and back in.
Golden rules (all distros)
- Prefer the official repositories, then Flatpak, then extra repos (PPA, COPR, AUR), then downloads from the app's own website, in that order.
- Don't mix families. Never install a Fedora
.rpmon Ubuntu, or add Debian repositories to Ubuntu "because the version is newer". - Read before you press Y. If an install wants to remove many packages, especially anything with "desktop", "kernel" or "xorg" in the name, say no and find out why.
- Don't interrupt an update. Don't close the terminal or turn the computer off halfway. On a laptop, plug in the charger.
- Take a Timeshift snapshot before large updates or before adding a new repository. See Level 2 · Backups.
- Avoid
sudo pip installandsudo npm install -g. These install software behind the package manager's back and can break system tools. Use your distro's packages,pipx, or a virtual environment.