Toggle menu
Toggle preferences 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
m (add image to pacman)
(Created content on safe usage, added command line flags and their use cases)
Line 16: Line 16:
Minor flags may be appended to the main flags, slightly changing their behavior. For example, <code>-Su</code> upgrades a package and <code>-Ss</code> searches for them, both via the online repositories.  
Minor flags may be appended to the main flags, slightly changing their behavior. For example, <code>-Su</code> upgrades a package and <code>-Ss</code> searches for them, both via the online repositories.  


== Common Usages ==
== Usage ==
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. <code>pacman -S package1 package2</code>  
The following are several 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. <code>pacman -S package1 package2</code>  
{| class="wikitable"
{| class="wikitable"
|+Common Pacman Commands
|+Common Pacman Commands
Line 31: Line 31:
|<code>pacman -Si package-name</code><code>pacman -Qi package-name</code>
|<code>pacman -Si package-name</code><code>pacman -Qi package-name</code>
|Get info about a package from the online repositories or local package database
|Get info about a package from the online repositories or local package database
|-
|<code>pacman -Sy package-name</code>
|Install the latest version of a package without upgrading the entire system '''(not recommended, causes a [https://wiki.archlinux.org/title/system_maintenance#Partial_upgrades_are_unsupported partial upgrade])'''
|-
|-
|<code>pacman -Syu</code>
|<code>pacman -Syu</code>
|Update system's packages
|Update system's packages; Listed packages will also be installed alongside the update
|-
|-
|<code>pacman -Syyu</code>
|<code>pacman -Syyu</code>
|Update system's packages, forcing a listing update
|Update system's packages, forcing a listing update '''(not recommended)'''
|-
|-
|<code>pacman -R package-name</code>
|<code>pacman -R package-name</code>
Line 42: Line 45:
|-
|-
|<code>pacman -Rs package-name</code>
|<code>pacman -Rs package-name</code>
|Remove package and its unneeded dependencies
|Remove a package and its unneeded dependencies
|-
|<code>pacman -Rns package-name</code>
|Remove a package, it's dependencies, and any global configuration files
|-
|-
|<code>pacman -Rsc package-name</code>
|<code>pacman -Rsc package-name</code>
|Remove a package and all of its dependencies, even if need by other packages
|Remove a package and all of its dependencies, even if need by other packages '''(not recommended)'''
|-
|-
|<code>pacman -Qdt</code>
|<code>pacman -Qdt</code>
|List packages installed as dependencies that are no longer needed- colloq. orphans
|List packages installed as dependencies that are no longer needed as dependencies (orphans)
|}
|}


== Safe Package Removal ==
== Removing Packages ==
The recommended ways to remove packages are <code>pacman -R package-name</code>, <code>pacman -Rs package-name</code>, and <code>pacman -Rns package-name</code>. The functionality of each of these commands is described within the table under [[#Common Usages]].
 
When removing packages, <code>-Rsc</code> should be used sparingly. If you wish to remove unneeded dependencies to save space (or for other reasons), use <code>-Rs</code>, or simply remove with <code>-R</code> and find the orphaned packages using <code>-Qdt</code>. If the <code>q</code> flag is added, the output will be "quiet" and can be chained with another <code>-R</code> command, i.e. <code>pacman -R $(pacman -Qdtq)</code>
When removing packages, <code>-Rsc</code> should be used sparingly. If you wish to remove unneeded dependencies to save space (or for other reasons), use <code>-Rs</code>, or simply remove with <code>-R</code> and find the orphaned packages using <code>-Qdt</code>. If the <code>q</code> flag is added, the output will be "quiet" and can be chained with another <code>-R</code> command, i.e. <code>pacman -R $(pacman -Qdtq)</code>


=== TL;DR ===
== Dangerous Commands<ref>https://wiki.archlinux.org/title/system_maintenance#Avoid_certain_pacman_commands</ref> ==
Use <code>-R</code> to remove a package, <code>-Rs</code> to remove a package and its dependencies, and <code>pacman -R $(pacman -Qdtq)</code> to remove all orphans.
TODO: Include information about the following arguments: -Sy, -Syyu, -Rsc
 
== See Also ==
[https://wiki.archlinux.org/title/pacman pacman - ArchWiki]
 
[https://pacman.archlinux.page/ Pacman Home Page]
[[Category:Package Managers]]
[[Category:Package Managers]]

Revision as of 04:57, 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.

Usage

The following are several 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 -Sy package-name Install the latest version of a package without upgrading the entire system (not recommended, causes a partial upgrade)
pacman -Syu Update system's packages; Listed packages will also be installed alongside the update
pacman -Syyu Update system's packages, forcing a listing update (not recommended)
pacman -R package-name Remove a given package
pacman -Rs package-name Remove a package and its unneeded dependencies
pacman -Rns package-name Remove a package, it's dependencies, and any global configuration files
pacman -Rsc package-name Remove a package and all of its dependencies, even if need by other packages (not recommended)
pacman -Qdt List packages installed as dependencies that are no longer needed as dependencies (orphans)

Removing Packages

The recommended ways to remove packages are pacman -R package-name, pacman -Rs package-name, and pacman -Rns package-name. The functionality of each of these commands is described within the table under #Common Usages.

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)

Dangerous Commands[1]

TODO: Include information about the following arguments: -Sy, -Syyu, -Rsc

See Also

pacman - ArchWiki

Pacman Home Page