How to Check OS Version in Ubuntu Terminal


Check OS Version in Ubuntu with Terminal

Linux is opensource and free operating system available today. When installing software packages and security patches the operating system version is important. In this tutorial, we are going to learn how to check the OS version in Ubuntu with Terminal.

Check OS Version in Ubuntu

You can check the OS version by using the following lsb_release command:

lsb_release -a

uname can also be used to check OS version:

uname -r

By using hostnamectl the command can also be useful checking OS version:

hostnamectl

The Operating-System related information is also stored inside /etc/os-release file, to display it use the following command:

cat /etc/os-release

Examples of checking OS version

Following are the examples with output data to show the version of the operating system version:

1. lsb_release Command

LSB stands for Linux Standard Base. The lsb_release command displays information on Linux Distribution. To check the OS version you can run following lsb_release Command:

lsb_release -a

2. uname Command

You can display Linux Kernel Architecture, version, name, etc. by using uname command:

uname -srvo

The output should be:

Linux 18.04-UBUNTU #1 SMP Sat Dec 21 11:18:44 UTC 2019 GNU/Linux

Or to display only OS version type the following command:

uname -r

The output should be:

UBUNTU-18-04

3. Using /etc/os-release File Data

The /etc/os-release file contains operating system related identification data. You can simply use the cat command to show the data of etc/os-release file data:

cat /etc/os-release

4. hostnamectl Utility

The hostnamectl utility is part of SystemD used for changing hostname, we can use this utility to display information about Linux Distribution.

hostnamectl

5. /etc/*release File for Old Linux Distributions

If you are running a very old Linux Distro then maybe all the above methods will not work. So to check OS version on very old computers use the following command:

cat /etc/*release

or you can check the only version by using the following command:

cat /etc/*version

Conclusion

You have successfully learned How to Check OS Version in Ubuntu with Terminal. If you have any queries please don’t forget to comment out.