Skip to the content
pacman-master.com

pacman command explainer

The reason pacman commands are hard to read is that the lowercase letters change meaning depending on the capital one: s under -R removes orphaned dependencies, while s under -S searches.

pacman -Rns <package>
-R
--remove — remove installed packages
-n
--nosave — remove the configuration files too instead of keeping them as .pacsave
-s
--recursive — also remove dependencies that nothing else needs any more

Needs root.

What it does. Paste a command into the box above to see its letters named in the meaning they carry under that operation.

Watch out. An en dash from a word processor looks like a hyphen on screen and is not one; retype the dashes if a line comes back refused.

Read a command

Try:

Write a command

Modifiers

How a line is taken apart

The four parts of a pacman command lineThe line sudo pacman -Syu firefox, drawn as four boxes inside one frame. A line runs down from each box to the name of that part: sudo is the privilege prefix and is there only on a command that writes; pacman is the program; -Syu is the operation letter S with the modifiers y and u attached to it; firefox is the target. The four parts are listed again underneath with a note on each.sudoprivilegepacmanprogram-Syuoperation and modifiersfirefoxtargetssudoprivilege - only on a command that writespacmanprogram - the package manager itself-Syuoperation and modifiers - one capital letter, then lowercase lettersfirefoxtargets - names, paths or patterns
Reading a command in this order is usually enough to work out what it will do before running it.

Before the letters are named, the line is read like this:

  • A leading sudo or doas is taken off along with its own options, because those belong to that program and not to pacman. Some of them carry a value that has to come off with them, such as -u <user> and -g <group>. Others stand alone and carry nothing: -E keeps the environment, -H sets HOME. A bare -- is neither: it is the marker that ends sudo's own options, so what follows it is the command. The word pacman itself may be left out.
  • Exactly one operation is allowed. The operations are the capital letters -S -R -Q -U -D -F -T -V, and the lowercase -h.
  • Letters may be written joined or apart: -Syu and -S -y -u are read the same way.
  • Repeated letters are counted, because repeating one changes what it does. -Syy is not -Sy, and -Scc is not -Sc.
  • Long forms fold into their letters, so --sync --refresh --sysupgrade comes back as -Syu.

How the danger level is decided

Where each command sits on the three levelsTen pacman commands listed down the left, each with a short note on what it does. Three lanes to the right carry the three levels this reference uses. A filled mark sits in the lane that command belongs to and takes the colour of that lane.routinecautionriskysudo pacman -Syurefresh and upgrade togetherpacman -Qdtlist the orphanspacman -Ss firefoxsearch the repositoriessudo pacman -S firefoxinstall one packagesudo pacman -Sckeep the installed version, drop the restsudo pacman -Rns firefoxremove it, its unused deps, its configsudo pacman -Sccempty the cachesudo pacman -Sy firefoxrefresh, then install without upgradingsudo pacman -Rdd glibcremove without the dependency checkssudo pacman -Syuulet packages move backwards
The level is about reach: whether a command touches only what you named, or more than that.

Three levels, worked out from the letters in the command rather than from the operation in front of them:

LevelMeansExamples
routineOnly what the words say — where the read-only commands sitpacman -Q, pacman -Ss firefox, sudo pacman -Syu
cautionThe command reaches past the words you typed, or past the moment you run it: something is deleted, overwritten or held back that you did not name, or a record is changed that a later command will act onsudo pacman -Sc, sudo pacman -Rs pkg, sudo pacman -Syu --ignore linux
riskyIt can leave the system in a state you have to repair: a dependency check turned off or answered untruthfully, an upgrade done half way, a package replaced by an older one, or a removal carried out with its list of casualties unseensudo pacman -Sy, sudo pacman -Rdd pkg, sudo pacman -Syuu

Paste any of the examples above into the box to see how that line is read.

What it refuses to read, and why

Some lines come back refused instead of explained. Four of those refusals are worth knowing, because the line looks perfectly fine on screen:

The lineWhy it is refused
sudo -u root pacman -Syu — acceptedNot a refusal but the reason the list exists: the u of -u belongs to sudo. Read as a pacman letter it turns -Syu into -Syuu, a downgrade, and the answer would describe a command nobody wrote.
sudo -X pacman -SyuAn option of sudo this page does not know. It is refused instead of being folded into the pacman letters behind it.
pacman -Syu--noconfirmA long option glued onto a short group with no space. Everything after the first dash is single letters, so --noconfirm there is two dashes followed by n, o, c, o, n, f, i, r, m. The message says so and shows the line as two words.
pacman –SyuThe dash is an en dash, not the hyphen-minus an option is made of. It arrives from a word processor or a page that rewrites punctuation, looks right on screen, and makes pacman read the whole word as a package name. The message names the character and prints the line with plain hyphens.
pacman -Q | wc -lA pipe is shell syntax: the line is two instructions, and this page will not put one description or one level over both.

