LinuxCommandLibrary

pacman

Manage software packages (install, update, remove)

TLDR

[S]ynchronize and update all packages

$ sudo pacman -Syu
copy

Install a new package
$ sudo pacman -S [package]
copy

[R]emove a package and its dependencies
$ sudo pacman -Rs [package]
copy

Search ([s]) the package database for a regular expression or keyword
$ pacman -Ss "[search_pattern]"
copy

Search the database for packages containing a specific [F]ile
$ pacman -F "[file_name]"
copy

List only the [e]xplicitly installed packages and versions
$ pacman -Qe
copy

List orphan packages (installed as [d]ependencies but not actually required by any package)
$ pacman -Qtdq
copy

Empty the entire pacman cache
$ sudo pacman -Scc
copy

SYNOPSIS

pacman <operation> [options] [package(s)]

PARAMETERS

-h, --help
    Display help message and exit.

-V, --version
    Display version information and exit.

-d, --debug
    Enable debug messages.

-q, --quiet
    Suppress all output except error messages.

-v, --verbose
    Be verbose.

-y, --sync
    Download a fresh copy of the master package database from the server(s) defined in pacman.conf.

-u, --upgrade
    Upgrades packages from sync if they are older than the versions in the sync database.

-w, --downloadonly
    Download packages but do not install/upgrade them.

-s, --search <package(s)>
    Search for packages by name and description.

-Q, --query
    Query the package database.

-R, --remove <package(s)>
    Remove/uninstall a package.

-U, --upgrade <file(s)>
    Upgrade a package from a local file.

-S, --sync <package(s)>
    Install or upgrade packages from sync database.

-T, --check <file(s)>
    Check if the given files are installed.

-b, --dbpath
    Specify an alternative database location

DESCRIPTION

Pacman is the package manager for Arch Linux.

It manages software packages in much the same way as apt or yum based systems, allowing you to install, update, and remove software. Pacman uses simple compressed files as packages and maintains a text-based package database. It aims to keep the system up to date by tracking dependencies, ensuring consistency, and handling conflict resolution.

It downloads packages from configured repositories (servers), installs them, and keeps track of what's installed on the system. Users can also install packages from local files. Pacman primarily uses the command line interface but graphical frontends are also available. It is a crucial utility to keep your arch linux system up to date and secure.

Regularly updating your system with Pacman is vital for ensuring optimal performance and security. It enables system maintenance and dependency resolution to keep all dependencies up to date.

CAVEATS

Using Pacman requires root privileges for most operations, especially installing, removing, or upgrading packages.

CONFIGURATION

Pacman's behavior is configured through /etc/pacman.conf. This file controls the repositories that are used, the package caching settings, and various other aspects of package management.

PACKAGE CACHE

Pacman caches downloaded packages in /var/cache/pacman/pkg/ by default. This allows for easy reinstallation or downgrading of packages.

The cache can be cleaned using the pacman -Scc command, which removes all cached packages, or pacman -Sc, which only removes uninstalled packages.

HISTORY

Pacman was specifically created as a package manager for Arch Linux, first released in 2002. It replaced a simpler system. It was designed with simplicity and speed as core goals.

It has been improved over the years, with new features like dependency checking and parallel downloads. It continues to be the primary method for managing software on Arch Linux and related distributions. Development is active, ensuring the package manager remains efficient and effective.

SEE ALSO

makepkg(1), pacman.conf(5)

Copied to clipboard