Skip to the content
pacman-master.com

pacman, the Arch Linux package manager

pacman is the program Arch Linux uses to install, upgrade, remove and query software packages, and it is driven by a single capital operation letter: -S to synchronise, -R to remove, -Q to query, -U to install a local package file.

sudo pacman -Syu
-S
--sync — install packages from the repositories and upgrade the system
-y
--refresh — refresh the package databases from the mirrors
-u
--sysupgrade — upgrade every installed package that is out of date

Needs root.

What it does. Refresh the package databases from the mirrors, then upgrade every installed package.

Watch out. Refreshing without upgrading — a bare -Sy — is the one mistake worth memorising.

This site documents pacman, the package manager of Arch Linux and the distributions built on it. It is not about the similarly spelled arcade video game.

How a pacman command is shaped

A pacman command has three parts, and reading them in order is enough to understand one you are handed:

pacman -<operation><modifiers> <targets>

The shape of a command, not a command: the angle brackets are where your own letters and names go.

The operation is one capital letter and there is exactly one of them. The modifiers are lowercase letters that attach to it, so -Syu is the operation -S with the modifiers y and u. The targets are the package names, file paths or search patterns the operation works on.

The same lowercase letter means different things under different operations, which is the part that makes pacman look cryptic. s under -R means recursive; the same s under -S means search. That is not an inconsistency to memorise one command at a time — it is why this site has a command explainer that reads the letters for you.

The operations

Six operations cover the commands most people ever type. Start from what you want to do and the letter follows from it:

Which operation letter answers which questionA single question at the top, what do you want to do, branching down into six answers. Putting software on the machine is -S. Taking it off is -R. Asking what is already there is -Q. Installing a package file you already have is -U. Finding which package owns a path is -F. Changing a database record is -D.What do you want to do?Put software on the machine-STake software off it-RAsk what is already there-QInstall a package file you have-UFind which package owns a path-FChange a database record-D
Six answers cover the commands most people reach for. Read the question first, then take the letter.
LetterLong formWhat it doesRoot?Can destroy?
-S--syncInstall packages from the repositories and upgrade the systemyesyes, with -Sc or -Sy used alone
-R--removeRemove installed packagesyesyes, that is its job
-Q--queryAsk the local database what is installednono
-U--upgradeInstall a package from a local package fileyesyes
-D--databaseChange how a package is recorded in the databaseyesno files change, but later removals do
-F--filesFind which repository package owns a fileno, except -Fyno

-F is the one row where the answer has an exception in it. Asking which package owns a file only reads, but -Fy downloads the file databases into /var/lib/pacman first, and writing there needs root.

Three more exist and are rarely typed by hand: -T reports which of the given dependencies are unsatisfied, -V prints the version, and -h prints the help for whichever operation you pair it with.

Start from the task, not the letter

If you know what you want to do, go straight to the page for it.

I want to…CommandPage
Update everythingsudo pacman -SyuUpdating Arch
Install a packagesudo pacman -S <package>Installing
Remove a packagesudo pacman -Rns <package>Removing
See what is installedpacman -QListing installed packages
Find a packagepacman -Ss <pattern>Searching
Free disk spacesudo pacman -ScCleaning the cache
Change or fix mirrors/etc/pacman.d/mirrorlistThe mirrorlist
Understand yayyay -S <package>yay vs pacman
Build from the AURmakepkg -siAUR helpers and makepkg
Fix a lock error/var/lib/pacman/db.lckThe database lock
Look a command uppacman -QdtThe cheat sheet

Read a command before you run it

Paste a pacman command into the command explainer: it names the letters it recognises, says whether the command needs root, and puts it at one of three levels — routine, caution or risky. It goes the other way round too: pick an operation and some modifiers, and it writes the command.

riskysudo pacman -Rdd glibc

dd removes the package without checking dependencies, which is what makes this line worse than the removal it looks like.

The words that keep coming up

pacman is the package manager of Arch Linux: the program that installs, upgrades, removes and queries packages, and that keeps the local database describing which files belong to which package.

A repository is a collection of built, signed packages that pacman can install from. The ones configured by default in Arch are called the official repositories.

A partial upgrade is a system where some packages come from a newly refreshed database and the rest are still at older versions, which happens when the databases are refreshed without also upgrading.

An orphan is a package that was installed as a dependency of something else and that nothing installed requires any more.

Common questions

What is pacman on Arch?

pacman is the package manager of Arch Linux. It installs and upgrades packages from the configured repositories, removes them, and answers questions about what is installed on the machine and which package a file belongs to.

Does Arch use pacman instead of APT?

Yes. APT belongs to Debian and the distributions derived from it. Arch Linux uses pacman, with its own command syntax: one capital operation letter followed by lowercase modifiers, rather than a subcommand word.

Do I need sudo for every pacman command?

No. Commands that only read need no root: the -Q queries, -Ss searching the repositories, -Si, and asking -F which package owns a file. Root is needed when pacman writes, and that includes -Fy: installing, removing, refreshing either set of databases and cleaning the cache.

How to check this page

Two commands on your own machine: pacman -<operation> --help lists the modifiers that operation accepts, and man pacman opens the pacman(8) manual page these descriptions are written from. Where the descriptions come from, and what this site is not, is set out on the about page.

This page was last edited on .