Sync and upgrade
sudo pacman -Syu
Refresh databases and upgrade all
sudo pacman -S <pkg>
Install a package with deps
sudo pacman -S <pkg1> <pkg2>
Install several at once
sudo pacman -Sy
Refresh the sync databases only
Do not install afterwards without a full upgrade; it risks a
partial upgrade.
sudo pacman -Syyu
Force-refresh, then upgrade
sudo pacman -S --needed <pkg>
Skip packages already current
sudo pacman -S <repo>/<pkg>
Install from a specific repo
sudo pacman -Sw <pkg>
Download only, do not install
sudo pacman -Syu --ignore <pkg>
Upgrade but skip a package
sudo pacman -S --asdeps <pkg>
Install and mark as dependency
sudo pacman -Syu --noconfirm
Upgrade without prompts
sudo pacman -Syuu
Upgrade and allow downgrades
sudo pacman -S --overwrite <glob> <pkg>
Overwrite conflicting files
Only for known file conflicts; the glob limits what may be
replaced.
Search and inspect
pacman -Ss <term>
Search repos by name and description
pacman -Si <pkg>
Show repo package details
pacman -Qi <pkg>
Show installed package details
pacman -Qs <term>
Search installed packages
pacman -Ql <pkg>
List files a package installed
pacman -Qo <file>
Which package owns a file
pacman -Q
List all installed packages
pacman -Qe
List explicitly installed packages
pacman -Qm
List foreign (AUR) packages
pacman -Qn
List packages from the repos
pacman -Qu
List out-of-date packages
Compares against the local sync databases, so run -Sy first.
pacman -Qk <pkg>
Check that a package's files exist
pacman -Qc <pkg>
Show a package's changelog
pacman -Sl <repo>
List all packages in a repo
pacman -Sg <group>
List members of a group
pacman -Qip <file>.pkg.tar.zst
Inspect a package file
pacman -Qq
Print names only, for scripts
Orphans and install reason
pacman -Qdt
List orphaned dependencies
pacman -Qdtq | sudo pacman -Rns -
Remove all orphans
Check the list first; an empty list makes pacman -Rns complain
about missing targets.
pacman -Qet
Explicit packages nothing requires
pacman -Qt
Packages nothing requires
sudo pacman -D --asexplicit <pkg>
Mark explicit, protect from cleanup
sudo pacman -D --asdeps <pkg>
Mark as dependency
pacman -Dk
Check local database consistency
Files and local packages
sudo pacman -Fy
Refresh the file databases
pacman -F <file>
Which repo package ships a file
Searches repo packages you may not have installed; needs -Fy
first.
pacman -Fl <pkg>
List files of a repo package
pacman -Fx <regex>
Search files by regex
sudo pacman -U <file>.pkg.tar.zst
Install a local package file
sudo pacman -U <url>
Install a package from a URL
sudo pacman -U /var/cache/pacman/pkg/<file>
Downgrade from the cache
pacman -T <dep>
Print unsatisfied dependencies
Cache and config
sudo pacman -Sc
Clean uninstalled packages from cache
sudo pacman -Scc
Empty the whole cache
Removes every cached package, so you lose the option to
downgrade from it.
paccache -r
Keep the last 3 versions of each
paccache comes from the pacman-contrib package.
ls /var/cache/pacman/pkg
See cached package files
pacman -v
Show config, db and cache paths
pacman-conf
Print the effective pacman.conf
pacman --print --print-format '%n %v' -S
<pkg>
Preview targets without acting
find /etc -name '*.pacnew'
Find config files to merge
pacdiff
Merge .pacnew and .pacsave files
pacdiff is part of pacman-contrib.
sudo pacman-key --init && sudo pacman-key
--populate
Set up the signing keyring
sudo pacman -S archlinux-keyring
Refresh the keyring package