Introduction
Pacman is the default and official package manager for Arch Linux.
For a list of common commands skip to this section.
For those familiar with other package managers that would appreciate a translator, or for more robust documentation, see the resource links at the bottom.
Functions In-Depth
Help Yourself
As with many tools you can use the --help
flag for a simple overview of available options.
Click to expand
$ pacman --help
usage: pacman <operation> [...]
operations:
pacman {-h --help}
pacman {-V --version}
pacman {-D --database} <options> <package(s)>
pacman {-F --files} [options] [file(s)]
pacman {-Q --query} [options] [package(s)]
pacman {-R --remove} [options] <package(s)>
pacman {-S --sync} [options] [package(s)]
pacman {-T --deptest} [options] [package(s)]
pacman {-U --upgrade} [options] <file(s)>
use 'pacman {-h --help}' with an operation for available options
Similarly, but much more verbose, a man
page is available providing an entire manual for pacman.
$ man pacman
PACMAN(8) Pacman Manual PACMAN(8)
NAME
pacman - package manager utility
SYNOPSIS
pacman <operation> [options] [targets]
[...]
Root and sudo
Some, or most, pacman commands do not require root or sudo.
Click to expand
Those making changes to the root filesystem, such as installation, removal, or upgrade of packages, do require sudo.
Maintain ‘only use sudo when required’, as should already be standard linux practice.
pacman -Q
The query flag (-Q
) is the main operator for querying information about local packages.
Click to expand
To search local packages use
pacman -Qs $PACKAGE_or_DESCRIPTION
To see package information like version, size, and dependencies use
pacman -Qi $PACKAGE
To list files on the system provided by a package use
pacman -Ql $PACKAGE
To print which package owns (provides) a file use
pacman -Qo $PATH_TO_FILE
To print all foreign (do not exist in the repositories) packages use
pacman -Qm
To print all orphan (not required by any other package nor explicitly installed) packages use
pacman -Qdt
pacman -R
The remove flag (-R
) is the operator for uninstalling packages.
Click to expand
To uninstall a package use
sudo pacman -R $PACKAGE
To uninstall a package and any associated save files use
sudo pacman -Rn $PACKAGE
To uninstall a package and its dependencies not required by another package use
sudo pacman -Rs $PACKAGE
To print packages for removal instead of removing them use
pacman -Rsp $PACKAGE
To remove packages the most common way use
sudo pacman -Rns $PACKAGE
To remove all orphan packages use
sudo pacman -Rns $(pacman -Qdtq)
pacman -S
The sync flag (-S
) is the main operator for any repository target.
Click to expand
To search the repositories use
pacman -Ss $SEARCH_TERM
To print information about a package use
pacman -Si $PACKAGE
To install a package you could use*
sudo pacman -S $PACKAGE
* It is HIGHLY encouraged to always be up to date before installing new packages.
See the following sections.
To update all packages sync, refresh, and upgrade
sudo pacman -Syu
As systems should be up-to-date before installing new packages, to install a package use
sudo pacman -Syu $PACKAGE
To clean the package cache of all uninstalled packages and unused repositories use
sudo pacman -Sc
To clean the entire cache and unused repositories use
sudo pacman -Scc
pacman -U
The upgrade flag (-U
), despite its name, is mainly used to install packages from a path or URL.
Click to expand
To install either a remote or local package (by URL or path) use
sudo pacman -U $PATH_or_URL
pacman -F
The files flag (-F
) is the main operator for searching for files in the repositories.
Click to expand
To update the files database use
sudo pacman -Fy
To search the files database use
pacman -F $FILE_or_PATH
To search the files database with regex use
pacman -Fx $FILE_or_PATH
pacman -D
The database flag (-D
) is the main operator for the local database of packages.
Click to expand
To check the consistency of the local system against the database use
pacman -Dk
To mark a package previously ‘explicitly installed’ as a dependency use
sudo pacman -D --asdeps $PACKAGE
To mark a package previously installed as a dependency as ‘explicitly installed’ use
sudo pacman -D --asexplicit $PACKAGE
Configuring pacman.conf
Settings in the /etc/pacman.conf
file have various effects.
Click to expand
Help Yourself
An exhaustive manual is available
man pacman.conf
IgnorePkg and IgnoreGroup
These options instruct pacman to ignore upgrades of the listed array of packages or groups of packages respectively.
NoUpgrade
File paths listed under this option will not be modified during installation or upgrade and will always produce a .pacnew file.
NoExtract
File paths listed under this option will not be extracted from any package onto the filesystem. This can be used to selectively deny certain parts of a package from being installed.
Misc Options
UseSyslog
- Log messages through syslog into /var/log/messages or equivalent.Color
- Automatically enable colors only when pacman’s output is on a tty.NoProgressBar
- Disable progress bars. Also helps avoid escape characters.CheckSpace
- Approximate check for adequate disk space before installing packages.VerbosePkgLists
- Display target package information as table before operations.ParallelDownloads = N
- Where N is the number of concurrent download streams.DisableSandbox
- Disable default sandbox applied to the process downloading files.ILoveCandy
- This ‘easter egg’ option will apply a Wakka Wakka theme to progress bars.
Common Invocations
These are the (likely) most common pacman commands in everyday use.
Click to expand
File Database
Update and query database:
sudo pacman -Fyx $FILE_or_PATH
Information, Search
Search installed packages:
pacman -Qs $PACKAGE_or_DESCRIPTION
Query installed package information:
pacman -Qi $PACKAGE
Search the repositories:
pacman -Ss $PACKAGE_or_DESCRIPTION
Query repository package information:
pacman -Si $PACKAGE
Installation and Update
Update repository packages:
sudo pacman -Syu
Install new repository packages:
sudo pacman -Syu $PACKAGE1 $PACKAGE2
Uninstallation and Orphans
Remove packages, their save files, and unneeded dependencies:
sudo pacman -Rns $PACKAGE1 $PACKAGE2
Remove orphan packages
sudo pacman -Rns $(pacman -Qdtq)
Cleaning
Clean uninstalled packages
sudo pacman -Sc
More Information
Online Manual The definitive guide on the web.
ArchWiki Page The wiki from Arch Linux with introductions and tips.
https://wiki.archlinux.org/title/Pacman
Pacman Rosetta The translation key for other package managers including zypper
, emerge
, dnf
and apt
.
https://wiki.archlinux.org/title/Pacman/Rosetta