Pacman Package Manager on Arch Linux: Getting Started

Pacman Package Manager on Arch Linux: Getting Started

If Firefox’s package name is not obvious, pacman -Ss searches repository names and descriptions. I like that the operation flag makes the query’s scope visible.

The next useful clue is the package data behind pacman’s query. You can use that context to understand the candidate before choosing an install action.

Pacman separates repository packages from installed packages

Pacman is Arch Linux’s package manager, and its operation flag tells it which package data a command reads or changes.

I kept repository searches separate from installed-package checks because they read different databases, as the pacman manual and ArchWiki pacman page explain.

OperationData or actionTypical task
-SConfigured repository databasesSearch or install repository packages
-QInstalled-package databaseSearch or inspect installed packages
-RInstalled packagesRemove a package
-ULocal package archiveInstall a pacman archive already on disk

Uppercase letters select operations, while lowercase options add behavior, so -Ss searches repository data and -Qs searches installed packages with the same term.

Check the package source before changing your system

The commands here target Arch Linux’s configured repositories, and other Arch-based distributions may use different package sources.

Package changes need administrator privileges, so the examples use sudo. If Arch is not installed yet, start with our Arch installation guide, because pacman comes with the installed system.

  • Check whether a result comes from an enabled repository or from a local archive you trust.
  • Read the proposed transaction before confirming it, especially packages marked for removal or replacement.
  • Use a full system upgrade when refreshing repository databases. Arch does not support partial upgrades.

Pacman shows the planned changes before it proceeds, so the confirmation prompt is a chance to check package names and dependencies. Cancel when the transaction does not match what you meant to install or remove.

Search repositories and check installed packages

-Ss searches the locally synchronized repository databases by package name or description, while -Si displays metadata for a named repository package.

pacman -Ss firefox
pacman -Si firefox

A search result does not tell you whether Firefox is installed. Use the -Q operation for local state, where -Qs searches installed packages and -Qi displays details about one installed package.

pacman -Qs firefox
pacman -Qi firefox
pacman -Q

The bare -Q lists installed packages, while -Qs narrows that list by a search term. I chose the same example name in both command groups so the database difference stays visible.

If an app name does not match a package name, search the official Arch package database by name or description. For a package branch choice such as LibreOffice Fresh or Still, see our LibreOffice on Arch guide.

Install a package with a full system upgrade

When you install a repository package, use -Syu with its package name. Pacman refreshes repository data and upgrades installed packages in the same transaction that adds the requested target.

sudo pacman -Syu firefox

The transaction includes dependencies and shows the planned changes before you confirm. I chose this combined command as the default example because Arch documents it for installing a target while upgrading the system.

CommandWhat it doesWhen to use it
sudo pacman -Syu package_nameSynchronizes repository data and installs the target while upgrading installed packagesRepository installation with a full upgrade
sudo pacman -Sy package_nameRefreshes repository data and installs the target without upgrading all installed packagesDo not use. Arch does not support this partial-upgrade state.
sudo pacman -U ./package-name.pkg.tar.zstInstalls a local pacman package archiveWhen the archive is already on disk and its source is trusted

A sync without a full upgrade advances repository metadata while the installed package set stays behind. That can mix package versions from different points in the rolling release.

Arch calls that state a partial upgrade and does not support it. Use -Syu with the package target in one transaction, as described in the Arch system-maintenance guidance.

Our package hold guide covers the separate case where a package needs to stay out of upgrades.

Pacman -U accepts a local pacman archive such as .pkg.tar.zst, while Debian or RPM packages use their distribution’s tools. Source files need a build workflow.

Remove a package and review unused dependencies

The -R operation removes a named installed package. Add -s when you also want pacman to remove dependencies that no other installed package requires and that you did not install explicitly.

sudo pacman -R package_name
sudo pacman -Rs package_name
pacman -Qdt

The first command leaves dependencies installed. The second can remove now-unused dependencies, while -Qdt lists packages installed as dependencies that are no longer required by another package.

  • Check the removal transaction for packages you still need.
  • Review each -Qdt result before removing it. The package database cannot know whether you use it for a separate task.
  • Add -n only when you deliberately want pacman to discard backup copies of changed configuration files instead of saving them as .pacsave files.

I chose to omit -n from the default removal example because it changes how pacman handles modified configuration files. The manual’s remove options describe that behavior before you add it to a command.

Pacman does not install AUR build files directly

The Arch User Repository contains community-maintained PKGBUILD files that describe how to build packages. Those build instructions sit outside official repositories, so pacman cannot search for or install AUR entries with -S.

The standard AUR path starts with inspecting the PKGBUILD and related files. Build it as a regular user with makepkg, then install the resulting package with pacman.

Arch warns that AUR build files are user-produced and not thoroughly vetted, so review them before running the build.

SourceWhat pacman can doWhat to check
Configured Arch repositorySearch with -Ss and install with -SyuRepository name and proposed transaction
AURInstall the package after a build creates a pacman archiveReview PKGBUILD contents and build instructions
Local package archiveInstall with -UTrust the archive’s source and match it to your system

For an AUR helper, continue with our Paru guide.

Ubuntu .deb packages use APT and dpkg, while pacman -U expects a pacman archive. Our guide to installing DEB files on Ubuntu covers that format.

Confirm the package after installation

After the transaction completes, query the local package database for the exact package name. Pacman prints the installed name and version when it finds that record, rather than searching the repository again.

pacman -Q firefox

Pacman questions

Can I use pacman on Windows?

MSYS2 maintains its own pacman fork for Windows and Cygwin-specific behavior. MSYS2 pacman docs describe that fork, while the commands here target Arch Linux.