Linux get package version

How can I find the version number of an installed package via dpkg?

Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-=========================-=========================-================================================================== ii network-manager 0.8.3~git.20101118t223039 network management framework daemon 

As you can see, it returns 0.8.3~git.20101118t223039 which is wrong because it truncates the version (I’ve picked a long one for the purpose of this question). The way I’ve solved this in the past is to pass a stupidly long COLUMNS argument to make it expand:

COLUMNS=200 dpkg -l network-manager 
Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-============================================-============================================-======================================================================================================== ii network-manager 0.8.3~git.20101118t223039.d60a988-0ubuntu1 network management framework daemon 

Now I can see the full version number, which is 0.8.3~git.20101118t223039.d60a988-0ubuntu1 . I get the feeling that this is not the proper way to find the version number of an installed package. This never really was a problem in the past, but with the tacking on of «ubuntu» in the versions and the proliferation of PPAs these strings are getting longer and longer. Is there an easier way?

Источник

How to see package version without install?

You can use apt-cache to query the APT cache. To show the versions known by your system use apt-cache policy . Example:

apt-cache policy iceweasel iceweasel: Installed: 10.0.4esr-3 Candidate: 10.0.4esr-3 Version table: 12.0-7 0 1 http://ftp.us.debian.org/debian/ experimental/main amd64 Packages *** 10.0.4esr-3 0 500 http://ftp.us.debian.org/debian/ sid/main amd64 Packages 100 /var/lib/dpkg/status 10.0.4esr-2 0 500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages 

This means iceweasel version 12.0-7 is available in experimental and has priority 1, version 10.0.4esr-3 is installed from sid and has priority 500 and 10.0.4esr-2 is in testing.

Читайте также:  Работа i2c в linux

For a detailed description about the meaning of priorities have a look at apt_preferences(5)

You can also display a brief description and some meta information about the package with

apt-cache show package-name 

Information about all debian packages / online

