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