This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

Pacman Package Manager Cheatsheet

A quick reference guide for Arch Linux Pacman: installing, upgrading, removing packages, database sync, orphan cleanup, and dependency tree inspection.

· Published

Pacman is the package manager for Arch Linux and derived distributions, combining a simple binary package format with an easy-to-use build system.

Essential Operations

Command Action
sudo pacman -Syu Synchronize databases and perform full system upgrade
sudo pacman -S <pkg> Install a specific package
sudo pacman -Syu <pkg> Update repositories and install package
sudo pacman -R <pkg> Remove package (leaves dependencies intact)
sudo pacman -Rsc <pkg> Recursively remove package and its unneeded dependencies
pacman -Ss <keyword> Search remote repository for package keyword

Querying Packages (-Q)

# List all explicitly installed packages
pacman -Qe

# List all files installed by a specific package
pacman -Ql nginx

# Search for the package that owns a specific file
pacman -Qo /usr/bin/git

# Show detailed metadata and dependencies for installed package
pacman -Qi python

# Search locally installed packages for keywords
pacman -Qs ripgrep

Cleaning Orphan Dependencies

Orphans are packages that were installed as dependencies but are no longer needed by any active package:

# List orphan packages
pacman -Qdt

# Remove all orphan packages and their unused configurations
sudo pacman -Rns $(pacman -Qdtq)

# Clean cached package downloads (/var/cache/pacman/pkg/)
sudo pacman -Sc

Dependency Inspection (pactree)

# View dependency tree for a package
pactree ripgrep

# View reverse dependencies (what packages depend on this)
pactree -r openssl

References

Related topics