apt命令

2023-10-26

在基于 Debian 的 Linux 发行版中,有各种工具可以与 APT 进行交互,以方便用户安装、删除和管理的软件包。apt-get 便是其中一款广受欢迎的命令行工具,另外一款较为流行的是 Aptitude 这一命令行与 GUI 兼顾的小工具。最常用的 Linux 包管理命令都被分散在了 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 update

update (apt-get(8))
update is used to download package information from all configured sources. Other commands operate on this data to e.g. perform package upgrades or search in and display details about all packages available for installation.

update用于从所有配置源(包括/etc/apt/sources.list/etc/apt/sources.list.d)下载包信息。 其他命令对这些数据进行操作,例如执行包升级或搜索并显示所有可用于安装的包的详细信息。
apt update只是更新了apt的资源列表,没有真正的对系统执行更新。

apt upgrade

upgrade (apt-get(8))
upgrade is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list(5). New packages will be installed if required to statisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires the remove of an installed package the upgrade for this package isn’t performed.

upgrade用于通过sources.list配置的源中安装系统上当前安装的所有包的可用升级。
如果需要满足依赖关系,将安装新的包,但现有的包将永远不会被删除。
如果对一个包进行升级需要删除已安装的包,则不会执行对该包的升级。

apt remove package_name
删除已安装包(保留配置文件)。

apt purge package_name
删除已安装包(不保留配置文件)。

apt autoremove
删除为了满足依赖而安装的,但现在不再需要的软件包。

apt clean
apt clean 命令清除遗留在 /var/cache 中的已取回的包文件的本地仓库。它清除的目录是 /var/cache/apt/archives/ 和 /var/cache/apt/archives/partial/。它留在 /var/cache/apt/archives 中的唯一文件是 lock 文件和 partial 子目录。

apt autoclean
apt autoclean 类似于 apt-get clean,它会清除已检索包文件的本地仓库,但它只会删除不会再下载且几乎无用的文件。它有助于防止缓存过大。

apt命令

$ man apt
APT(8)                                                                         APT                                                                        APT(8)

NAME
       apt - command-line interface

SYNOPSIS
       apt [-h] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {list | search | show | update |
           install pkg [{=pkg_version_number | /target_release}]...  | remove pkg...  | upgrade | full-upgrade | edit-sources | {-v | --version} |
           {-h | --help}}

DESCRIPTION
       apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options
       better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).

       Much like apt itself, its manpage is intended as an end user interface and as such only mentions the most used commands and options partly to not
       duplicate information in multiple places and partly to avoid overwhelming readers with a cornucopia of options and details.

       update (apt-get(8))
           update is used to download package information from all configured sources. Other commands operate on this data to e.g. perform package upgrades or
           search in and display details about all packages available for installation.

       upgrade (apt-get(8))
           upgrade is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list(5). New
           packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires the
           remove of an installed package the upgrade for this package isn't performed.

       full-upgrade (apt-get(8))
           full-upgrade performs the function of upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole.

       install, remove, purge (apt-get(8))
           Performs the requested action on one or more packages specified via regex(7), glob(7) or exact match. The requested action can be overridden for
           specific packages by append a plus (+) to the package name to install this package or a minus (-) to remove it.

           A specific version of a package can be selected for installation by following the package name with an equals (=) and the version of the package to
           select. Alternatively the version from a specific release can be selected by following the package name with a forward slash (/) and codename
           (stretch, buster, sid ...) or suite name (stable, testing, unstable). This will also select versions from this release for dependencies of this
           package if needed to satisfy the request.

           Removing a package removes all packaged data, but leaves usually small (modified) user configuration files behind, in case the remove was an
           accident. Just issuing an installation request for the accidentally removed package will restore its function as before in that case. On the other
           hand you can get rid of these leftovers by calling purge even on already removed packages. Note that this does not affect any data or configuration
           stored in your home directory.

       autoremove (apt-get(8))
           autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed as
           dependencies changed or the package(s) needing them were removed in the meantime.

           You should check that the list does not include applications you have grown to like even though they were once installed just as a dependency of
           another package. You can mark such a package as manually installed by using apt-mark(8). Packages which you have installed explicitly via install are
           also never proposed for automatic removal.

       search (apt-cache(8))
           search can be used to search for the given regex(7) term(s) in the list of available packages and display matches. This can e.g. be useful if you are
           looking for packages having a specific feature. If you are looking for a package including a specific file try apt-file(1).

       show (apt-cache(8))
           Show information about the given package(s) including its dependencies, installation and download size, sources the package is available from, the
           description of the packages content and much more. It can e.g. be helpful to look at this information before allowing apt(8) to remove a package or
           while searching for new packages to install.

       list (work-in-progress)
           list is somewhat similar to dpkg-query --list in that it can display a list of packages satisfying certain criteria. It supports glob(7) patterns for
           matching package names as well as options to list installed (--installed), upgradeable (--upgradeable) or all available (--all-versions) versions.

       edit-sources (work-in-progress)
           edit-sources lets you edit your sources.list(5) files in your preferred texteditor while also providing basic sanity checks.

SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS
       The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward compatibility
       this is not guaranteed either if a change seems beneficial for interactive use.

       All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well.  apt(8) just changes the default value of some
       options (see apt.conf(5) and specifically the Binary scope). So you should prefer using these commands (potentially with some additional options enabled)
       in your scripts as they keep backward compatibility as much as possible.

SEE ALSO
       apt-get(8), apt-cache(8), sources.list(5), apt.conf(5), apt-config(8), The APT User's guide in /usr/share/doc/apt-doc/, apt_preferences(5), the APT
       Howto.

DIAGNOSTICS
       apt returns zero on normal operation, decimal 100 on error.

BUGS
       APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.

AUTHOR
       APT team

NOTES
        1. APT bug page
           http://bugs.debian.org/src:apt

APT 1.6.12ubuntu0.2                                                      20 October 2015                                                                  APT(8)
$

apt-get命令

$ apt-get --help
apt 1.6.12ubuntu0.2 (amd64)
Usage: apt-get [options] command
       apt-get [options] install|remove pkg1 [pkg2 ...]
       apt-get [options] source pkg1 [pkg2 ...]

apt-get is a command line interface for retrieval of packages
and information about them from authenticated sources and
for installation, upgrade and removal of packages together
with their dependencies.

Most used commands:
  update - Retrieve new lists of packages
  upgrade - Perform an upgrade
  install - Install new packages (pkg is libc6 not libc6.deb)
  remove - Remove packages
  purge - Remove packages and config files
  autoremove - Remove automatically all unused packages
  dist-upgrade - Distribution upgrade, see apt-get(8)
  dselect-upgrade - Follow dselect selections
  build-dep - Configure build-dependencies for source packages
  clean - Erase downloaded archive files
  autoclean - Erase old downloaded archive files
  check - Verify that there are no broken dependencies
  source - Download source archives
  download - Download the binary package into the current directory
  changelog - Download and display the changelog for the given package

