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.









