Cheat Sheet

pacman Commands

pacman is the package manager on Arch Linux and its derivatives: Manjaro, EndeavourOS, CachyOS, and the MSYS2 environment on Windows. This pacman commands cheat sheet covers the flag combinations that do the daily work, from -Syu to orphan cleanup, plus the traps that break Arch systems.

Last updated September 5, 2026

Update the System

syncs the package databases and upgrades everything in one transaction. Never run on its own and install something afterwards: new packages against old databases is a partial upgrade, and partial upgrades break Arch systems.

CommandWhat it does
Refresh the databases and upgrade every package
Upgrade the system and install a package in the same safe transaction
Force-redownload the databases too, after changing mirrors
List pending updates without touching the databases (pacman-contrib)

Install Packages

CommandWhat it does
Install a package from the repos
Install several, skipping any already current
Install a local package file
Download into the cache only, no install
Let the install overwrite specific conflicting files (targeted glob, never casually)

Remove Packages

CommandWhat it does
Remove just the package
Remove it and its now-unneeded dependencies
Also skip the .pacsave config backups; the usual full removal
List orphaned dependencies

Remove every orphan in one go:

pacman -Qdtq | sudo pacman -Rns -

Search Packages

CommandWhat it does
Search the repos by name and description
Search installed packages
Which repo package ships a file ( once first to fetch the file database)
Which installed package owns a file

Package Info

CommandWhat it does
Repo info: version, size, dependencies
Installed info, including install date and reason
Files the package installed
Dependency tree (pacman-contrib)

List Installed Packages

CommandWhat it does
Every installed package with its version
Explicitly installed packages, what you actually asked for
Foreign packages: AUR and local installs
Count them

Clean the Cache

Every downloaded package stays in until you clean it.

CommandWhat it does
Delete cached packages that are no longer installed
Empty the whole cache; you lose downgrade-from-cache
Keep the newest 3 versions of each package, delete the rest (pacman-contrib, the better habit)
Keep only the newest version
Downgrade by reinstalling an older version straight from the cache

Keyring

CommandWhat it does
Update the signing keys before a big upgrade on a stale system
Create the keyring on a fresh install
Load the Arch master keys

Mirrors

Mirrors live in and are tried top to bottom. reflector () ranks and rewrites the list; after changing mirrors, run .

sudo reflector --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

pacman.conf

holds the repositories and pacman's behaviour.

SettingWhat it does
Uncomment for coloured output
Download several packages at once
Hold a package back from upgrades
Uncomment the section (both lines) for 32-bit packages, e.g. Steam

The AUR

pacman itself cannot install from the AUR: the AUR ships build recipes, not packages. A helper builds them and wraps the upgrade.

CommandWhat it does
Build and install an AUR package (paru works the same)
Full system upgrade including AUR packages
The AUR packages currently installed

Building by hand, without a helper:

git clone https://aur.archlinux.org/package.git
cd package && makepkg -si

Flags Explained

pacman flags compose: one capital operation letter plus lowercase modifiers.

OperationModifiers
sync (install from repos) search, info, refresh databases, upgrade, download only, clean cache
query installed search, info, files, owner of file, explicit, foreign, orphans
remove unneeded dependencies too, no .pacsave backups
install a package filelocal path or URL
file database refresh it first

pacman, apt and dnf

The same tasks on Debian and Ubuntu are in the apt cheat sheet, and on RHEL and Fedora in the DNF cheat sheet.

Taskpacmanaptdnf
Refresh and upgrade
Install
Remove with dependencies
Search
Who owns a file
List installed
Clean cache

Gotchas

  • Partial upgrades break Arch. Either or nothing; never followed by an install later.
  • : another pacman is running. If none is (check with ), remove the stale lock with .
  • When you have edited a config file, pacman writes the new default next to it as instead of overwriting. Merge them after upgrades with (pacman-contrib), or at least look for them: .
  • Signature errors after months without updates mean a stale keyring, not corrupt mirrors: .
  • Manjaro holds Arch packages back about two weeks, so AUR builds that assume Arch-current libraries can fail there on version skew alone.
  • MSYS2 on Windows uses pacman with its own repositories: the flags on this page work, the Arch repos and the AUR do not.

pacman Cheat Sheet FAQ

How do I update everything with pacman?
sudo pacman -Syu: -S sync, -y refresh the package databases, -u upgrade everything, in one transaction. Arch is a rolling release, so that is the entire update procedure. What you must never do is run pacman -Sy alone and install something later: mixing new packages with old libraries is a partial upgrade, and it is the classic way to end up with an Arch system that will not boot.
How do I remove a package and its dependencies with pacman?
sudo pacman -Rns <pkg>: it removes the package, the dependencies nothing else needs (-s), and skips leaving .pacsave config backups behind (-n). Plain -R leaves the dependencies installed as orphans. For orphans that have already piled up, pacman -Qdt lists them and pacman -Qdtq | sudo pacman -Rns - removes them all in one command.
How do I clean the pacman cache?
pacman keeps every package it ever downloaded in /var/cache/pacman/pkg. sudo pacman -Sc deletes cached versions of packages no longer installed. The better routine is paccache -r from pacman-contrib, which keeps the newest three versions of each package so you can still downgrade from cache with pacman -U. pacman -Scc empties the cache completely and takes that safety net with it.
Can pacman install AUR packages?
No. The AUR distributes build recipes (PKGBUILDs), not built packages, and pacman only installs built packages. Either build one yourself, git clone the AUR repo and run makepkg -si, or use a helper like yay or paru, which downloads, builds, and installs through pacman and includes AUR updates in its system upgrade. pacman -Qm lists the AUR packages already on your system.
How do I fix pacman signature or keyring errors?
On a machine that has not updated in months, the archlinux-keyring package is too old to know the current packagers' keys, so valid signatures look corrupt. Update the keyring first, then the system: sudo pacman -Sy archlinux-keyring && sudo pacman -Su. If the keyring itself is broken, sudo pacman-key --init then sudo pacman-key --populate archlinux rebuilds it. Do not disable signature checking to get past the error.

Related cheat sheets