Check package version with apt show
In the previous step, you learned how to check the version of a command using the --version
flag. However, this only works if the command itself supports it. A more general way to get detailed information about installed software, including its version, is by using the package manager.
On Debian-based systems like Ubuntu, the apt
command is used for package management. The apt show
command can display information about a specific package.
Let's use apt show
to check the version of the nano
package. Type the following command in your terminal and press Enter:
apt show nano
You will see a lot of information about the nano
package. Look for the line that starts with Version:
.
Package: nano
Version: 5.9-4
...
APT-Sources: http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
Description: small, friendly text editor inspired by Pico
...
The output shows the package name, its version, dependencies, description, and other details. This is a powerful way to get comprehensive information about installed software packages.
Now, let's try checking the information for the curl
package:
apt show curl
Again, look for the Version:
line in the output.
Package: curl
Version: 7.81.0-1ubuntu1.10
...
APT-Sources: http://security.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
Description: command line tool for transferring data with URL syntax
...
Using apt show
is particularly useful when you need more details than just the version number, such as the package's dependencies or where it was installed from.
Click Continue to move to the next step.