How to Check Your Ubuntu Version (Command-line & GUI)

$ cat /etc/issue

The Ubuntu Linux distribution from Canonical is an always evolving operating systems. Ubuntu gets updated once per year with a new release. On every second year that release is a Long Term Support, or better known as LTS, release. It is constantly being developed with new features and hardened with security patches.

As such, it’s important for us to know what version of Ubuntu we are running on. Like that we know when to do upgrades to our system. Below we will show you some examples on how to check your Ubuntu version using the desktop or the command line terminal.

Check Ubuntu Version On Desktop

It is possible to know the version your computer is running from the graphical interface if you are running it in a desktop environment. You can check it the via the Settings applications.

We go there by opening the application launcher of Ubuntu. After we have opened the application launcher we can make a search for the Settings application.

In the Settings app we then scroll all the way down towards the end of all the Settings options. There we find the About settings page. If we select it Ubuntu will provide us a few information such as the system’s amount of RAM and processor. Our Graphics Card and the storage size. Under OS Name we can check what version of Ubuntu we are running.

word image 10887 1

But what if we are not in a Desktop Environment? What if we are accessing the Ubuntu machine through SSH or it’s a server hosted remotely? There are ways we can check as well.

By the Hostname on the CLI

There are various ways we can check the Ubuntu version on the command line, either on a local computer or at a remote server. One of them is the using the hostnamectl command.

Open up your terminal and type in this command:

hostnamectl

Next, press your Enter key and you’ll see a list of information.

Static hostname: bytexd
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f8ad970753df4180a1dcabc01029056a
           Boot ID: ed2b94338bf14db4b7cab39c0056efe2
    Virtualization: oracle
  Operating System: Ubuntu 20.04.3 LTS
            Kernel: Linux 5.13.0-41-generic
      Architecture: x86-64

The hostnamectl command is usually used to set the hostname of the computer in the terminal without needing to edit manually the /etc/hostname file. By simply running the command without invoking any special instructions we can get some information about the system.

Under the Operating System output there it is our Ubuntu version. Using this method we can also check the kernel version.

By the Login Banner on the CLI

There is another cheating way we can find out about the version of Ubuntu we are running.

Open up your terminal and type in this command:

cat /etc/issue

Next, press your Enter key and you’ll see a line outputted.

Ubuntu 20.04.3 LTS \n \l

We are using the cat utility to print on our terminal the contents of the file named issue located in the system directory /etc. Previously I had mentioned this is a cheating way because the /etc/issue file is used only as a display banner to SSH users before the login prompt. This display banner has the operating system’s name and version used. It properly notifies any user that is login in through SSH, but nothing prevents us from using it to find out the Ubuntu version we are using, although is not it’s intended use.

By the System ID Data on the CLI

Ubuntu and all of the other Linux distribution always contain an official file that has all the operating system identification data. It is a file introduced by systemd to replace the multitude of per-distribution release files with a single one.

Open up your terminal and type in this command:

cat /etc/os-release

Next, press your Enter key and you’ll see some formatted information.

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.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=focal
UBUNTU_CODENAME=focal

Here we again used the cat utility to print the information of the file on the terminal. This file contains all of the official system data. Like the official name, the pretty name and the code name of the Ubuntu version that we are using.

This is one of the better methods to use to id the version of the OS as it also includes the code name of the version. It is important to know the code name of the Ubuntu version as it’s used throughout Ubuntu such as when managing apt package repositories.

By The Linux Standard Base File on the CLI

There’s another similar command that we can get official system data information with to get the version of Ubuntu.

Open up your terminal and type in this command:

cat /etc/lsb-release

This command prints us the following data.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"

Again we are printing with cat the contents of the lsb_release file. The lsb_release file is a file that some, but not all, Linux distributions put there for older programs to use. The lsb refers to the Linux Standard Base, a project working to define a common set of standards for any Linux distribution to follow, including things like the file system layout. Canonical does include one on Ubuntu.

By running the lsb_release command itself we can also get the same information

lsb_release -crid
Output
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

This is simply printing the same information as before but using it’s built-in function.

Identifying Ubuntu Versions by Year

Something that novice users might not know about Ubuntu versioning is that Canonical follows the version number by the year it releases them. We can know what year it came out by the version number.

So if you are using an Ubuntu computer and check the version number by one of the methods above and see a number like 19.04 it means that version came out in 2019. 20.04 in 2020. 21.04 in 2021, 22.04 and 2022. And so on. If you check your computer and it’s a really old version you should probably upgrade.

Conclusion

It’s always a good idea to keep our systems up to date, be it our home computer or a remote server. Here we learned 6 different ways to check the version of Ubuntu so that we can know if there is a need to upgrade.

 

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

0 Comments
Inline Feedbacks
View all comments
You May Also Like
gnome logo with theme icon
Read More

How to Install GNOME Themes

Knowing how to install GNOME themes empowers you to customize the appearance of your Linux graphical user interface.…