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
How a line is taken apart
Before the letters are named, the line is read like this:
- A leading
sudoordoasis 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:-Ekeeps the environment,-Hsets HOME. A bare--is neither: it is the marker that endssudo's own options, so what follows it is the command. The wordpacmanitself 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:
-Syuand-S -y -uare read the same way. - Repeated letters are counted, because repeating one changes what it does.
-Syyis not-Sy, and-Sccis not-Sc. - Long forms fold into their letters, so
--sync --refresh --sysupgradecomes back as-Syu.
How the danger level is decided
Three levels, worked out from the letters in the command rather than from the operation in front of them:
| Level | Means | Examples |
|---|---|---|
| routine | Only what the words say — where the read-only commands sit | pacman -Q, pacman -Ss firefox, sudo pacman -Syu |
| caution | The 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 on | sudo pacman -Sc, sudo pacman -Rs pkg, sudo pacman -Syu --ignore linux |
| risky | It 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 unseen | sudo 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 line | Why it is refused |
|---|---|
sudo -u root pacman -Syu — accepted | Not 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 -Syu | An option of sudo this page does not know. It is refused instead of being folded into the pacman letters behind it. |
pacman -Syu--noconfirm | A 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 –Syu | The 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 -l | A 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.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
c | --clean | remove 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 | --nodeps | skip the dependency version checksWritten twice: skip the dependency checks completely |
g | --groups | list the members of a package group |
h | --help | print the help text for this operation instead of running it |
i | --info | print the information a repository holds about a packageWritten twice: print the extended information as well |
l | --list | list every package a repository contains |
p | --print | print the targets instead of carrying the operation out |
q | --quiet | show less output; with -Ss it prints package names only |
r | --root | operate on the installation rooted at the next argument |
s | --search | search the repositories for packages matching the patterns |
u | --sysupgrade | upgrade every installed package that is out of dateWritten twice: also downgrade packages that are newer than the version in the repository |
v | --verbose | print more output |
w | --downloadonly | download the packages into the cache without installing them |
y | --refresh | refresh the package databases from the mirrorsWritten twice: refresh the package databases even when they already look up to date |
-R --remove
Remove installed packages.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
c | --cascade | also remove every package that depends on the targets |
d | --nodeps | skip the dependency version checksWritten twice: skip the dependency checks completely |
h | --help | print the help text for this operation instead of running it |
n | --nosave | remove the configuration files too instead of keeping them as .pacsave |
p | --print | print the targets instead of carrying the operation out |
r | --root | operate on the installation rooted at the next argument |
s | --recursive | also remove dependencies that nothing else needs any moreWritten twice: also remove dependencies that were installed explicitly but are no longer needed |
u | --unneeded | skip targets that other installed packages still require |
v | --verbose | print more output |
-Q --query
Ask the local database about packages that are already installed.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
c | --changelog | print the change log an installed package ships |
d | --deps | restrict the list to packages that were installed as dependencies |
e | --explicit | restrict the list to packages that were installed explicitly |
g | --groups | list the installed members of a group |
h | --help | print the help text for this operation instead of running it |
i | --info | print the information the local database holds about a packageWritten twice: also print the backup files and whether they have been modified |
k | --check | check that the files the package owns are still on disk |
l | --list | list the files an installed package owns |
m | --foreign | restrict the list to packages not found in the sync databases |
n | --native | restrict the list to packages found in the sync databases |
o | --owns | print which installed package owns the given file |
p | --file | read the metadata from a package file instead of the database |
q | --quiet | show less output; print bare package names |
r | --root | operate on the installation rooted at the next argument |
s | --search | search the installed packages for the patterns |
t | --unrequired | restrict the list to packages no installed package requires |
u | --upgrades | restrict the list to installed packages that are out of date |
v | --verbose | print more output |
-U --upgrade
Install a package from a local package file rather than from a repository.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
d | --nodeps | skip the dependency version checksWritten twice: skip the dependency checks completely |
h | --help | print the help text for this operation instead of running it |
p | --print | print the targets instead of carrying the operation out |
r | --root | operate on the installation rooted at the next argument |
v | --verbose | print more output |
-D --database
Change how a package is recorded in the local database.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
h | --help | print the help text for this operation instead of running it |
k | --check | check the local database for consistency |
q | --quiet | show less output |
r | --root | operate on the installation rooted at the next argument |
v | --verbose | print more output |
-F --files
Ask which package in the repositories owns a file, installed or not.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
h | --help | print the help text for this operation instead of running it |
l | --list | list the files a repository package owns |
q | --quiet | show less output |
r | --root | operate on the installation rooted at the next argument |
v | --verbose | print more output |
x | --regex | read the patterns as regular expressions |
y | --refresh | download 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.
| Letter | Long form | Meaning under this operation |
|---|---|---|
b | --dbpath | use the database directory given in the next argument |
h | --help | print the help text for this operation instead of running it |
r | --root | operate on the installation rooted at the next argument |
v | --verbose | print 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.