| 功能类别 | APT命令 | APT-GET/APT-CACHE命令 | 说明 |
|---|---|---|---|
| 安装包 | apt install <package> |
apt-get install <package> |
功能相同,APT输出更友好 |
| 卸载包 | apt remove <package> |
apt-get remove <package> |
功能相同 |
| 卸载包(清除配置) | apt purge <package> |
apt-get purge <package> |
功能相同 |
| 更新包列表 | apt update |
apt-get update |
功能相同 |
| 升级已安装包 | apt upgrade |
apt-get upgrade |
功能相同 |
| 完整升级系统 | apt full-upgrade |
apt-get dist-upgrade |
功能相同,命令名称更直观 |
| 搜索包 | apt search <keyword> |
apt-cache search <keyword> |
APT整合了搜索功能 |
| 查看包信息 | apt show <package> |
apt-cache show <package> |
APT输出更易读 |
| 列出已安装包 | apt list --installed |
apt list --installed |
两者相同(APT引入的新命令) |
| 清理包缓存 | apt clean |
apt-get clean |
功能相同 |
| 清理旧版本包 | apt autoremove |
apt-get autoremove |
功能相同 |
apt list、apt edit-sources等新命令$ apt update
命中:1 http://archive.ubuntu.com/ubuntu focal InRelease
获取:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
获取:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
已下载 228 kB,耗时 1秒 (212 kB/s)
正在读取软件包列表... 完成
$ apt install vim
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
将会安装以下额外的软件包:
vim-common vim-runtime
建议安装:
ctags vim-doc vim-scripts
下列【新】软件包将被安装:
vim vim-common vim-runtime
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 6,299 kB 的归档。
解压缩后会消耗 30.6 MB 的额外空间。
您希望继续执行吗? [Y/n] y
$ apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Fetched 228 kB in 1s (212 kB/s)
Reading package lists... Done
$ apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
vim-common vim-runtime
Suggested packages:
ctags vim-doc vim-scripts
The following NEW packages will be installed:
vim vim-common vim-runtime
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,299 kB of archives.
After this operation, 30.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y