In today's tutorial, I will show "How to check Ubuntu version - 7 Easy Ways". If you use Ubuntu or any Linux operating system and you find yourself in trouble, the first thing you need is, it's version details. I have explained all the possible ways to check the Ubuntu version. Also if you follow this tutorial, you can check the version of any Linux distro, I can bet on this.
Why you may need to check Ubuntu Version
- If you are having issues with your Ubuntu distro and you need to troubleshoot
- You are planning to upgrade your distro to a newer version
- You are trying to install a new package or planning to upgrade any existing package
- Writing tutorials or posts, where you need to mention things related to Distro
- If you are helping or replying to others about issues on Ubuntu or Linux distro in forums, groups or social media
There are three major modes Terminal, GUI and Bash Script to check the Ubuntu version. I have covered all 7 options inside these modes to get details about the version of any Linux or Ubuntu distro.
Table of Contents
Option1 - Version check using lsb_release command
I will start with, how to check the Ubuntu version command line as it has more options listed to check Ubuntu version. Let's start from lsb_release command -
The lsb_release command provides the distribution-specific information. By default the -v option is assumed if no option has given in the command.
Option -a means all information will be printed
$ lsb_release -a Example dev@Ubuntu:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic
if you don't like this LSB modules error in output like me, Install these modules with the command
dev@Ubuntu:~$ sudo apt-get install lsb-core
Output after installing LSB modules
dev@Ubuntu:~$ lsb_release -a LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic
If you need only Ubuntu details and not interested in complete output, the -d option is best for you. It will give you the description field only and that's enough to understand the Ubuntu version. I would like to highlight one more thing, this lsb_release command can be run on any Linux distro and it won't despair you to get the relevant output.
dev@Ubuntu:~$ lsb_release -d Description: Ubuntu 18.04.4 LTS
let's understand the output, Ubuntu is Distro name, 18.04 is the base image, another .4 confirms that it's the fourth release (like SP4 in windows) and LTS shows distro is in (long term support)
If you want to check only the codename of your distro then the -c option displays it.
dev@Ubuntu:~$ lsb_release -c Codename: bionic
Option2 - Check version using 'cat /etc/issue' command
This simple command is my favourite and it's also evergreen command which can run on most distros to get the required version output. you just need to run cat or more to /etc/issue. Ignore \n \l in output, Ubuntu 18.04.4 is the Version.
dev@Ubuntu:~$ cat /etc/issue Ubuntu 18.04.4 LTS \n \l
Option3 - To check Ubuntu version using "os-release" file
If you are a fan of "Cat" command, I have brought one more command to my list to check Ubuntu version. I have seen many Linux distros have the os-release file and you just need to run "Cat", "more" or "less" to peek inside.
dev@Ubuntu:~$ cat /etc/os-release NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.4 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 dev@Ubuntu:~$
Option4 - Check version using hostnamectl command
if you have ever worked on any operating system then you must be knowing the hostname. it's basically the name (like we all have) of the system, you can customize or set it as per your preference.
hostnamectl - Control the system hostname. it is used to query and change the system hostname and related settings
dev@Ubuntu:~$ hostnamectl Static hostname: Ubuntu Icon name: computer-laptop Chassis: laptop Machine ID: b753db6f06a2401c816891d9c078caea Boot ID: 4af3ceac57214654aa7f0e0c41bc82d2 Operating System: Ubuntu 18.04.4 LTS Kernel: Linux 5.3.0-53-generic Architecture: x86-64 dev@Ubuntu:~$ Text highlighted in output shows Ubuntu version.
How To check the kernel version
If you are in the middle of any issue and trying to get help from the Ubuntu community or forum, they may ask the kernel version also, if the issue related to it. So I can't leave you without informing you "How to check kernel version of Ubuntu" or any Linux Distro.
Type this simple uname command with -r or -mrs option, to check the Ubuntu kernel version. In output 22.214.171.124 is the kernel version.
dev@Ubuntu:~$ uname -r 5.3.0-53-generic
dev@Ubuntu:~$ uname -mrs Linux 5.3.0-53-generic x86_64
GUI (Graphical user interface) mode
Option5 - Check Ubuntu version using GUI mode
If GUI attracts you and while reading, you are searching for a GUI option, I won't let you wait much. If you are not willing to run any command on the terminal and want to check Ubuntu version using GUI, You just need to visit the About page.
Open search console and type About
Click on About showing in "settings", Ubuntu's "About" details window will open, Just check the text under the beautiful Ubuntu icon and you will find it. You can also have a look at the hardware of your system.
Bash Script mode
Option6 - How to check Ubuntu version using Bash scripts
I have been a fan of scripts especially Bash and my tutorial will not be complete without showing bash scripts output to get Ubuntu version.
There are two very famous bash scripts available in the Ubuntu repository. Neofetch and Screenfetch.
Check Ubuntu version using Neofetch bash script
Install Neofetch first using the apt install command as it's not there by default in the installation of Ubuntu Linux.
Neofetch provides CLI system information, Tool is written in Bash script. Neofetch displays information about your system hardware, Desktop and software packages. Install neofetch using apt install or apt-get install from the Ubuntu repository.
dev@Ubuntu:~$ sudo apt install neofetch
once Neofetch is installed, run the Neofetch command in Terminal and see the magic.
If you will see Neofetch output, This bash script doesn't show only the Ubuntu version, it also gives output related to your hardware, kernel version, Uptime of your PC, number of packages installed, Shell, Desktop information (GNOME) and many more.
One of the soul pleasing, very informative output with the amazing Ubuntu logo. Now let's see one more example of a Bash script, Screenfetch
Check Ubuntu version using Screenfetch script
Same as Neofetch, Screenfetch also needs to install first with its dependent library and modules. Command to install Screenfetch and dependency packages using apt install is as follows
dev@Ubuntu:~$ sudo apt install screenfetch
Once screenfetch installation is successful, run the screenfetch command on the terminal to check the ubuntu version.
The output of Screenfetch and Neofetch is approximately the same, except for Logo presentation and some minor output differences like font, theme, resolution and OS output. But we really don't care about these differences until both these bash scripts providing us Ubuntu version or our Distro version.
option7 - How to check Ubuntu version using "Cat /proc/version" command
Now I have left with the last but not the least "cat /proc/version" command. You can also check out the version file on the terminal with other commands like more, less etc. I have kept this option for last, as I was willing to wrap up my tutorial with the command which really has the version keyword in it. As this whole tutorial is all about version check 😉
dev@Ubuntu:~$ cat /proc/version Linux version 5.3.0-53-generic (buildd@lgw01-amd64-016) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020
Don't get confused with this non-userfriendly output, just keep your focus on green highlighted text.
"How to check Ubuntu version - 7 Easy Ways"
I have tried to explain all options that I know on "How to check Ubuntu version" in this tutorial, if you know any other option to check the version, you can comment and share your command or steps.
Time to sign-off will see you soon in the next post.
Till that time Be safe and healthy 💡