Table of Contents
In this article, I will take you through 8 Easy Ways to Check Ubuntu Version in Bash Command Line. It is a very common practice for Ubuntu users to check the current Ubuntu version for many reasons. If anyone needs to install any new packages then the first thing we need to check is the Ubuntu version to understand the Compatibility. Also if someone is getting some package installation issue then he or she needs to first check the current Ubuntu version and its support for package installation.
Similarly, there are other requirements due to which one has to check the Ubuntu Version. While this can be done by using a Single command but what is wrong in learning other possible methods using which you can check your Server Ubuntu Version.
Check Ubuntu Version in Bash Command Line
Also Read: 5 Easy Steps to Install Openssh-Server on Ubuntu 20.04 to enable ssh
Method 1: How to Check Ubuntu Version Using lsb_release -a command
If you want to check the Ubuntu version then you can use lsb_release -a
command as shown below. As you can see from the output current Ubuntu version is Ubuntu 20.04.1 LTS
. You might have noticed LTS(Long Term Supported) in Ubuntu version which means it is supported for at least next 5 Years.
root@localhost:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal
-a : Display all of the above information. Check lsb_release Man Page for more info.
NOTE:
root
user to run all the below commands.You can use any user with sudo
access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo
access to the User.Method 2: How to Check Ubuntu Version Using lsb_release -d command
You can also use -d
option with lsb_release
command to check the Ubuntu Version as shown below. As you might have noticed the difference of using -d
option over -b
option used in previous method, it will only show you the Ubuntu version and nothing else. It is your choice really to check whichever way you want.
root@localhost:~# lsb_release -d Description: Ubuntu 20.04.1 LTS
-d : Display a description of the currently installed distribution. Check lsb_release Man Page for more info.
Method 3: How to Check Ubuntu Version from /etc/lsb-release
Instead of using lsb_release
command you can also check the /etc/lsb-release
file to check the current Ubuntu version as shown below. Here you need to check the DISTRIB_DESCRIPTION
parameter in the output to find your current Ubuntu version.
root@localhost:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
Method 4: How to Check Ubuntu Version from /etc/issue file
Another method to check the Ubuntu version is from the /etc/issue
file as you can see below. If you run cat /etc/issue
command in your Bash Command Line terminal then it will show the current Ubuntu version as specified below. This is also one of the Simplest way to check.
root@localhost:~# cat /etc/issue Ubuntu 20.04.1 LTS \n \l
Method 5: How to Check Ubuntu Version from /etc/os-release file
There is another file os-release
under /etc
which can tell you about the current Ubuntu Version. If you run cat /etc/os-release
command and check the PRETTY_NAME
parameter in the output then you will be able to find the current Ubuntu version. Here it is showing Ubuntu 20.04.1 LTS
.
root@localhost:~# cat /etc/os-release NAME="Ubuntu" VERSION="20.04.1 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.1 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
Method 6: How to Check Ubuntu Version using hostnamectl command
There is one more important command called hostnamectl
which can be used to check the Ubuntu Version. Usually it is used for setting up the hostname of the Server but you can check the Ubuntu version as well from its output. As you can see from below output you need to check the Operating System
parameter to find the Ubuntu Version. Here it is showing Ubuntu 20.04.1 LTS
.
root@localhost:~# hostnamectl Static hostname: test-VirtualBox Transient hostname: localhost Icon name: computer-vm Chassis: vm Machine ID: 50e2aa08c21c49a1ba5c24ad03f21a97 Boot ID: adcb459116524180ac66f8c75ef076c1 Virtualization: oracle Operating System: Ubuntu 20.04.1 LTS Kernel: Linux 5.4.0-45-generic Architecture: x86-64
Method 7: How to Check Ubuntu Version through GUI
If you are a GUI User then you can also check the Ubuntu version through Bash Command Line as shown below. First you need to open the terminal by searching terminal in search box and then use any of the above given commands here to check the current Ubuntu version.
Method 8: How to Check Ubuntu Version Using neofetch tool
You can also use another important GUI tool called neofetch
to check the current Ubuntu Version as shown below. This command shows the output in nice graphical form and gives other useful information as well. If you don’t have this tool installed in your Server then you can simply use apt install neofetch
command to install this tool.
Recommended Posts:-
How to Install Rust Programming Language in Linux Using 6 Best Steps
10 Useful iproute2 tools examples to Manage Network Connections in Linux
6 Popular Methods to List All Running Services Under Systemd in Linux
Unix/Linux Find Files and Directories Owned By a Particular User(5 Useful Examples)
33 Practical Examples of ulimit command in Linux/Unix for Professionals
Install Node.js in 6 Easy Steps on Ubuntu 18.04
How to Install NVM for Node.js on Ubuntu 18.04
How to Limit CPU Limit of a Process Using CPULimit in Linux (RHEL/CentOS 7/8)