How to Check Ubuntu Version

It is important to know what version of Ubuntu your system is running if you are planning to install software or want to establish what functionalities it may have.

 

Typically, new versions of Ubuntu are released every six months with major version changes happening every two years. You can view the Ubuntu release log here.

 

In this tutorial, we will learn how to check what Ubuntu version you have using the command-line.

 

The lsb_release Utility

To get what version of Ubuntu you have, use the lsb_release utility. Pass the -a flag to get the distributor ID, release and codename information in one.

 

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial

 

To only show the release number use the -r flag:

 

lsb_release -r
Release: 16.04

 

To only show the distribution codename use the -c flag:

 

lsb_release -c
Codename: xenial

 

To show a description of the system only, use the -d flag:

 

lsb_release -d
Description: Ubuntu 16.04.6 LTS

 

Check the /etc/issue File

All Ubuntu systems have a /etc/issue file, which contains a description of the system. This can be a handy alternative way of checking your Ubuntu version without using lsb_release. In the example below, we are using the cat command to display the contents of /etc/issue.

 

cat /etc/issue
Ubuntu 16.04.6 LTS \n \l

 

Check the /etc/os-release File

Ubuntu versions 16.04 and above have a /etc/os-release file which contains detailed information about the system. We can use the cat command to get the contents of the /etc/os-release file like this:

 

cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

 

 

Use hostnamectl to See Ubuntu Version

Another way to see the Ubuntu version is by using the hostnamectl command. This command is used for changing the system hostname but also contains a description of the system.

 

hostnamectl
 Static hostname: alice
    Icon name: computer-vm
     Chassis: vm
   Machine ID: 466af0b5c0394fe49827732fcafd05cc
     Boot ID: ce14b80ea3044000b9e87741ee48c615
 Virtualization: kvm
Operating System: Ubuntu 16.04.6 LTS
     Kernel: Linux 4.4.0-190-generic
  Architecture: x86-64

 

Conclusion

In this tutorial, we have looked at several different ways of revealing what release of Ubuntu you are running. 

ubuntu terminal