Ubuntu releases new version every six months and LTS (Long Term Support) every two years. It is best practice to check the Ubuntu version before you use it.
Sometimes you will need to find out the version of Ubuntu is running on the machine. This will help you to apply security patches and software updates. You can find the Ubuntu version using in the command line or via the graphical interface.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Ubuntu Linux queries.
In this context, we shall look into how to check version with different methods.
It is good practice to check version using command line as it is not depend on anything. So here we are going to check Ubuntu version using lsb_release (Linux Standard Base) utility. Generally, this method is best because it will work regardless of any desktop environment or version you are using.
$ lsb_release -a
It will show output as below:
Output
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
From the above output you can see that Description line is showing OS version.
Instead of print all the details of your Ubuntu system, you can simply print only distribution name by passing -d with command:
$ lsb_release -d
The output should be similar like below:
Output
Description: Ubuntu 18.04.2 LTS
How to Check Ubuntu Version using /etc/os-release file ?
You also can check version using os-release file. It contains identification data of operating system and this available only with newer Ubuntu distribution. This method will work only if you have Ubuntu 16.04 or newer.
$ cat /etc/os-release
The output will be similar as below:
Output
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
How to Check Ubuntu Version using /etc/issue file ?
Like, os-release the /etc/issue file also contains the system identification text. Using below command you can see it:
$ cat /etc/issue
It will show output as following:
Output
Ubuntu 18.04.2 LTS \n \l
How to Check Ubuntu Version using hostnamectl command ?
Usually, hostnamectl command is used to set hostname in Ubuntu systems but you also can check the system details using it. Execute below command:
$ hostnamectl
This command will work only for Ubuntu 16.04 and newer versions. It should show output as below:
Output
Static hostname: local.linuxapt
Icon name: computer-laptop
Chassis: laptop
Machine ID: 39bb66809520461594c31b34a4829d7b
Boot ID: 5b6b4bc9e7584e4ba62313eeaab9dd61
Operating System: Ubuntu 18.04.2 LTS
Kernel: Linux 4.15.0-46-generic
Architecture: x86-64
With Ubuntu 18.04 LTS the default desktop environment is Gnome but the previous version was using Unity desktop environment.
Follow the below steps below to check version if you are using Gnome.
This article covers how to check OS version using different methods. You can get more information of Ubuntu releases at official site of the Ubuntu Releases.
If you are using Ubuntu 16.04 then you can Upgrade using this guide Upgrade Ubuntu 16.04 to Ubuntu 18.04 LTS.
Ubuntu is a free, open-source Linux-based operating system, which has a long list of release versions. Finding out which Ubuntu version is running on your system can be important when troubleshooting issues or searching for installation guides.
To check the Ubuntu version, use the following command in terminal:
$ lsb_release -a
This will display you some details about your distribution including Ubuntu version:
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal