pacman commands, by operation
pacman is driven by one capital operation letter and a string of lowercase modifiers: -S synchronises from the repositories, -R removes, -Q queries the local database, -U installs a package file from disk. The cheat sheet below lists the pacman commands built from those letters, what each one does, and whether it needs root.
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. The one command to remember: refresh the databases and upgrade everything in a single transaction.
Watch out. A doubled letter is a different command: -Sc and -Scc delete different things, and so do -Sy and -Syy.
The table
The danger column says how far a command reaches past the words you typed, in the three levels the explainer uses: routine, caution and risky. Paste a command from the table into the explainer to see how its letters are read.
Some blocks elsewhere show a line the explainer will not read: a different
program such as makepkg or rm, a pipe, or a shell
substitution. A block like that is marked not pacman and carries no level,
because a level describes pacman's own options.
Type in the filter box to narrow the table; it matches the command text and the
description at the same time. Try orphan, cache or -Q.
| Command | What it does | Operation | Root? | Danger |
|---|---|---|---|---|
sudo pacman -Syu | Refresh the databases and upgrade every installed package | -S | yes | routine |
sudo pacman -Syyu | Same, but download the databases again even if they look current | -S | yes | routine |
sudo pacman -Syuu | Same, and allow packages to be replaced by older repository versions | -S | yes | risky |
sudo pacman -Sy | Refresh the databases only, without upgrading anything | -S | yes | risky |
sudo pacman -S <package> | Install a package from the repositories | -S | yes | routine |
sudo pacman -Syu <package> | Install a package as part of a full system upgrade | -S | yes | routine |
sudo pacman -S --needed <package> | Install, skipping it if the same version is already installed | -S | yes | routine |
sudo pacman -S --asdeps <package> | Install but record it as a dependency rather than an explicit install | -S | yes | caution |
sudo pacman -S <group> | Install a group, choosing members from the list it offers | -S | yes | routine |
sudo pacman -Sw <package> | Download into the cache without installing | -S | yes | routine |
sudo pacman -U <file> | Install a package from a local package file | -U | yes | routine |
pacman -Ss <pattern> | Search the repositories by name and description | -S | no | routine |
pacman -Ssq <pattern> | Same search, printing bare package names | -S | no | routine |
pacman -Si <package> | Show what a repository knows about a package | -S | no | routine |
pacman -Sl <repository> | List every package a repository contains | -S | no | routine |
pacman -Sg <group> | List the members of a group | -S | no | routine |
sudo pacman -Sc | Delete the cached files of packages that are no longer installed, and the sync databases of repositories that are no longer configured | -S | yes | caution |
sudo pacman -Scc | Delete every file in the package cache | -S | yes | caution |
sudo pacman -R <package> | Remove only the named package | -R | yes | routine |
sudo pacman -Rs <package> | Remove it and the dependencies nothing else needs | -R | yes | caution |
sudo pacman -Rns <package> | Remove it, its unneeded dependencies and its configuration files | -R | yes | caution |
sudo pacman -Rss <package> | Remove it and its unneeded dependencies, reaching packages that were installed explicitly as well | -R | yes | caution |
sudo pacman -Rc <package> | Remove it and everything that depends on it | -R | yes | caution |
sudo pacman -Rdd <package> | Remove it with every dependency check skipped | -R | yes | risky |
pacman -Rp <package> | Print what a removal would do without doing it | -R | no | routine |
pacman -Q | List every installed package with its version | -Q | no | routine |
pacman -Qq | List installed package names only | -Q | no | routine |
pacman -Qe | List packages installed explicitly | -Q | no | routine |
pacman -Qd | List packages installed as dependencies | -Q | no | routine |
pacman -Qdt | List orphans: dependencies nothing requires | -Q | no | routine |
pacman -Qdtq | List orphan names only, ready to pass on | -Q | no | routine |
pacman -Qm | List packages not found in the sync databases | -Q | no | routine |
pacman -Qn | List packages that come from the repositories | -Q | no | routine |
pacman -Qu | List installed packages that are out of date | -Q | no | routine |
pacman -Qi <package> | Show everything the local database records about a package | -Q | no | routine |
pacman -Qii <package> | Same, plus the backup files and whether they were modified | -Q | no | routine |
pacman -Ql <package> | List every file a package owns | -Q | no | routine |
pacman -Qo <path> | Show which installed package owns a file | -Q | no | routine |
pacman -Qs <pattern> | Search the installed packages | -Q | no | routine |
pacman -Qk | Check that the files packages own are still on disk | -Q | no | routine |
pacman -Qc <package> | Print a package's change log | -Q | no | routine |
pacman -Qg <group> | List the installed members of a group | -Q | no | routine |
pacman -Qp <file> | Read the metadata out of a package file instead of the database | -Q | no | routine |
sudo pacman -Fy | Download the file databases | -F | yes | routine |
pacman -F <filename> | Find which repository package would provide a file | -F | no | routine |
pacman -Fl <package> | List the files a repository package owns, without installing it | -F | no | routine |
pacman -Dk | Check the local database for consistency | -D | no | routine |
sudo pacman -D --asexplicit <package> | Re-record an installed package as explicitly installed | -D | yes | routine |
pacman -T <dependency> | Report which of the given dependencies are not satisfied | -T | no | routine |
pacman -V | Print the pacman version | -V | no | routine |
pacman -S --help | List the modifiers one operation accepts | -S | no | routine |
Reading an unfamiliar one
If a command is not in the table, it is still made of the same parts. Strip the
sudo, take the capital letter to find the operation, then look up the
lowercase letters in that operation's own list with
pacman -<operation> --help, or paste the line into the
explainer.
If what you have is not a command but the line pacman printed when it stopped, that belongs on the error message page instead.