Modifier reference, by operation

Modifiers, operation by operation. Check any letter here against pacman -<operation> --help on your own machine.

-S --sync

Install packages from the repositories and upgrade the system.

Modifiers pacman -S accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
c--cleanremove the cached files of packages that are no longer installed, and the sync databases of repositories that are no longer configuredWritten twice: remove every package file from the cache, including the installed ones
d--nodepsskip the dependency version checksWritten twice: skip the dependency checks completely
g--groupslist the members of a package group
h--helpprint the help text for this operation instead of running it
i--infoprint the information a repository holds about a packageWritten twice: print the extended information as well
l--listlist every package a repository contains
p--printprint the targets instead of carrying the operation out
q--quietshow less output; with -Ss it prints package names only
r--rootoperate on the installation rooted at the next argument
s--searchsearch the repositories for packages matching the patterns
u--sysupgradeupgrade every installed package that is out of dateWritten twice: also downgrade packages that are newer than the version in the repository
v--verboseprint more output
w--downloadonlydownload the packages into the cache without installing them
y--refreshrefresh the package databases from the mirrorsWritten twice: refresh the package databases even when they already look up to date

-R --remove

Remove installed packages.

Modifiers pacman -R accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
c--cascadealso remove every package that depends on the targets
d--nodepsskip the dependency version checksWritten twice: skip the dependency checks completely
h--helpprint the help text for this operation instead of running it
n--nosaveremove the configuration files too instead of keeping them as .pacsave
p--printprint the targets instead of carrying the operation out
r--rootoperate on the installation rooted at the next argument
s--recursivealso remove dependencies that nothing else needs any moreWritten twice: also remove dependencies that were installed explicitly but are no longer needed
u--unneededskip targets that other installed packages still require
v--verboseprint more output

-Q --query

Ask the local database about packages that are already installed.

Modifiers pacman -Q accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
c--changelogprint the change log an installed package ships
d--depsrestrict the list to packages that were installed as dependencies
e--explicitrestrict the list to packages that were installed explicitly
g--groupslist the installed members of a group
h--helpprint the help text for this operation instead of running it
i--infoprint the information the local database holds about a packageWritten twice: also print the backup files and whether they have been modified
k--checkcheck that the files the package owns are still on disk
l--listlist the files an installed package owns
m--foreignrestrict the list to packages not found in the sync databases
n--nativerestrict the list to packages found in the sync databases
o--ownsprint which installed package owns the given file
p--fileread the metadata from a package file instead of the database
q--quietshow less output; print bare package names
r--rootoperate on the installation rooted at the next argument
s--searchsearch the installed packages for the patterns
t--unrequiredrestrict the list to packages no installed package requires
u--upgradesrestrict the list to installed packages that are out of date
v--verboseprint more output

-U --upgrade

Install a package from a local package file rather than from a repository.

Modifiers pacman -U accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
d--nodepsskip the dependency version checksWritten twice: skip the dependency checks completely
h--helpprint the help text for this operation instead of running it
p--printprint the targets instead of carrying the operation out
r--rootoperate on the installation rooted at the next argument
v--verboseprint more output

-D --database

Change how a package is recorded in the local database.

Modifiers pacman -D accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
h--helpprint the help text for this operation instead of running it
k--checkcheck the local database for consistency
q--quietshow less output
r--rootoperate on the installation rooted at the next argument
v--verboseprint more output

-F --files

Ask which package in the repositories owns a file, installed or not.

Modifiers pacman -F accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
h--helpprint the help text for this operation instead of running it
l--listlist the files a repository package owns
q--quietshow less output
r--rootoperate on the installation rooted at the next argument
v--verboseprint more output
x--regexread the patterns as regular expressions
y--refreshdownload the file databases from the mirrorsWritten twice: download the file databases even when they already look up to date

-T --deptest

Report which of the given dependencies are not satisfied.

Modifiers pacman -T accepts, and what each letter means under it
LetterLong formMeaning under this operation
b--dbpathuse the database directory given in the next argument
h--helpprint the help text for this operation instead of running it
r--rootoperate on the installation rooted at the next argument
v--verboseprint more output

-V --version

Print the pacman version.

It takes no modifiers.

-h --help

Print the help text.

It takes no modifiers.

Common questions

What do the letters in a pacman command mean?

The capital letter is the operation and there is exactly one of it: -S synchronises, -R removes, -Q queries, -U installs a local file. The lowercase letters after it are modifiers of that operation, and the same letter can mean different things under different operations.

Why does the same letter mean two different things?

Because the modifiers belong to the operation, not to pacman as a whole. Under -R the letter s is --recursive; under -S and -Q the same letter is --search. Running pacman -R --help lists only the modifiers that -R accepts.

Does this tool run my command?

No. It reads the text and describes it. Running the command is something you do yourself, in your own terminal.

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 .