要查看软件包的版本而不安装它,我们可以使用 apt-get 命令和 -s 选项。
$ apt-get -s install vim
示例输出:
NOTE: This is only a simulation! apt-get needs root privileges for real execution. Keep also in mind that locking is deactivated, so don't depend on the relevance to the real current situation! Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: ctags vim-doc vim-scripts The following NEW packages will be installed: vim 0 upgraded, 1 newly installed, 0 to remove and 45 not upgraded. Inst vim (2:8.0.1453-1ubuntu1.1 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64]) Conf vim (2:8.0.1453-1ubuntu1.1 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
这里,-s 选项代表 模拟。正如你在输出中看到的,它不执行任何操作。相反,它只是模拟执行,好让你知道在安装 Vim 时会发生什么。
你可以将 install 选项替换为 upgrade ,以查看升级包时会发生什么。
$ apt-get -s upgrade vim
方法 3 – 使用 Aptitude
在 Debian 及其衍生品中,aptitude 是一个基于 ncurses(LCTT 译注:ncurses 是终端基于文本的字符处理的库)和命令行的前端 APT 包管理器。
使用 aptitude 来查看软件包的版本,只需运行:
$ aptitude versions vim p 2:8.0.1453-1ubuntu1 bionic 500 p 2:8.0.1453-1ubuntu1.1 bionic-security,bionic-updates 500
你还可以使用模拟选项(-s )来查看安装或升级包时会发生什么。
$ aptitude -V -s install vim The following NEW packages will be installed: vim [2:8.0.1453-1ubuntu1.1] 0 packages upgraded, 1 newly installed, 0 to remove and 45 not upgraded. Need to get 1,152 kB of archives. After unpacking 2,852 kB will be used. Would download/install/remove packages.
(编辑:西安站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|