{ "title": "Pacman essentials", "subtitle": "Arch Linux package manager explained for everyday users" } #### Introduction The program `pacman` is the package manager of the [Arch Linux][1] distribution. It should be exclusively used to install, update and remove software to an Arch Linux system. As a terminal program it has no graphical user interface (GUI). This might be uncommon for new users but has advantages like being simple, scriptable and easily to document like on this page. With an open terminal and this guide you should be able to manage the software on your Arch Linux instance in most cases. #### Getting necessary permissions A regular Linux user is allowed to use pacman to get information. This includes for example the package search with `pacman -Ss `. Only the user `root` is allowed to use pacman to update, install or remove software packages. Other users are able to get temporary root permissions by using a program like `sudo`. Thus a pacman call like `pacman -Syu` should be rewritten to `sudo pacman -Syu` to run it with root permissions. It should be mentioned that using `sudo` is not required if logged in as user `root` or could be substituted by another program like `doas`. #### Full system update Every Arch Linux installation should be regularly updated. For this purpose the following command is used: ``` sudo pacman -Syu ``` It runs interactively which means that questions should be answered by the user with pressing `y` or `n` followed by the `Enter` key. The default option (the bigger letter in `[Y/n]` or `[y/N]`) is a good option in most cases. Updating a system every week is a good rule of thumb. It is especially convenient to update the system before poweroff because most of it can run without interaction. The poweroff can also be automatically triggered after a successful update with `sudo pacman -Syu && poweroff`. #### Package search One can search for existing packages with this command: ``` pacman -Ss ``` `` should be replaced by keywords like `firefox`. Furthermore the package search on the [Arch Linux homepage][1] in the upper right corner can be used. The Arch Linux wiki contains also a long [list of applications][2] which is an excellent place to search for needed programs by category. #### Package installation Installing a package is simple: ``` sudo pacman -S ``` `` should be replaced by the lower case package name found with the package search (see above) like `firefox` or `gimp`. It is also possible to install multiple packages with a space-separated list of packages like `sudo pacman -S firefox gimp` or together with a full system update `sudo pacman -Syu firefox`. #### Package removal The recommended command to remove one or multiple packages is: ``` sudo pacman -Rs ``` The options `-Rs` select removal with `R` and recursive with `s`. The latter option removes dependencies of this package too. Dependencies are packages which are needed for the selected package to work. They get installed automatically. The `s` option will leave a dependency on the system if installed explicitly by the user or needed by another package. #### Further documentation This page is just a little cheat sheet especially targeted at new Arch Linux users. The following references point to the official documentation about pacman: - The manual page of pacman: `man pacman` (exit with `q`) - Arch Wiki: [pacman][3] - Arch Wiki: [pacman/Tips and tricks][4] They should be consulted to get further information and should be trusted more than this page if in conflict with its content. [1]: https://archlinux.org/ [2]: https://wiki.archlinux.org/title/List_of_applications [3]: https://wiki.archlinux.org/title/Pacman [4]: https://wiki.archlinux.org/title/Pacman/Tips_and_tricks