Before I install a package I'd like to know what version I would get. How do I check the version before installing using
aptitude on debian or ubuntu?
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 a
upgrade in verbose mode and (to be safe) with simulation, press n to cancel:
apt-get -V -s upgrade
policy can show the installed and the remote version (install candidate) of a package.
apt-cache policy <package>
If installed, shows version information about one or more packages:
-u switch with or without a package name will only show upgradeable packages.
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>
-V will show detailed information about versions, again to be safe with the simulation switch:
aptitude -V -s install <package>
install <package> with
upgrade will show the versions from all upgradeable packages.
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
To obtain package name:
apt-cache search *search term*
To get version details:
apt-cache show *packagename*
apt-cache are being deprecated, with
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>
$apt-cache show latexila
$apt-cache show npm