Package: vim Version: 2:8.0.1453-1ubuntu1.1 Priority: optional Section: editors Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian Vim Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 2,852 kB Provides: editor Depends: vim-common (= 2:8.0.1453-1ubuntu1.1), vim-runtime (= 2:8.0.1453-1ubuntu1.1), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libgpm2 (>= 1.20.7), libpython3.6 (>= 3.6.5), libselinux1 (>= 1.32), libtinfo5 (>= 6) Suggests: ctags, vim-doc, vim-scripts Homepage: https://vim.sourceforge.io/ Task: cloud-image, server Supported: 5y Download-Size: 1,152 kB APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages Description: Vi IMproved - enhanced vi editor Vim isan almost compatible version of the UNIX editor Vi. . Many new features have been added: multi level undo, syntax highlighting, commandlinehistory, on-linehelp, filename completion, block operations, folding, Unicode support, etc. . This package contains aversion of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less).
N: There is1 additional record. Please use the '-a' switch to see it
正如你在上面的输出中看到的,apt show 命令显示了软件包许多重要的细节,例如:
包名称,
版本,
来源(vim 来自哪里),
维护者,
包的主页,
依赖,
下载大小,
简介,
其他。
因此,Ubuntu 仓库中可用的 Vim 版本是 8.0.1453。如果我把它安装到我的 Ubuntu 系统上,就会得到这个版本。
$ apt list vim Listing... Done vim/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 N: There is 1 additional version. Please use the'-a'switchto see it
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 时会发生什么。
$ aptitude versions vim p 2:8.0.1453-1ubuntu1 bionic 500 p 2:8.0.1453-1ubuntu1.1 bionic-security,bionic-updates 500
你还可以使用模拟选项(-s)来查看安装或升级包时会发生什么。
1 2 3 4 5 6
$ 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, 0toremoveand45 not upgraded. Need toget1,152 kB of archives. After unpacking 2,852 kB will be used. Would download/install/remove packages.
这里,-V 标志用于显示软件包的详细信息。
1
$ aptitude -V -s upgrade vim
类似的,只需将 install 替换为 upgrade 选项,即可查看升级包会发生什么。
1
$ aptitude search vim -F "%c%p%d%V"
这里,
-F 用于指定应使用哪种格式来显示输出,
%c – 包的状态(已安装或未安装),
%p – 包的名称,
%d – 包的简介,
%V – 包的版本。
当你不知道完整的软件包名称时,这非常有用。这个命令将列出包含给定字符串(即 vim)的所有软件包。
以下是上述命令的示例输出:
1 2 3 4 5 6 7 8 9
[...] pvim Vi IMproved - enhanced vi editor 2:8.0.1453-1ub pvim-tlib Some vim utility functions 1.23-1 pvim-ultisnips snippet solution for Vim 3.1-3 pvim-vimerl Erlang plugin for Vim 1.4.1+git20120 pvim-vimerl-syntax Erlang syntaxfor Vim 1.4.1+git20120 pvim-vimoutliner script for building an outline editor on top of Vim 0.3.4+pristine pvim-voom Vim two-pane outliner 5.2-1 pvim-youcompleteme fast, as-you-type, fuzzy-search code completion engine for Vim 0+20161219+git