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 and downgrades, plus the errors and the traps that break Arch systems.

Last updated September 11, 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
Upgrade using the databases you already have, without refreshing
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 from a named repo when two repos ship the same package
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
Cascade: remove it and everything that depends on it (read the list first)
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
List the packages in a group

Package Info

CommandWhat it does
Repo info: version, size, dependencies
Installed info, including install date, reason, and what requires it
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
Native packages only, names only
Re-mark it as a dependency so orphan cleanup can take it later
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

Downgrade a Package

pacman has no rollback. You go back by installing an older package file, from your cache or from the Arch Linux Archive.

CommandWhat it does
See which older versions you still have cached
Install that version over the current one
Install a version that is no longer cached, straight from the archive
Pick a version from cache or the archive interactively (, from the AUR)

The next pulls the new version straight back. Hold it with in until the upstream bug is fixed, and treat that hold as temporary: a pinned package whose dependencies keep moving is a partial upgrade waiting to happen.

Force and Overwrite

There is no any more; it was split into narrower flags. Use them when you know exactly which file or dependency is in the way.

CommandWhat it does
Reinstall a package that is already installed, restoring deleted files
Install over untracked files, for the exact paths the error named
Remove without dependency checks, leaving whatever needed it broken
Last resort; ignores every file conflict on the system

Reinstall every native package, after a half-finished upgrade or a mangled :

sudo pacman -S $(pacman -Qnq)

Skip Prompts

CommandWhat it does
Answer yes to every prompt, for scripts and provisioning
Install unattended, skipping what is already current
Remove without the confirmation
Quieter output for logs and CI

takes the default answer to every question, and on a replace-this-with-that or pick-a-provider prompt the default is not always the one you want. Keep it for containers and scripts, not for your daily upgrade.

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
Pull key updates from a keyserver (slow, and rarely the actual fix)

When the keyring itself is broken and signatures still fail, rebuild it from scratch:

sudo rm -r /etc/pacman.d/gnupg
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman -Sy archlinux-keyring

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
Hold back a whole group
Add it under for the Pac-Man progress bar
Uncomment the section (both lines) for 32-bit packages, e.g. Steam

Enabling multilib means uncommenting both lines, then refreshing the databases:

[multilib]
Include = /etc/pacman.d/mirrorlist

A third-party repo is the same shape, appended at the end of the file, and the lower it sits the lower its priority:

[myrepo]
SigLevel = Optional TrustAll
Server = https://example.com/repo/$arch

Run after either change. Custom post-install actions go in rather than in this file.

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

yay and paru

Helpers pass repo packages straight to pacman and build AUR ones with makepkg. Install one with the same manual build, since the helper is itself an AUR package:

sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay && makepkg -si
CommandWhat it does
Upgrade repo and AUR packages together (plain does the same)
Upgrade only the AUR packages
Search the repos and the AUR at once
Download the PKGBUILD only, to read before you build
Remove build dependencies nothing needs any more
paru's equivalent of ; it shows the PKGBUILD diff by default

Run helpers as your normal user, never with : they call sudo themselves at the install step, and building as root breaks file ownership. Everything in the AUR is a user submission with no review, so read the PKGBUILD for anything with few votes.

History and Logs

pacman logs every transaction to . There is no like DNF has; rolling back means reinstalling the older package file.

CommandWhat it does
What pacman did last
Every install, with dates
The last batch of upgrades, to find what broke something
The same, filtered properly (pacman-contrib)
Installed packages ordered by install date

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, native, orphans
remove unneeded dependencies too, no .pacsave backups, cascade, skip dependency checks
install a package filelocal path or URL
file database refresh it first
change the database, to change why a package is installed

Common pacman Errors

ErrorWhat it means and how to fix it
pacman cannot reach the mirrors. Check DNS and the system clock, retry with , then regenerate the mirrorlist with reflector
Your database is older than what the mirror now carries.
Another pacman is running, or one died. Check , then
A file on disk belongs to no package. Find the owner with ; if there is none, move it aside or install with for that exact path
Almost always a stale keyring or a wrong clock, not a bad mirror. Fix the clock, update , then clear the bad download with
/ The keyring does not have the packager's key. Update , or rebuild the keyring
The package was renamed, moved to the AUR, or lives in a repo you have not enabled, such as multilib. Search with first
/ Something installed still needs it. shows Required By; remove them together with , or cascade with
Everything you asked for is already installed and current
on The package cache filled the partition. , then

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, and that includes an AUR helper refreshing the databases for you.
  • 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: .
  • Downloads crawling is nearly always the mirrorlist, not pacman. Re-rank with reflector and raise in .
  • Queries need no root. , , , and all run as a normal user; only , , and need sudo.
  • 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 FAQ

How do I update Arch Linux with pacman?

sudo pacman -Syu, and that is the whole procedure. There is no separate update-then-upgrade step like apt: -S sync, -y refresh the databases, -u upgrade, all in one transaction. Two habits make it boring instead of exciting. Run checkupdates from pacman-contrib first to see what is coming without touching the databases, and skim archlinux.org for a manual intervention notice before a big upgrade after weeks away. Afterwards, look for .pacnew files so your edited configs do not drift away from the new defaults.

Is it safe to install one package without a full upgrade?

Installing with sudo pacman -S is fine on a system that is already current. What breaks Arch is running pacman -Sy, or any helper that refreshes the databases, and then installing later that day. You get a package built against today's libraries on a system that still has last month's, and the usual result is a broken glibc or a system that will not boot. There is no supported way to upgrade a single package on its own: use sudo pacman -Syu nginx, which upgrades everything and installs nginx in the same transaction.

What does the archlinux-keyring package do?

It ships the PGP keys of the Arch packagers, and pacman checks every package against it before installing. Packagers rotate and add keys, so on a machine that has not updated in months the keyring is too old to recognise current signatures and perfectly good packages look corrupt. Update it on its own first, then the system: sudo pacman -Sy archlinux-keyring && sudo pacman -Su. A wrong system clock causes the same symptom, since keys look not yet valid or expired. Never disable SigLevel to get past it.

Should I use pacman or yay for AUR packages?

pacman cannot install from the AUR at all. The AUR distributes PKGBUILD build recipes, not built packages, so you either clone the repo and run makepkg -si yourself or use a helper. yay and paru do the same job: fetch the PKGBUILD, build it, and hand the result to pacman, with AUR updates folded into the system upgrade. Run the helper as your normal user, never with sudo, and read the PKGBUILD before building anything with few votes. AUR packages are user submissions with no review.

Where is the pacman config file?

/etc/pacman.conf holds the repositories and pacman's own behaviour, and /etc/pacman.d/mirrorlist holds the servers it downloads from. Drop-in hooks live in /etc/pacman.d/hooks. Upgrades never overwrite your edits: pacman writes the new default next to the file as pacman.conf.pacnew, which is why enabling multilib or ParallelDownloads sometimes looks like it silently reverted after an upgrade. Merge pacnew files with pacdiff from pacman-contrib.

Related cheat sheets