linux中apt-cache命令的用法

apt-cache是linux下的一个apt软件包管理工具,它可查询apt的二进制软件包缓存文件。APT包管理的大多数信息查询功能都可以由apt-cache命令实现,通过apt-cache命令配合不同的子命令和参数的使用,可以实现查找,显示软件包信息及包依赖关系等功能.

1> apt-cache show package_name

显示指定软件包的信息,包括版本号,安装状态和包依赖关系等.

2> apt-cache search package_name

搜索软件包,可以按关键字查找软件包,通常用于查询的关键字会使用软件包的名字或软件包的一部分.

3> apt-cache showpkg package_name

显示软件包的依赖关系信息.

4> apt-cache stats

显示当前系统所使用的数据源的统计信息,用户可以使用该命令查看数据源的相关统计信息.

5> apt-cache policy package_name

显示软件包的安装状态和版本信息.

6> apt-cache depends package_name

显示指定软件包所依赖的软件包。当用户需要了解某个软件包依赖于其他哪些包时,可以使用apt-cache depends来查询包依赖关系.

7> apt-cache rdepends package_name

查询指定软件包的反向依赖关系,即那些其他的软件包需要依赖你所指定的软件包做为安装和运行的必须条件.

8>apt-cache dump
显示缓存中的每个软件包的简要描述信息.

9>apt-cache unmet
显示不符合一致性的依赖关系.

========================================================================================

【from http://www.9usb.net/200811/linux-apt-cache.html】

========================================================================================

manfile:

OPTIONS
All command line options may be set using the configuration file, the descriptions indicate the configuration option to set. For boolean
options you can override the config file by using something like -f-,--no-f, -f=no or several other variations.

-p, --pkg-cache
Select the file to store the package cache. The package cache is the primary cache used by all operations. Configuration Item:
Dir::Cache::pkgcache.

-s, --src-cache
Select the file to store the source cache. The source is used only by gencaches and it stores a parsed version of the package
information from remote sources. When building the package cache the source cache is used to avoid reparsing all of the package
files. Configuration Item: Dir::Cache::srcpkgcache.

-q, --quiet
Quiet; produces output suitable for logging, omitting progress indicators. More q´s will produce more quietness up to a maximum of 2.
You can also use -q=# to set the quietness level, overriding the configuration file. Configuration Item: quiet.

-i, --important
Print only important dependencies; for use with unmet. Causes only Depends and Pre-Depends relations to be printed. Configuration
Item: APT::Cache::Important.

-f, --full
Print full package records when searching. Configuration Item: APT::Cache::ShowFull.

-a, --all-versions
Print full records for all available versions. This is the default; to turn it off, use --no-all-versions. If --no-all-versions is
specified, only the candidate version will displayed (the one which would be selected for installation). This option is only
applicable to the show command. Configuration Item: APT::Cache::AllVersions.

-g, --generate
Perform automatic package cache regeneration, rather than use the cache as it is. This is the default; to turn it off, use --no-generate. Configuration Item: APT::Cache::Generate.

--names-only, -n
Only search on the package names, not the long descriptions. Configuration Item: APT::Cache::NamesOnly.

--all-names
Make pkgnames print all names, including virtual packages and missing dependencies. Configuration Item: APT::Cache::AllNames.

--recurse
Make depends and rdepends recursive so that all packages mentioned are printed once. Configuration Item: APT::Cache::RecurseDepends.

--installed
Limit the output of depends and rdepends to packages which are currently installed. Configuration Item: APT::Cache::Installed.

-h, --help
Show a short usage summary.

-v, --version
Show the program version.

-c, --config-file
Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this
configuration file. See apt.conf(5) for syntax information.

-o, --option
Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar. -o and --option can be
used multiple times to set different options.
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 当你在Linux系统使用"sudo: apt-cache: 找不到命令"时,这通常是因为你的系统没有安装apt-cache命令apt-cache是用于查询软件包缓存的工具,它通常与apt-get命令一起使用。要解决这个问题,你可以尝试使用以下命令安装apt-cache: sudo apt-get install apt-utils 这将安装apt-utils软件包,其包含apt-cache命令。安装完成后,你应该能够正常使用apt-cache命令了。请注意,你可能需要使用root权限或具有sudo权限的用户才能执行此操作。 #### 引用[.reference_title] - *1* [linux平台下编译报某些命令找不到解决思路](https://blog.csdn.net/u011018840/article/details/110226110)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Ubuntu/Debian下 apt-get command not found 命令无法找到的解决方法](https://blog.csdn.net/weixin_30906671/article/details/98341985)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [全网详细解决sudo: apt-get: command not found以及详细分析yum和apt-get的区别](https://blog.csdn.net/lvoelife/article/details/129146477)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值