apt update
套件與執行環境
用法
sudo apt update只是把套件列表重新抓一遍,什麼都不會裝或升,要真裝還得跟一個 apt upgrade;剛建好的容器列表是空的,所以這是第一條命令。
常用選項
| 選項 | 含義 |
|---|---|
| apt upgrade | the second half: actually install the newer versions |
| apt full-upgrade | allow packages to be removed to finish the upgrade |
| apt list --upgradable | show what the refresh found |
| -q | quieter output for logs and CI |
| --allow-releaseinfo-change | accept a repository that renamed its suite |
範例
sudo apt updaterefreshes the package lists only
sudo apt update && sudo apt upgrade -yrefresh, then install the updates
apt list --upgradablelists the packages that now have a newer version
問題永遠是什麼裝到哪裡:裝進這個專案,還是裝到整台機器上。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. apt update 是做什麼的?
只是把套件列表重新抓一遍,什麼都不會裝或升,要真裝還得跟一個 apt upgrade;剛建好的容器列表是空的,所以這是第一條命令。
Q. 怎麼寫?
sudo apt update —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 5 個,完整列表在 man apt。這條命令屬於套件與執行環境。
相關命令
man 手冊: man apt-update