Before I install a package, I'd like to know what version I would get.
How do I check the version before installing using apt-get
or aptitude
on Debian or Ubuntu?
Before I install a package, I'd like to know what version I would get.
How do I check the version before installing using apt-get
or aptitude
on Debian or Ubuntu?
apt-get
You can run a simulation to see what would happen if you upgrade/install a package:
apt-get -s install <package>
To see all possible upgrades, run an upgrade
in verbose mode
and (to be safe) with simulation; press n to cancel:
apt-get -V -s upgrade
apt-cache
The option policy
can show the installed and the remote version (install candidate) of a package.
apt-cache policy <package>
apt-show-versions
If installed, shows version information about one or more packages:
apt-show-versions <package>
Passing the -u
switch with or without a package name will show only upgradeable packages.
apt show
Similar to what is obtained with dpkg -s <package>
:
apt show <package>
aptitude
The console GUI of aptitude
can display upgradeable packages with new versions. Open the menu 'Upgradable Packages'. Pressing v on a package will show more detailed version information.
Or on the command-line:
aptitude versions <package>
Passing -V
will show detailed information about versions.
Again, to be safe, with the simulation switch:
aptitude -V -s install <package>
Substituting install <package>
with upgrade
will show the versions from all upgradeable packages.
Another way using dpkg and grep:
dpkg -s <package> | grep Version
Another option, if you don't know the full name of the package, is formatting aptitude's search output:
aptitude search <package> -F "%c %p %d %V"
%c
= status (package installed or not)
%p
= package's name
%d
= package's description
%V
= available package's version
Reference: http://linux.die.net/man/8/aptitude
You can write apt show <package>
apt
and apt-cache
do the same thing. If you check the source code, they are both front-ends to the same functionality: for show
, a function called ShowPackage
and for search
, a function called DoSearch
.
– Anthony Geoghegan
Apr 27 '18 at 20:45
apt-cache policy
will show both installed and candidate versions, where apt show
will only show candidate version.
– Pablo A
Jan 16 '23 at 16:40
To obtain package name:
apt-cache search *search term*
To get version details:
apt-cache show *packagename*
I believe apt-get
and apt-cache
are being deprecated, with apt
and aptitude
becoming the preferred method. Given the longevity of the apt- suite, it's probably a safe bet for some time to come!
To see the latest available package before installing. Perform update so that you have all the latest package update.
$sudo apt-get update
Now, To check the latest package available in your repository before installing run below command.
$apt-cache show <package name>
Example:
$apt-cache show latexila
or
$apt-cache show npm
$ rmadison gdm3
gdm3 | 2.30.5-6squeeze2 | squeeze-security | i386
gdm3 | 2.30.5-6squeeze5 | squeeze | i386
gdm3 | 3.4.1-8 | wheezy | i386
gdm3 | 3.14.1-7 | jessie | i386
gdm3 | 3.18.0-2 | stretch | i386
gdm3 | 3.18.0-2 | sid | i386
from devscripts.deb
apt show <packages>
can also be added to the list – leo Feb 12 '17 at 21:24sudo apt -s install wireshark
, you'll see it will install version3.6.2-2
. If you install the Wireshark PPA withsudo add-apt-repository ppa:wireshark-dev/stable
first, however, and then runsudo apt -s install wireshark
, you'll see it will install version4.0.6-1
. In this way you can clearly see that the PPA will help you get a much newer version. – Gabriel Staples Jul 31 '23 at 23:20