How To Check Your Ubuntu Version From The Command-Line?

Ubuntu has been one of the most popular Linux distributions ever. Since its first release in October of 2004, it has put out 34 semi-annual releases. With such a big list of releases, one can easily get confused about the version number of their current Ubuntu installation. So in this tutorial, we take a look at how we can check the version number of any Ubuntu installation.

Also read: How to check Java version?

Checking the Ubuntu Version

To check the version number, we will be using the lsb_release command which is used to print distro specific details.

To print the version number of your Ubuntu, run the following.

lsb_release -a

The -a flag specifies the software to print all details i.e. codename, release , id , distribution and LSB version.

The output should somewhat resemble this.

No LSB modules are available.  
Distributor ID: Ubuntu  
Description:    Ubuntu 18.04.5 LTS  
Release:        18.04  
Codename:       bionic

In this case, the Ubuntu version number is 18.04.

Note: You usually get an error at the start mentioning that the device doesn’t have any LSB modules available. LSB stands for Linux Standard Base and is a joint project taken up by several distributions to have a common software system structure. lsb_release is a part of this project. You can read more about it here.

Removing the “No LSB modules are available” error.

Method 1:

You can remove this error by downloading the lsb-core package. To do this execute the following command.

 sudo apt install lsb-core

After you have installed lsb-core, your output of lsb_release -a will also mention the LSB version.

LSB Version:	core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu  
Description:    Ubuntu 18.04.5 LTS  
Release:        18.04  
Codename:       bionic

Method 2:

Instead of using the -a flag which prints all details, we just specify the software to just print Codename(-c), Release(-r), and Description(-d). So go ahead and execute the following

lsb_release -cdr

This will give a similar output to this

Description:    Ubuntu 18.04.5 LTS  
Release:        18.04  
Codename:       bionic

Conclusion

Now you can easily check the version of your Ubuntu installation and follow any helpful guide that is specific to your version number. Have fun and keep exploring!