4

apt 和 apt-get 命令的区别

 1 year ago
source link: https://xujinzh.github.io/2022/06/03/apt-and-apt-get/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Debian 作为 Ubuntu、Linux Mint 和 elementary OS 等 Linux 操作系统的母板,Debian 类使用一套名为 Advanced Packaging Tool(APT,请不要把它与 apt 命令混淆)的工具来管理软件包。

最常用的 Debian 类包管理命令都被分散在了 apt-get、apt-cache 和 apt-config 这三条命令当中。apt 命令的引入就是为了解决命令过于分散的问题,它包括了 apt-get 命令出现以来使用最广泛的功能选项,以及 apt-cache 和 apt-config 命令中很少用到的功能。在使用 apt 命令时,用户不必再由 apt-get 转到 apt-cache 或 apt-config,而且 apt 更加结构化,并为用户提供了管理软件包所需的必要选项。简单来说就是 apt = apt-get、apt-cache 和 apt-config 中最常用命令选项的集合。

apt 和 apt-get 的区别

虽然 apt 与 apt-get 有一些类似的命令选项,但它并不能完全向下兼容 apt-get 命令。也就是说,可以用 apt 替换部分 apt-get 系列命令,但不是全部。

apt apt-get 含义
apt install apt-get install 安装软件包
apt remove apt-get remove 移除软件包
apt purge apt-get purge 移除软件包及配置文件
apt update apt-get update 刷新存储库索引
apt upgrade apt-get upgrade 升级所有可升级的软件包
apt autoremove apt-get autoremove 自动删除不需要的包
apt full-upgrade apt-get dist-upgrade 在升级软件包时自动处理依赖关系
apt search apt-cache search 搜索应用程序
apt show apt-cache show 显示安装细节

apt 还有一些自己的命令:

新的apt命令 命令的功能
apt list 列出包含条件的包(已安装,可升级等)
apt edit-sources 编辑源列表

关于 apt-get

目前还没有任何 Linux 发行版官方放出 apt-get 将被停用的消息,至少它还有比 apt 更多、更细化的操作功能。对于低级操作,仍然需要 apt-get。

最后结大家提供两点使用上的建议:

  1. apt 可以看作 apt-get 和 apt-cache 命令的子集, 可以为包管理提供必要的命令选项;
  2. apt-get 虽然没被弃用,但作为普通用户,还是应该首先使用 apt.
  1. apt 和 apt-get的区别

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK