Linux pacman Command: Manage Packages on Arch Linux

pacman manages packages and repositories in Arch Linux-based systems. It is important to perform installation, removal, repository synchronization, and full system upgrades in a single workflow.

What is the pacman command?

-S installs repository packages, -Q checks local installation status, and -R removes packages. -Syu synchronizes the package database and upgrades installed packages together. If you update only the database with -Sy and then install some packages, it can lead to a partial upgrade state, which should be avoided.

Basic syntax

pacman -operation[option] [package...]

The implemented features and options may vary depending on the distribution. Check your system's description with man pacman.

Examples

Searching repository packages

Check the name and description before installation.

pacman -Ss nginx

Checking installed package information

Look at the currently installed version and dependency information.

pacman -Qi bash

Full System Update

Run repository synchronization and a full package upgrade together, and review the list of changes.

sudo pacman -Syu

Local Package Query Result

pacman -Q queries installed local packages and their versions. In the following example, if bash is installed, one line will appear.

pacman -Q bash

Example output (versions vary by time):

bash 5.x.x-1

If there are no packages, the query fails and a non-zero exit status is returned. pacman -Syu combines repository synchronization with a full system upgrade. On Arch-based systems, performing partial upgrades by selectively upgrading only some packages can cause dependency issues, so follow the official operational guidelines.

Main Options and Format

Options/Format Description
-S package Install a package from the repository.
-Syu Perform database synchronization and full system upgrade together.
-Ss keyword Search for repository packages.
-Qi package Check the information of installed packages.
-R package Remove installed packages. Check the scope of additional options.

Precautions when using

In Arch, following the principle that partial upgrades are not supported, avoid flows where you run pacman -Sy alone and then install some packages. Before updating, check the distribution announcements and changelogs, and back up important data on older systems. Removal combinations like -Rns can clean up dependent packages and configuration more extensively, so always check the target list.

Frequently Asked Questions

How are pacman -Sy and -Syu different?

-Sy only synchronizes the repository database, while -Syu synchronizes and then updates all installed packages. Use -Syu for regular updates.

Official Documentation

The exact behavior of options and differences in implementation can be checked in the official pacman documentation.

More in This Category
Linux apt Command: Manage Packages on Debian and Ubuntu

Linux apt Command: Manage Packages on Debian and Ubuntu

Learn how to manage Packages on Debian and Ubuntu with the Linux apt command, including practical examples, key options, and important precautions.

Linux less Command: Browse and Search Long Text Files

Linux less Command: Browse and Search Long Text Files

Learn how to browse long files with Linux less, move forward and backward, search text, follow growing logs, preserve colors, and exit the pager.

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Learn how to make URL Requests and Inspect HTTP Responses with the Linux curl command, including practical examples, key options, and important precautions.

Linux file Command: Identify File Types and Formats

Linux file Command: Identify File Types and Formats

Learn how to use the Linux file command to identify file formats from their contents instead of filename extensions, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux groups Command: Show a User's Group Memberships

Linux groups Command: Show a User's Group Memberships

Learn how to show a User's Group Memberships with the Linux groups command, including practical examples, key options, and important precautions.

Linux machine-id: How to Check and Reset It for Cloned Systems

Linux machine-id: How to Check and Reset It for Cloned Systems

Learn what the Linux machine-id identifies, how to check it, and how to prepare cloned system images for unique IDs. Understand the difference between an empty file and first-boot initialization.

Linux mkdir Command: Create Directories and Parent Paths

Linux mkdir Command: Create Directories and Parent Paths

Learn how to create directories with Linux mkdir, build missing parent paths, set permissions, understand umask behavior, and verify results in scripts.

Linux Tutorial / PID and PPID Explained: Find and Manage Processes

Linux Tutorial / PID and PPID Explained: Find and Manage Processes

Understand what PID and PPID mean, inspect parent-child process relationships with ps and pgrep, and safely terminate a process you started yourself.

Linux man Command: Read Command Manual Pages

Linux man Command: Read Command Manual Pages

Learn how to use the Linux man command to find and read command manuals, sections, options, and related pages, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux Tutorial / File System Basics: Paths and Key Directories

Linux Tutorial / File System Basics: Paths and Key Directories

Understand the Linux directory tree, read absolute and relative paths, and learn what common directories such as /home, /etc, and /var are used for.