Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Pacman: Difference between revisions

From atl.wiki
(remove dangerous partial upgrade command)
m (add image to pacman)
Line 7: Line 7:
| website = [https://pacman.archlinux.page pacman.archlinux.page]
| website = [https://pacman.archlinux.page pacman.archlinux.page]
}}
}}
[[File:Pacman 401.png|thumb|[[Pacman]]]]
== Intro ==
== Intro ==
The Linux distribution Arch Linux and its derivatives usually use a [[package manager]] called Pacman, invokable as <code>pacman</code>. More information can be found on the relevant Arch Wiki page, located [https://wiki.archlinux.org/title/pacman here]. Pacman is a binary distribution package manager, and only has builds for x86_64, though some have tried creating alternative ports. The most common usages of Pacman are to install, search, update, and query packages.  
The Linux distribution Arch Linux and its derivatives usually use a [[package manager]] called Pacman, invokable as <code>pacman</code>. More information can be found on the relevant Arch Wiki page, located [https://wiki.archlinux.org/title/pacman here]. Pacman is a binary distribution package manager, and only has builds for x86_64, though some have tried creating alternative ports. The most common usages of Pacman are to install, search, update, and query packages.  

Revision as of 00:44, 5 June 2024

Pacman
Release Status Maintained
Last Release 6.1.0, 2024-03-04
Language(s) C
Developer(s) Arch Linux
Website pacman.archlinux.page
Pacman

Intro

The Linux distribution Arch Linux and its derivatives usually use a package manager called Pacman, invokable as pacman. More information can be found on the relevant Arch Wiki page, located here. Pacman is a binary distribution package manager, and only has builds for x86_64, though some have tried creating alternative ports. The most common usages of Pacman are to install, search, update, and query packages.

Flags

Pacman uses a flag scheme involving one main flag (uppercase) and many minor flags (lowercase). The most commonly used main flags are -S for "sync", -R for removal, and -Q for querying. Sync and query are similar, but sync looks for (and installs) packages from the Arch Linux repositories, while query only finds currently installed packages.

Minor flags may be appended to the main flags, slightly changing their behavior. For example, -Su upgrades a package and -Ss searches for them, both via the online repositories.

Common Usages

Here are some common usages of Pacman. In all cases where applicable, the given operation can also be performed on multiple packages at once by simply writing them all out separated by a space, i.e. pacman -S package1 package2

Common Pacman Commands
Command Description
pacman -S package-name (Re)install a given package
pacman -Ss search-termpacman -Qs search-term Search the online repositories or local package database for a given package
pacman -Si package-namepacman -Qi package-name Get info about a package from the online repositories or local package database
pacman -Syu Update system's packages
pacman -Syyu Update system's packages, forcing a listing update
pacman -R package-name Remove a given package
pacman -Rs package-name Remove package and its unneeded dependencies
pacman -Rsc package-name Remove a package and all of its dependencies, even if need by other packages
pacman -Qdt List packages installed as dependencies that are no longer needed- colloq. orphans

Safe Package Removal

When removing packages, -Rsc should be used sparingly. If you wish to remove unneeded dependencies to save space (or for other reasons), use -Rs, or simply remove with -R and find the orphaned packages using -Qdt. If the q flag is added, the output will be "quiet" and can be chained with another -R command, i.e. pacman -R $(pacman -Qdtq)

TL;DR

Use -R to remove a package, -Rs to remove a package and its dependencies, and pacman -R $(pacman -Qdtq) to remove all orphans.