| 
                         示例输出: 
- 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. 
 
  
这里,-V 标志用于显示软件包的详细信息。 
- $ aptitude -V -s upgrade vim 
 
  
类似的,只需将 install 替换为 upgrade 选项,即可查看升级包会发生什么。 
- $ aptitude search vim -F "%c %p %d %V" 
 
  
这里, 
    - -F 用于指定应使用哪种格式来显示输出,
 
    - %c – 包的状态(已安装或未安装),
 
    - %p – 包的名称,
 
    - %d – 包的简介,
 
    - %V – 包的版本。
 
 
当你不知道完整的软件包名称时,这非常有用。这个命令将列出包含给定字符串(即 vim)的所有软件包。 
以下是上述命令的示例输出: 
- [...] 
 - p vim Vi IMproved - enhanced vi editor 2:8.0.1453-1ub 
 - p vim-tlib Some vim utility functions 1.23-1 
 - p vim-ultisnips snippet solution for Vim 3.1-3 
 - p vim-vimerl Erlang plugin for Vim 1.4.1+git20120 
 - p vim-vimerl-syntax Erlang syntax for Vim 1.4.1+git20120 
 - p vim-vimoutliner script for building an outline editor on top of Vim 0.3.4+pristine 
 - p vim-voom Vim two-pane outliner 5.2-1 
 - p vim-youcompleteme fast, as-you-type, fuzzy-search code completion engine for Vim 0+20161219+git 
 
  
方法 4 – 使用 Apt-cache 
apt-cache 命令用于查询基于 Debian 的系统中的 APT 缓存。对于要在 APT  的包缓存上执行很多操作时,它很有用。一个很好的例子是我们可以从 某个仓库或 ppa 中列出已安装的应用程序 。                         (编辑:泰州站长网) 
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! 
                     |