Arch Linux is a powerful and flexible Linux distribution, loved by many for its simplicity and control. However, new users often find package management in Arch a bit challenging.

In this guide, we’ll focus solely on pacman, Arch’s default package manager, and AUR (Arch User Repository) helpers, tools that make managing AUR packages easier.

Let’s dive into these essential tools and learn how to make the most of them.

What is Pacman?

Pacman is the default package manager for Arch Linux, which is designed to handle package installation, updates, and removal while resolving dependencies automatically. Pacman uses .pkg.tar.zst packages and works seamlessly with the Arch package repositories.

Key Pacman Commands

Pacman is the backbone of package management in Arch Linux and here are its most essential commands, explained simply:

1. Update Your System

The following command updates your system by synchronizing your local package database with the online repositories and installing the latest versions of all installed packages.

sudo pacman -Syu  

2. Install a Package

To install a package, use the following command to download and install a specific package from the Arch repository. Replace package_name with the name of the software you want.

sudo pacman -S package_name  

3. Remove a Package

To remove a package, use the following command to remove an installed package but keep the dependencies (files or libraries) it shares with other packages.

sudo pacman -R package_name  

4. Remove a Package with Unused Dependencies

The following command uninstalls a package along with any orphaned dependencies—files or libraries no longer used by any installed package.

sudo pacman -Rns package_name  

5. Search for a Package

To search for a package, use the following command to search the repository for a package using a keyword, which will list packages whose names or descriptions match the keyword.

pacman -Ss keyword  

6. List Installed Packages

To list all the packages installed on your system, making it easy to keep track of what’s already installed.

pacman -Q  

7. Check for Package Details

The following command gives detailed information about an installed package, including version, size, and dependencies.

pacman -Qi package_name  

8. Clear Package Cache

The following command removes outdated package files to free up space while keeping the latest versions for easy reinstallation.

sudo pacman -Sc  

What is the AUR?

The Arch User Repository (AUR) is a community-driven repository containing user-created package descriptions (PKGBUILDs). These packages are not officially supported but are widely used to access software not available in the official Arch repositories.

Managing AUR packages manually can be tedious, which is where AUR helpers come in handy.

1. Yay (Yet Another Yaourt)

Yay is one of the most popular AUR helpers, combining features of both pacman and AUR package management.

To install Yay, use:

sudo pacman -S --needed base-devel git  
git clone https://aur.archlinux.org/yay.git  
cd yay  
makepkg -si  

Update everything (including AUR packages):

yay -Syu  

Search for packages.

yay -Ss package_name  

Install an AUR package.

yay -S aur_package_name  

Remove an AUR package.

yay -R aur_package_name  

2. Paru

Paru is another excellent AUR helper known for its speed and simplicity, to install it use:

git clone https://aur.archlinux.org/paru.git  
cd paru  
makepkg -si  

Similar to Yay, use commands like.

paru -Syu  

Install an AUR package.

paru -S aur_package_name  

AUR helpers streamline the process of searching, installing, and updating AUR packages, saving you from manually building and installing them. While pacman is the go-to tool for official repositories, AUR helpers are indispensable for accessing community-driven packages.

Conclusion

Pacman and AUR helpers are essential tools for Arch Linux users. With pacman, you manage packages from official repositories efficiently, and with AUR helpers like Yay and Paru, you unlock the power of the AUR.

Similar Posts