summaryrefslogtreecommitdiff
path: root/content/articles/pacman-essentials.md
blob: 885cb1c1a3cd5ab936c514b13bdc0cbddf481263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
	"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 on an Arch Linux system.

New Arch Linux users should be able to manage the software on their system in
most cases with an open terminal and this article.

#### Full system update

Use the following command to update all the software on an Arch Linux system.
This includes the operating system aswell as applications:

```
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.

If this fails because of errors related to signing keys and GPG it can be fixed
by running this command:

```
sudo pacman -Sy archlinux-keyring && sudo pacman -Su
```

This error can be avoided by updating the system regularly.

#### Package search

One can search for existing packages with this command:

```
pacman -Ss <keyword>
```

`<keyword>` 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 <package>
```

`<package>` should be replaced by the lower case package name found with the
package search (see above) like `firefox` or `gimp`.

If this fails because the packages cannot be retrieved via the HTTP protocol
the error can be fixed by updating the whole system first as described above.

#### Package removal

The recommended command to remove one or multiple packages is:

```
sudo pacman -Rs <package>
```

While `R` selects removal `s` is the recursive option. This additionally
removes packages which were needed for the selected package to work.

The recursive option is smart enough to leave a dependency on the system if it
is needed by another explicitly installed 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