如何在Linux中找到一个包版本

时间:2020-03-21 11:43:42  来源:igfitidea点击:

尽管在图形包管理器的帮助下,包管理已经变得更容易,但有些用户始终更喜欢命令行方式。
有不同的命令可以在不同的Linux中查找包版本。
今天,在本教程中,我们将看到如何在一些流行的Linux发行版中找到一种包装版本,例如Arch Linux及其衍生品,Debian及其衍生品,Rhel及其衍生品。

在基于Arch的系统中查找包版本

要查找Arch Linux中的已安装包(例如,VLC)版本及其衍生物(如Manjaro Linux),请运行以下命令:

$pacman -Q vlc

示例输出:

vlc 2.2.4-3

如上所述,VLC包的已安装版本为2.2.4-3.

要显示包的广泛细节,请运行:

$pacman -Qi vlc

示例输出:

Name : vlc
Version : 2.2.4-3
Description : A multi-platform MPEG, VCD/DVD, and DivX player
Architecture : x86_64
URL : http://www.videolan.org/vlc/
Licenses : LGPL2.1 GPL2
Groups : None
Provides : None
Depends On : a52dec libdvbpsi libxpm libdca libproxy sdl_image
 libdvdnav libtiger lua libmatroska zvbi taglib
 libmpcdec ffmpeg2.8 faad2 libupnp libshout libmad
 libmpeg2 xcb-util-keysyms libtar libxinerama
Optional Deps : avahi: for service discovery using bonjour protocol
 [installed]
 libnotify: for notification plugin [installed]
 gtk2: for notify plugin [installed]

 [...]
  lua-socket: for http interface
 qt4: for the GUI [installed]
Required By : None
Optional For : smtube
Conflicts With : vlc-plugin
Replaces : vlc-plugin
Installed Size : 53.28 MiB
Packager : Antonio Rojas <Hyman@theitroad>
Build Date : Sun 24 May 2015 03:12:59 PM IST
Install Date : Fri 05 Aug 2015 11:22:54 AM IST
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

上面的命令显示了完整的详细信息,例如包描述,版本,构建日期,安装日期和包业主等。

推荐阅读:

  • Pacman命令用法

在基于Deb的系统中查找包版本

在Debian,Ubuntu及其衍生品如Linux Mint,Mexhileary OS,我们可以找到已安装的包,例如Apache WebServer,使用命令版本:

$dpkg -s apache2 | grep -i version

示例输出:

Version: 2.4.18-2ubuntu3.1

要显示已安装包的广泛信息,请运行:

$dpkg -s apache2

示例输出:

Package: apache2
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 488
Maintainer: Ubuntu Developers <Hyman@theitroad>
Architecture: amd64
Version: 2.4.18-2ubuntu3.1
Replaces: apache2.2-bin, apache2.2-common
Provides: httpd, httpd-cgi
Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.18-2ubuntu3.1), apache2-utils (>= 2.4), apache2-data (= 2.4.18-2ubuntu3.1)
Pre-Depends: dpkg (>= 1.17.14)
Recommends: ssl-cert
Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, ufw
Conflicts: apache2.2-bin, apache2.2-common
Conffiles:
 /etc/apache2/apache2.conf da32fcc6a783acaebf0d74c17c726bf7
 /etc/default/apache-htcacheclean ae8721a0bc5b4e2ef7a5258b1e9db5c5
 [..]
 /etc/logrotate.d/apache2 7322a4f050c1e2454249695236a3472c
 /etc/ufw/applications.d/apache2-utils.ufw.profile f8d4fd920e598ceb4379613c6261f6af
Description: Apache HTTP Server
 The Apache HTTP Server Project's goal is to build a secure, efficient and
 extensible HTTP server as standards-compliant open source software. The
 result has long been the number one web server on the Internet.
 .
 Installing this package results in a full installation, including the
 configuration files, init scripts and support scripts.
Homepage: http://httpd.apache.org/
Original-Maintainer: Debian Apache Maintainers <Hyman@theitroad>

此外,我们可以使用命令找到包版本:

$apt-show-versions apache2

示例输出:

apache2:amd64/xenial-security 2.4.18-2ubuntu3.1 uptodate
apache2:i386 not installed

如上所述,我已安装Apache2 64位版本,其版本为2.4.18.

如果未安装"APT-Show-Versions"程序,则可以使用命令安装它:

$sudo apt install apt-show-versions

在基于RPM的系统中查找包版本

要在基于RPM的分布中查找已安装的包(例如,EG.HTTPD)的版本,如RPM,CentOS,Fedora,Scientific Linux和OpenSUSE等,运行:

$rpm -qi httpd

示例输出:

Name : httpd
Version : 2.4.6
Release : 40.el7.centos.4
Architecture: x86_64
Install Date: Thu 11 Aug 2015 08:08:45 PM IST
Group : System Environment/Daemons
Size : 9806117
License : ASL 2.0
Signature : RSA/SHA256, Mon 18 May 2015 09:35:16 PM IST, Key ID 24c6a8a7f4a80eb5
Source RPM : httpd-2.4.6-40.el7.centos.4.src.rpm
Build Date : Mon 18 May 2015 09:02:11 PM IST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.

上面的命令显示已安装的包版本,构建日期,许可证,描述等。
在输出中看到,Httpd软件包版本为2.4.6.