sol*_*ron 5 updates package-management apt repository software-installation
我有一些关于 APT 包管理器的问题。
据我了解,我们的存储库 URL 位于/etc/apt/sources.list和/etc/apt/sources.list.d/*
当apt-get update被调用时,apt 会尝试连接到文件中所有指定的存储库,并下载有关这些存储库的有关哪些程序可用等的信息。
它在本地缓存所有检索到的数据,以便以后使用它而无需向存储库发出 Internet 请求。
当apt-get install被调用时,它从可用的存储库中搜索本地缓存包列表,如果没有找到包,它除了显示错误之外什么都不做。
apt-get search 还会查看本地缓存,并且不会向 Internet 发出任何请求。
我对吗?我不确定发出请求而不是在本地缓存中搜索数据的命令。
此外,之间有什么区别apt-cache search和apt search?我猜他们都使用本地缓存。
你是正确的,apt-get update从源(在线)和其他命令读取apt-get search并apt-get install从缓存的信息读取。来自man apt:
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.
Run Code Online (Sandbox Code Playgroud)
apt search <package>和之间的区别在于aptapt-cache search <package>的输出apt search更漂亮(有颜色,按字母顺序组织,有很好的分行以方便阅读),因为 apt 是一个花哨的新界面。这在这个关于 apt 和 apt-get 之间区别的答案中得到了很好的解释
但是,搜索并不是您可以使用 apt-cache 做的唯一事情:
Usage: apt-cache [options] command
apt-cache [options] show pkg1 [pkg2 ...]
apt-cache queries and displays available information about installed
and installable packages. It works exclusively on the data acquired
into the local cache via the 'update' command of e.g. apt-get. The
displayed information may therefore be outdated if the last update was
too long ago, but in exchange apt-cache works independently of the
availability of the configured sources (e.g. offline).
Most used commands:
showsrc - Show source records
search - Search the package list for a regex pattern
depends - Show raw dependency information for a package
rdepends - Show reverse dependency information for a package
show - Show a readable record for the package
pkgnames - List the names of all packages in the system
policy - Show policy settings
Run Code Online (Sandbox Code Playgroud)
这是从info页面apt-cache
apt结合来自apt-getand 的命令apt-cache,因此您可以从任何apt-cache [option] <package>命令获得相同或稍微更漂亮/整理的输出,apt [option] <package>例如
apt show gimp
Run Code Online (Sandbox Code Playgroud)
显示几乎完全相同
apt-cache show gimp
Run Code Online (Sandbox Code Playgroud)