Sometimes on Linux Ubuntu/Debian, we want to know in advance what version would we obtain before actually installing a specific package. Using simple tools like aptitude and apt-get makes this very easy to achieve.
The simulation switch ‘-s’ in the command apt-get allows us to see what would result in case we upgrade or install a given package. The command is as follows :
apt-get -s install <package_name>
As an example, see the snapshot below :
Now replace install with upgrade to see all possible upgrades:
apt-get -V -s upgrade
For instance, for the package, git, this shows :
Read: How to use the APT command on Ubuntu/Debian Linux systems
Using the command apt-cache below will display the installed and the remote version of a package.
apt-cache policy <package>
For the package git, we will see the following information :
For instance the command related to the package whois will display the following information :
Note: The numbers 500 (and 100) are called priority numbers. For additional information you can run man apt_preferences in which it is mentioned that 500 corresponds to installable whereas 100 means installed.
Read: Must-do Things After Installing Ubuntu 18.04
Once the package has been installed, you will see both 500 and 100 which correspond to the version that is located in the archives and to the locally installed version respectively.
If the package is installed, the command apt-show-versions will show version information about a specific package:
In the snapshot below, we installed the command apt-show-versions and then we apply it to sudo command :
Linux check package version
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.