| 副标题[/!--empirenews.page--]   大多数人都知道如何在 Linux 中查找已安装软件包的版本,但是,你会如何查找那些还没有安装的软件包的版本呢?很简单!本文将介绍在 Debian 及其衍生品(如 Ubuntu)中,如何在软件包安装之前检查它的版本。对于那些想在安装之前知道软件包版本的人来说,这个小技巧可能会有所帮助。 在安装之前检查 Linux 软件包版本在基于 DEB 的系统中,即使软件包还没有安装,也有很多方法可以查看他的版本。接下来,我将一一介绍。 方法 1 – 使用 Apt检查软件包的版本的懒人方法: $ apt show <package-name>
 示例: $ apt show vim
 示例输出: Package: vimVersion: 2:8.0.1453-1ubuntu1.1Priority: optionalSection: editorsOrigin: UbuntuMaintainer: Ubuntu Developers <[email protected]>Original-Maintainer: Debian Vim Maintainers <[email protected]>Bugs: https://bugs.launchpad.net/ubuntu/+filebugInstalled-Size: 2,852 kBProvides: editorDepends: 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-scriptsHomepage: https://vim.sourceforge.io/Task: cloud-image, serverSupported: 5yDownload-Size: 1,152 kBAPT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 PackagesDescription: Vi IMproved - enhanced vi editor Vim is an almost compatible version of the UNIX editor Vi. . Many new features have been added: multi level undo, syntax highlighting, command line history, on-line help, filename completion, block operations, folding, Unicode support, etc. . This package contains a version 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 is 1 additional record. Please use the '-a' switch to see it
 正如你在上面的输出中看到的,apt show命令显示了软件包许多重要的细节,例如: 
    包名称,版本,来源(vim 来自哪里),维护者,包的主页,依赖,下载大小,简介,其他。 因此,Ubuntu 仓库中可用的 Vim 版本是 8.0.1453。如果我把它安装到我的 Ubuntu 系统上,就会得到这个版本。 或者,如果你不想看那么多的内容,那么可以使用 apt policy这个命令: $ apt policy vimvim:  Installed: (none)  Candidate: 2:8.0.1453-1ubuntu1.1  Version table:     2:8.0.1453-1ubuntu1.1 500        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages     2:8.0.1453-1ubuntu1 500        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
 甚至更短: $ apt list vimListing... Donevim/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64N: There is 1 additional version. Please use the '-a' switch to see it
 apt是 Ubuntu 最新版本的默认包管理器。因此,这个命令足以找到一个软件包的详细信息,给定的软件包是否安装并不重要。这个命令将简单地列出给定包的版本以及其他详细信息。
 方法 2 – 使用 Apt-get(编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |