OSDN Git Service

Regular updates
[twpd/master.git] / pacman.md
1 ---
2 title: Pacman
3 category: Linux
4 updated: 2018-07-07
5 intro: |
6   Pacman is the package manager for Arch linux and its derivatives.
7 ---
8
9 ## Commands
10 {: .-three-column}
11
12 ### Common commands
13
14 | Command                 | Description                       |
15 | ----------------------- | --------------------------------- |
16 | `pacman -Syu <pkg>`     | Install (and update package list) |
17 | `pacman -S <pkg>`       | Install only                      |
18 | `pacman -Rsc <pkg>`     | Uninstall                         |
19 | `pacman -Ss <keywords>` | Search                            |
20 | `pacman -Syu`           | Upgrade everything                |
21 {: .-prime}
22
23 ### Query
24
25 | Command              | Description                            |
26 | -------------------- | -------------------------------------- |
27 | `pacman -Qe`         | List explictly-installed packages      |
28 | ---                  | ---                                    |
29 | `pacman -Ql <pkg>`   | What files does this package have?     |
30 | `pacman -Qii <pkg>`  | List information on package            |
31 | ---                  | ---                                    |
32 | `pacman -Qo <file>`  | Who owns this file?                    |
33 | ---                  | ---                                    |
34 | `pacman -Qs <query>` | Search installed packages for keywords |
35
36 ### Orphans
37
38 | Command                       | Description                 |
39 | ----------------------------- | --------------------------- |
40 | `pacman -Qdt`                 | List unneeded packages      |
41 | `pacman -Rns $(pacman -Qdtq)` | Uninstall unneeded packages |
42
43 Avoid orphans by using `pacman -Rsc` to remove packages, which will remove unneeded dependencies.
44
45 ### Other
46
47 | Command            | Description                |
48 | ------------------ | -------------------------- |
49 | `pactree <pkg>`    | What does _pkg_ depend on? |
50 | `pactree -r <pkg>` | What depends on _pkg_?     |
51
52 ### References
53
54 * [Pacman tips and tricks](https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks) _(wiki.archlinux.org)_