If you want to get version information about all available debian packages (basically what http://packages.debian.org does) you can use rmadison(1) to remotely query the database. rmadison is in the devscripts package which you have to install via apt-get install devscripts .

$ rmadison iceweasel iceweasel | 3.0.6-3 | lenny-security | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc iceweasel | 3.0.6-3 | lenny | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc iceweasel | 3.5.16-11~bpo50+1 | backports/lenny | source, alpha, amd64, armel, i386, ia64, mips, mipsel, powerpc, s390, sparc iceweasel | 3.5.16-14 | squeeze | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc iceweasel | 3.5.16-15 | squeeze-p-u | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc iceweasel | 3.5.16-15 | squeeze-security | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc iceweasel | 10.0.4esr-2~bpo60+1 | squeeze-backports | source, amd64, i386, kfreebsd-amd64, kfreebsd-i386, s390 iceweasel | 10.0.4esr-2 | wheezy | source, amd64, armel, armhf, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc iceweasel | 10.0.4esr-3 | sid | source, amd64, armel, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc iceweasel | 11.0-4 | experimental | source, armel iceweasel | 12.0-3 | experimental | source, mips iceweasel | 12.0-7 | experimental | source, amd64, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, powerpc, s390, s390x, sparc 

The difference between apt-cache and rmadison is that apt-cache shows only the information known to your system (but can be used offline) while rmadison shows all version of available packages

Источник

How can I check the version before installing a package using ‘apt-get’?

I’m thinking to install hylafax+ version 5.5.4 which was released last month on my Debian PC. I checked dpkg -l | grep «hylafax» and found out that the current version is 5.5.3. Then I checked apt-cache search hylafax and saw the packages are available, but I can’t see any version number. How can I find the version of packages available in the apt-get ?

Читайте также:  Linux vnc client console

11 Answers 11

apt-cache policy will show the version details.

It also shows which version is currently installed and which versions are available to install.

For example, apt-cache policy hylafax+

Can’t believe this isn’t shown in apt install , to give you a chance to review the versions before saying Y .

If we use apt install some packages (may not installed) get install straightaway. So I think for new Linux user its better to use apt policy .

$ apt-cache policy redis-server redis-server: Installed: (none) Candidate: 2:2.8.4-2 Version table: 2:2.8.4-2 0 500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages 
$ apt-get install -s redis-server 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 The following extra packages will be installed: libjemalloc1 redis-tools The following NEW packages will be installed: libjemalloc1 redis-server redis-tools 0 upgraded, 3 newly installed, 0 to remove and 3 not upgraded. Inst libjemalloc1 (3.5.1-2 Ubuntu:14.04/trusty [amd64]) Inst redis-tools (2:2.8.4-2 Ubuntu:14.04/trusty [amd64]) Inst redis-server (2:2.8.4-2 Ubuntu:14.04/trusty [amd64]) Conf libjemalloc1 (3.5.1-2 Ubuntu:14.04/trusty [amd64]) Conf redis-tools (2:2.8.4-2 Ubuntu:14.04/trusty [amd64]) Conf redis-server (2:2.8.4-2 Ubuntu:14.04/trusty [amd64]) 
$ apt-cache show redis-server Package: redis-server Priority: optional Section: universe/misc Installed-Size: 744 Maintainer: Ubuntu Developers Original-Maintainer: Chris Lamb Architecture: amd64 Source: redis Version: 2:2.8.4-2 Depends: libc6 (>= 2.14), libjemalloc1 (>= 2.1.1), redis-tools (= 2:2.8.4-2), adduser Filename: pool/universe/r/redis/redis-server_2.8.4-2_amd64.deb Size: 267446 MD5sum: 066f3ce93331b876b691df69d11b7e36 SHA1: f7ffbf228cc10aa6ff23ecc16f8c744928d7782e SHA256: 2d273574f134dc0d8d10d41b5eab54114dfcf8b716bad4e6d04ad8452fe1627d Description-en: Persistent key-value database with network interface Redis is a key-value database in a similar vein to memcache but the dataset is non-volatile. Redis additionally provides native support for atomically manipulating and querying data structures such as lists and sets. . The dataset is stored entirely in memory and periodically flushed to disk. Description-md5: 9160ed1405585ab844f8750a9305d33f Homepage: http://redis.io/ Bugs: https://bugs.launchpad.net/ubuntu/+filebug Origin: Ubunt 
$ dpkg -l nginx Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-========================================-=========================-=========================-===================================================================================== ii nginx 1.6.2-1~trusty amd64 high performance web server 

Источник

Command to check version [duplicate]

I am new to this platform so can some one help me out for some commands. I need some commands on patching a server for only specific packages. After upgrading packages how to figure out package updated to latest version or not ??

Читайте также:  List all linux os version

3 Answers 3

There are a lot of different solutions/workarounds I’m going to mention some:

1. Find installed version

1.1. dpkg

Use dpkg -l pkg-name to get package version, e.g:

it’s going to give you some information:

||/ Name Version Architecture Description +++-========================================================================== ii firefox 53.0.3+build1-0ubuntu0. amd64 Safe and easy web brow 

1.2. pkg —version

Depends on your package switches like -v or —version might be available to you:

2. Last available version

2.1. apt show

Then use sudo apt update to make sure your sources are up to date, and use apt show firefox | grep -i version to see the last version available.

2.2. Ubuntu packages database

You can also check https://packages.ubuntu.com to search for your package version.

2.3. apt changelog

As an alternative you can use apt changelog pkg-name , e.g apt changelog firefox this will connect to internet to get the last «change log» data so you don’t have to update your sources for using this command.

2.4. rmadison

The other option is rmadison , it remotely query the archive database about a packages, so you don’t have to update your source in this option.

First install its package: sudo apt install devscripts , then use it like:

 rmadison -s zesty -a amd64 wget 

it give you last available version of wget for «zesty» and «amd64» architecture.

Check if upgrades are available for a particular package

It is possible to use apt-cache like this,

$ apt-cache policy # generic $ apt-cache policy firefox # example with output firefox: Installed: 53.0.3+build1-0ubuntu0.16.04.2 Candidate: 53.0.3+build1-0ubuntu0.16.04.2 Version table: *** 53.0.3+build1-0ubuntu0.16.04.2 500 500 http://se.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages 500 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages 100 /var/lib/dpkg/status 45.0.2+build1-0ubuntu1 500 500 http://se.archive.ubuntu.com/ubuntu xenial/main i386 Packages 

Update source list

Update listing the sources

Upgrade a package

Upgrade a particular package (and whatever is needed to support the new version)

Upgrade all installed packages

Upgrade the installed packages, which have upgrades available

Man pages

Источник

Оцените статью
Adblock
detector