首页·终端命令

pacman -S

包与运行时

用法

sudo pacman -S [--needed] <package>

从 Arch 的 sync 仓库安装软件包;因为是滚动发行,只用 -Sy 刷新列表再安装会造成部分升级、把库搞坏,所以一律用 -Syu。

常用选项

选项含义
-Syurefresh and upgrade the whole system, the supported way to update
--neededdo not reinstall packages already at that version
--noconfirmno prompts, for scripts
-Ss <pattern>search the repositories
-R <package>remove a package
-Qi <package>show what is installed and why

示例

sudo pacman -S ripgrep

installs from the sync repositories

sudo pacman -Syu

the full upgrade Arch expects you to run

sudo pacman -S --needed base-devel

installs the group, skipping what is there

问题永远是什么装到哪里:装进这个项目,还是装到整台机器上。

怎么看

  • 方括号 [ ] 表示这部分可以不写。
  • 省略号 … 表示可以写多个。
  • 选项区分大小写——有些命令里 -r 和 -R 不是一回事。

常见问题

Q. pacman -S 是做什么的?

从 Arch 的 sync 仓库安装软件包;因为是滚动发行,只用 -Sy 刷新列表再安装会造成部分升级、把库搞坏,所以一律用 -Syu。

Q. 怎么写?

sudo pacman -S [--needed] <package> —— 方括号表示可以省略的部分。

Q. 值得记的选项有几个?

这里列了 6 个,完整列表在 man pacman。这条命令属于包与运行时。

相关命令

man 手册: man pacman--S