Skip to main content

Pacman cheat sheet

Summary

Cheat sheet with basic commands for Pacman, the Arch Linux package manager.

Introduction #

Pacman, a portmanteau of “package manager”, is the package manager used by Arch Linux and its derivatives. It is a powerful tool that allows users to install, update, and manage software packages, whether they are from the official repositories or the user’s own builds.

There are the most essential pacman commands:

Updating #

Update system #

pacman -Syu

Update pacman database #

pacman -Syy

Ignore package updates #

To ignore updates for a specific package, add the package to the IgnorePkg line in /etc/pacman.conf.

Installing packages #

Installing from official repositories #

Install packmage_name package from the official repositories:

pacman -S package_name

Install local package #

Install packmage_name package from a local file:

pacman -U /path/to/package_name

Install from PKGBUILD #

Install package_name from local PKGBUILD file:

makepkg -si package_name

Removing packages #

Simple remove #

Remove packmage_name package:

pacman -R package_name

Remove package incl. dependencies #

Remove packmage_name package incl. unneeded dependencies:

pacman -Rs package_name

Remove package, incl. dependencies and configuration file #

Remove packmage_name package incl. unneeded dependencies and global configuration file:

pacman -Rns package_name

Remove unneeded packages and their dependencies #

Remove multiple unneeded packages incl. unused dependencies

pacman -Rns $(pacman -Qdtq)

Removing cached packages #

Pacman stores all downloaded packages in /var/cache/pacman/pkg/ and does not automatically delete old or uninstalled packages from the cache.

Remove cached versions of installed and uninstalled packages #

Remove all cached versions of installed and uninstalled packages, except for the most recent three (default):

paccache -r

Remove all cached versions of installed and uninstalled packages, except for the most recent one:

paccache -rk1

Remove cached versions of uninstalled packages #

Remove all cached versions of uninstalled packages only:

paccache -ruk0

Remove all the cached packages that are not currently installed including the unused sync database:

pacman -Sc

Remove all files from the cache #

Remove all files from the cache (most aggressive approach):

pacman -Scc

Search & Query #

Retrieve packmage_name package information:

pacman -Qi package_name

Rollback #

To rollback to a previous version of a package:

pacman -U /var/cache/pacman/pkg/package_name-version.pkg.tar.zst

Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

License: Pacman cheat sheet by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/publications/pacman-cheat-sheet">Pacman cheat sheet</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the DITig legal page.


“Form ever follows function.”

Louis Henry Sullivan, American architectThe Tall Office Building Artistically Considered, - IT quotes