Ubuntu获取apt已安装和可安装包信息

This blog will tell you how to check the vision before installing a package using apt.

The documentation in Chinese is as follow:

apt-cache 可以查询和显示已安装和可安装软件包的可用信息。
它专门工作在本地的数据缓存上,而这些缓存可以通过比如apt-get 的 'update' 命令来更新。如果距离上一次更新的时间太久,那么它显示的信息可能就会过时。

不过作为交换,apt-cache 不依赖当前软件源的可用性(比如:离线状态)

Briefly speaking, apt-cache (policy) is working on the local data cache, aiming to display which version is currently installed and which versions are available to install, and can be simply updated by "apt update".

Take cmake for instance, run

apt-cache policy cmake

and you'll get info in a format similar to the one below (vary from different configuration)

cmake:
  已安装:(无)
  候选: 3.10.2-1ubuntu2.18.04.2
  版本列表:
     3.10.2-1ubuntu2.18.04.2 500
        500 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 Packages
     3.10.2-1ubuntu2 500
        500 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 Packages

and also, for short,

apt policy cmake

is as the same, and run

apt show cmake

to see the details.

Furthermore,  use

apt install -s cmake

to view the possible vision in a simulative way.

use

apt -V upgrade

-V refer to verbose

Which will show you the current package vs the one to be upgraded.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

pi_kaqiu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值