See apt-get(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.
$
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

apt命令 的相关文章

随机推荐

  • 使用Wireshark与Burp Suite分析HTTPS协议

    目录 目的 内容 器材 设备 元器件 步骤 1 虚拟机服务器搭建网站 本机访问用Burp Suite抓包获取头信息 2 Wireshark和Burp Suite处理HTTPS的过程与技术实现过程原理 1 Wireshark 2 Burp S
  • Spring Cloud五大组件

    Spring Cloud五大组件 Spring Cloud是分布式微服务架构的一站式解决方案 在Spring Boot基础上能够轻松搭建微服务系统的架构 现有Spring Cloud有两代实现 一代 Spring Cloud Netflix
  • SpringBoot(一)使用itelliJ社区版创建SpringBoot项目

    工欲善其事 必先利其器 要开发SpringBoot项目 首先就是选择一款合适的开发工具 目前市面上有很多优秀的开发工具 例如 IntelliJ IDEA Visual Studio Code 和 Eclipse 等 那么我们该如何选择呢 最
  • 17 Redis缓存更新策略(缓存和数据库更新选择)

    1 先更新数据库 在更新缓存 会有异常 更新完Mysql 发生异常 redis还没有更新 导致redis的是旧数据 下次读取缓存读的是脏数据 2 先删除缓存 在更新数据库 1 缓存已经删了 mysql还在更新中 由于Mysql还在更新中 会
  • java类注释_Java注释,java类注释详解

    一个程序的可读性 关键点就在于注释 下面要给大家讲到的就是Java注释方面的知识 主要会介绍java类注释 类注释一般必须放在所有的 import 语句之后 类定义之前 主要声明该类可以做什么 以及创建者 创建日期 版本和包名等一些信息 下
  • VS2022编译调试FFmpeg

    Git 工具下载 安装直接选择好安装路径 直接下一步到安装完成 配置好工程目录 msvc为编译生成的目标文件的目录 source为源代码目录 进入source目录 通过Git下载FFmpeg git clone https github c
  • 设计模式(三)——装饰模式

    往期地址 设计模式 一 简单工厂模式 设计模式 二 策略模式 本期主题 讲解装饰模式 装饰模式 1 什么是装饰模式 2 实例 2 1 场景 2 2 代码 1 什么是装饰模式 装饰模式是一种结构型设计模式 可以把对象的特殊行为进行封装 从而为
  • ue4单选框设置

    奇怪的是 ue4只有多选框 原来合并了 Style FCoreStyle Get RadioButton 不多说了 放代码 先枚举几个 enum ERadioChoice Radio0 Radio1 Radio2 SHorizontalBo
  • steps_per_epoch=2000,epochs=100之间的区别

    第一种解释 batchsize 中文翻译为批大小 批尺寸 在深度学习中 一般采用SGD训练 即每次训练在训练集中取batchsize个样本训练 iteration 中文翻译为迭代 1个iteration等于使用batchsize个样本训练一
  • 小程序

    文章目录 新建项目并梳理项目结构 配置导航栏效果 配置 tabBar 效果 实现轮播图效果 获取轮播图数据 渲染轮播图页面效果 对轮播图进行美化 实现九宫格效果 获取九宫格数据 渲染九宫格布局 美化九宫格布局 实现图片布局 上拉触底案例 定
  • Lua判断一个对象是否为空,包含userdata

    Lua判断一个对象是否为空 客户端在开发游戏的时候 经常会遇到一个问题 C 传递过来的GameObject已经被销毁了 但是lua这边判断却不是nil 而是一个userdata 那怎么判断一个userdata是否为空呢 可以使用如下代码判断
  • SSH密码暴力破解

    SSH密码暴力破解 1 Hydra 海德拉 hydra 是世界顶级密码暴力密码破解工具 支持几乎所有协议的在线密码破解 功能强大 其密码能否被破解关键取决于破解字典是否足够强大 在网络安全渗透过程中是一款必备的测试工具 1 1指定用户破解
  • 数据结构自考

    设带头结点的单向循环链表的头指针为变量head 则空循环链表的判定条件是 head gt next head 一个具有n个顶点的无向完全图的边数为 n n 1 2 设某有向图有n个顶点 则改有向图对应的邻接表中的表头节点个数为n 若查找每个
  • 使用freemarker生成静态html文件

    一 引入依赖
  • 如何在家里赚钱,分享六个适合普通人长期可做的副业

    当今社会 压力越来越大 工作 家庭 生活等等 方方面面都需要钱 仅靠一份工作赚钱 已经很难满足我们的需求 所以越来越多的人尝试做副业 通过副业增加收入 让生活过得更幸福 常见的副业都是业余学一项技能 通过这项技能来赚钱 这是最保险的副业方式
  • 获取磁盘信息并扫描是否连接移动磁盘之JS版

    昨天弄了一天 扫描U盘是否连接到电脑 的功能 折腾了一天出了个java版和js版 这里记录下JS版本 先说说思路 从浏览器的地址栏打开网页之后 通过onload事件调用ActiveXObject判断U盘是否连接到电脑 若是连接了获取信息显示
  • 数论 费马小定理+快速幂取模

    D Sum Time Limit 1000MS Memory Limit 131072KB 64bit IO Format I64d I64u Submit Status Description Input 2 Output 2 Hint
  • 商用服务器性能,安全与性能兼顾的商用服务器推荐

    数据作为企业生存之本 如果没有好的商用服务器为其安全性保驾护航 企业就会变成无本之木 而在众多商用服务器推荐中 能将稳定性能 快速处理 高安全性等优点集一身的当属全球销量独占鳌头的戴尔14代PowerEdge服务器 作为现代化数据中心的基石
  • 关于“使用rand()产生的随机数每次得到的结果相同”的问题

    之前使用rand 产生随机数出现了一个怪问题 一直没能理解 初次出现的随机数数列是1111 5556 3543 6434 3245 再次运行 产生的结果仍然是1111 5556 3543 6434 3245 再运行 仍然是1111 5556
  • apt命令

    在基于 Debian 的 Linux 发行版中 有各种工具可以与 APT 进行交互 以方便用户安装 删除和管理的软件包 apt get 便是其中一款广受欢迎的命令行工具 另外一款较为流行的是 Aptitude 这一命令行与 GUI 兼顾的小