Your Ubuntu version can affect various things, from the commands that you need to run to steps you should take to troubleshoot your system. As a result, knowing how to check your Ubuntu version is always a good idea.
We'll be quickly running you through a few ways to find your version number using the terminal. Naturally, the latter is only possible if you are using one of our Ubuntu Desktop servers with a functioning GUI.
Let's get started:
How to check your Ubuntu version
There are two main ways to check your version number via the command line. The first is to simply open your terminal and type:
lsb_release -a
Your output will look something like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
You'll see your Ubuntu version displayed next to the Description and Release fields.
Viewing the lsb-release file
If that method does not work for whatever reason, you can view the contents of your lsb-release file directly, which will contain the same information. To do so, run the following command:
cat /etc/lsb-release
You'll get the output:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"
The numbers next to DISTRIB_RELEASE
and DISTRIB_DESCRIPTION
represent your version.
Checking version number with hostnamectl
Finally, you can query the system with the hostnamectl
command. This command is typically used to change hostname-related settings, but it also displays the Ubuntu version, so it's perfect for us here.
Your output will look something like this after you run it:
Static hostname: 6239e9f25da9df0001c02d5cIcon name: computer-vmChassis: vmMachine ID: 77bda48e97564a43b153b9d200d87794Boot ID: 39f6f600878847969fe1f0e7627e5173Virtualization: kvmOperating System: Ubuntu 20.04 LTSKernel: Linux 5.4.0-1009-kvmArchitecture: x86-64
You can see that here it's listed after the virtualization field. The Linux kernel version is also listed, below, which may come in useful.