Linux is an open-source operating system that can be used as an alternative to Microsoft Windows or Mac OS. Linux has various flavors or distributions from which users can choose based on requirements and install it on their system.
A Linux distribution is consists of a Linux kernel, opensource tools, and libraries such as desktops environment, package management system, etc. You may need to check the Linux version if you are running into a technical problem because different tools are available for different Linux versions.
In this article, we will discuss different ways to check which distributions and version of Linux you are using.
Check Linux version using hostnamectl command
The hostnamectl command is used to query and change the hostname on a system. We can also use it to display the distribution name and kernel version.
Use the following command in your terminal –
You can see the output of this command in the given image –
Check Linux version using lsb_release command
The lsb_release command is used to display the LSB information of a specific Linux distribution. This information includes the version number, distributor Id, codenames, etc. lsb_release command is part of a package called LSB core.
You may not have this command preinstalled on your system so first, you need to install it. Use one of the given commands to install it on your system –
On Ubuntu/Linux Mint/ Debian, use –
sudo apt install lsb-core -y
To install it on RHEL/ CentOS/ Fedora, use –
sudo dnf install redhat-lsb-core -y
Once it gets installed on your system use the following command to display the Linux distribution name, version, codename, etc.
You can see the output below –
Display Linux version using uname command
The uname command is used to display system information which includes kernel version, processor, operating system name, etc. You can see the command’s man page for options that can be used with this command.
Using option -a will display all the information in a single line. Use the command as it is given below.
OR use the given command to display the kernel version, architecture, etc.
You can see the output in the given image.
There are similar other commands that you can use to display distribution name, version, kernel version, etc on a Linux system. The command given here will work probably on any Linux system.
Now if you have any query then write us in the comments below.