首頁·終端機命令

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