Pacman is the package manager used by Arch Linux and its derivatives, such as Manjaro. It is designed to be simple, lightweight, and fast, making it a key component of the Arch Linux philosophy. Pacman manages packages in the .pkg.tar.zst
format and provides seamless access to both official repositories and user-contributed packages.
Pacman is a command-line tool that synchronizes packages with the Arch repositories. It is capable of installing, updating, and removing software while automatically resolving dependencies. Pacman’s speed and efficiency are among its most notable features, making it an essential tool for Arch Linux users.
- Simplicity: Pacman aims to keep everything as simple as possible, aligning with Arch Linux's KISS (Keep It Simple, Stupid) principle.
- Dependency Management: Automatically handles dependencies, ensuring that all required packages are installed.
- Binary Packages: Pacman deals with precompiled binary packages, allowing for quick installation and updates.
To install a package:
sudo pacman -S package-name
Example:
sudo pacman -S firefox
To update the package database and upgrade all installed packages:
sudo pacman -Syu
-S
: Syncs the package database.-y
: Refreshes the package list from the repositories.-u
: Upgrades all out-of-date packages.
To remove a package:
sudo pacman -R package-name
Example:
sudo pacman -R vlc
If you want to remove a package along with its dependencies that are no longer required:
sudo pacman -Rns package-name
-n
: Removes configuration files.-s
: Removes dependencies that are no longer needed.
To search for a package in the repositories:
pacman -Ss package-name
Example:
pacman -Ss nginx
To search for installed packages:
pacman -Qs package-name
To view detailed information about a package:
pacman -Si package-name
Example:
pacman -Si gimp
To view information about an installed package:
pacman -Qi package-name
To clean the package cache by removing old versions of installed packages:
sudo pacman -Sc
To remove all cached packages that are not currently installed:
sudo pacman -Scc
To list all installed packages:
pacman -Qe
To list all explicitly installed packages:
pacman -Q
Orphaned packages are those that were installed as dependencies but are no longer required by any installed package. To list and remove orphaned packages:
sudo pacman -Qdtq | sudo pacman -Rns -
Arch does not support downgrading packages directly via Pacman, but you can manually download the desired version from the Arch Linux Archive or use a tool like downgrade
.
To downgrade a package using the downgrade
tool:
sudo downgrade package-name
Pacman does not directly support the Arch User Repository (AUR), but you can use AUR helpers like yay
or paru
to install AUR packages.
Example with yay
:
yay -S package-name
Pacman allows you to install groups of related packages with a single command.
To install a package group:
sudo pacman -S group-name
Example:
sudo pacman -S base-devel
To list available package groups:
pacman -Sg
If you encounter issues with packages that are partially installed or broken, you can force Pacman to reinstall them:
sudo pacman -S package-name --needed --noconfirm
- Regularly Update Your System: Since Arch Linux follows a rolling release model, it's important to update your system frequently to ensure you have the latest packages and security patches.
- Use the
--needed
Option: When installing packages, use the--needed
option to skip reinstalling packages that are already up to date. - Be Careful with AUR Packages: While the AUR is a powerful resource, it contains user-contributed packages that may not be as thoroughly tested as those in the official repositories. Review AUR package build scripts before installing them.
- Backup Pacman Configuration: Before making significant changes, backup your Pacman configuration files (e.g.,
/etc/pacman.conf
).
Pacman is a robust and efficient package manager that is central to the Arch Linux experience. By mastering Pacman’s commands and features, you can effectively manage your system’s software, ensuring it remains lightweight, fast, and up to date.
Next: Vim Editor Basics
Previous: YUM/DNF (RHEL/CentOS)