APT(8)
名称
NAME
// apt - 命令行接口
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为软件包管理系统提供了一个高级命令行接口。它旨在作为一个最终用户界面,与更专业的APT工具(如APT-get(8)和APT-cache(8))相比,它默认启用了一些更适合交互式使用的选项。
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).
//就像apt自身一样,它的手册页旨在作为最终用户界面,因此只提到最常用的命令和选项——部分是为了避免在多个地方重复信息,部分是为了防止读者被丰富的选项和细节淹没。
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被用于从所有已配置的软件仓库镜像源下载软件包信息。其他命令对这些数据进行操作引用,例如执行软件包升级或搜索,并显示所有可供安装的软件包的详细信息。
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被用于对当前系统已经安装的所有来源于通过sources.list(5)配置的软件包安装可用更新。如果需要满足依赖关系,将安装新的包,但现有的已存在的包永远不会被删除。如果一个包的升级需要删除已安装的包,则不会执行此包的升级。
//当一个包作为参数被提供时,该包将在升级操作之前被安装。
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 removal of an installed package the upgrade for this package isn't performed.
When a package is supplied as an argument, the package will be installed prior to the upgrade action.
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.
When a package is supplied as an argument, the package will be installed prior to the upgrade action.
install, reinstall, remove, purge (apt-get(8))
//通过使用regex(7) 【正则表达式(7) 】、glob(7) 或精确匹配指定的一个或多个包执行请求的操作。对于特定的软件包,可以通过在软件包名称后附加加号( )来安装此软件包,或附加减号(-)来删除它,从而覆盖所请求的操作。
//通过在包名称后面加上等号(=)和要选择的包版本号,可以选择特定版本的包进行安装。或者,可以通过在包名后加上正斜杠(/)和代号(bookworm、trixie、sid…)或套件名称(stable, testing, unstable)来选择特定版本的版本。如果需要满足请求,也会将从该版本中选择此包的依赖项版本。
//删除包会删除所有打包的数据,但通常会留下小的(被修改过的)后续的用户配置文件,以防是意外删除。在这种情况下,只需为意外删除的软件包发出安装请求,即可恢复其功能。另一方面,即使在已经移除的包上,你也可以通过调用purge来清除这些残留数据。请注意,这不会影响存储在主目录中的任何数据或配置。
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 appending 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 (bookworm, trixie, 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用于删除为满足其他包的依赖关系而自动安装的包,因为依赖关系发生了变化,这些包现在不再需要,或者同时删除了需要它们的包。
//你应该检查该列表是否不包括你现在想要的应用程序,即使它们曾经作为另一个包的依赖项被安装过。你可以使用apt-mark(8)将此类软件包标记为手动安装。你之前通过install命令明确安装的软件包也永远不会被建议自动删除。
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.
satisfy (apt-get(8))
//满足依赖关系字符串,在“构建依赖关系”中被使用。它还通过在参数前加上“conflicts:”来处理冲突。
//示例: apt satisfy "foo, bar (>= 1.0)" "Conflicts: baz, fuzz"
satisfy satisfies dependency strings, as used in Build-Depends. It also handles conflicts, by prefixing an argument with "Conflicts: ".
Example: apt satisfy "foo, bar (>= 1.0)" "Conflicts: baz, fuzz"
search (apt-cache(8))
//search可用于在可用包列表中搜索给定的regex(7) 【正则表达式(7) 】项并显示匹配项。例如,如果您正在寻找具有特定功能的软件包,这可能很有用。如果您正在寻找包含特定文件的包,请尝试apt-file(1)。
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))
//显示有关给定的一个或多个软件包的信息,包括其依赖关系、安装和下载大小、软件包的来源、软件包内容的描述等等。例如,在允许apt(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
//list与dpkg-query --list有些相似,因为它可以显示满足特定条件的包列表。它支持glob(7)模式来匹配包名,apt-patterns(7),以及列出已安装(--installed)、可升级 (--upgradeable) 或所有可用(--all-versions) 版本的选项。
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, apt-patterns(7), as well as options to list installed (--installed), upgradeable (--upgradeable) or all available (--all-versions) versions.
//edit-sources开发中版本
edit-sources (work-in-progress)
//edit-sources允许你在首选文本编辑器中编辑你的sources.list(5)文件,同时还提供基本的健全性检查。
edit-sources lets you edit your sources.list(5) files in your preferred text editor while also providing basic sanity checks.
//showsrc, depends, rdepends, policy (在apt-cache(8)中被概述)
showsrc, depends, rdepends, policy (summarised in apt-cache(8))
//source, build-dep, download, changelog, clean, distclean, autoclean (在apt-get(8)中被概述)
source, build-dep, download, changelog, clean, distclean, autoclean (summarised in apt-get(8))
脚本使用和与其他APT工具的区别
SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS
//apt(8)命令行被设计为最终用户工具,它可能会在不同版本之间改变行为。虽然它试图不破坏向后兼容性,但如果更改似乎对交互式使用有益,也不能保证这一点。
//apt(8)的所有功能都可以在专用的APT工具中实现,如apt-get(8)和apt-cache(8)。apt(8)只是更改了一些选项的默认值(请参阅apt.conf(5),特别是Binary作用域)。因此,您应该更喜欢在脚本中使用这些命令(可能启用了一些其他选项),因为它们尽可能保持向后兼容性。
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), apt-patterns(7), The APT User's guide in /usr/share/doc/apt-doc/, apt_preferences(5), the APT Howto.
诊断
DIAGNOSTICS
//apt正常运行时返回0,出错时返回十进制100。
apt returns zero on normal operation, decimal 100 on error.
错误
BUGS
//APT bug page[1]. 如果您想报告APT中的错误,请参阅/usr/share/doc/debian/bug-reporting.txt或reportbug(1) 命令。
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 团队
APT team
备注
NOTES
//1.APT bug页面
1. APT bug page
https://bugs.debian.org/src:apt
APT 2.7.14 12 March 2024 APT(8)