Categories
Linux

3 Ways to Check Ubuntu Version and Code Name from Command Line

Quickly find your Ubuntu version and Code name

Ubuntu has a new release every six months; in April and October of every year. The version number is represented as <year>.<month>, for example, the version released in October 2019 is 19.10, while the version released in April 2018 is 18.04.

Advertisements

Further every version has a code name, which is in the format: An adjective, followed by an animal name. The adjective and animal name both begin with same letter, and the letters are chosen alphabetically. Eg. Ubuntu 17.10 was code named Artful Aardvark, 18.04 was code named Bionic Beaver and 19.10 is code named Eoan Ermine.

Let us see the various methods we can use to check our Ubuntu version.

Using lsb_release

The command lsb_release from the Linux Standard Base package displays information about the operating system version and kernel version.

Advertisements

Run it with -a flag to get Ubuntu version and code name:

lsb_release -a

As we can see, the version is displayed. However, only the first part of the code name is being displayed.


File /etc/os-release

We can print the contents of file /etc/os-release on the terminal using cat command to see the Ubuntu version, along with other OS information.

cat /etc/os-release

Here we can see the full code name of the version and not only the adjective part as in the previous command.


Using hostnamectl

The command hostnamectl can also be run to check Ubuntu version.

hostnamectl
Advertisements

As we can see, here only the version number is displayed, and code name is not displayed.


Conclusion

It is a good practice to check Ubuntu version so as to install relevant patches, security and performance updates, etc. accordingly.

Ubuntu also has a long term support (LTS) release every two years in April. A LTS version of Ubuntu is always recommended over an intermin (non LTS) version for stability as well as security reasons.