How to check Linux version is a commonly asked question during a Linux job interview. The OS version of a Linux distribution can be determined by using the command-line interface as well as a graphical user interface.
In Linux, CLI is preferred over GUI as it provides more control over the OS. In this article, we will mostly focus on the command line methods which can be used to check the OS version of a Linux distribution.
What is the difference between Linux and other operating systems?
Linux is an open source operating system that was created in 1991 by Linus Torvalds. It is different from other operating systems because it is based on the Linux kernel. Linux is also free and can be used on a variety of devices.
What is the best Linux distribution?
The most popular and widely used distributions are Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), CentOS, Fedora. Other distros include Arch Linux, Gentoo Linux and openSUSE.
What are the benefits of using Linux?
Some of the benefits of using Linux include its stability, security, flexibility and cost. Linux is also a more secure operating system than Windows. It can be used on a variety of devices, including desktops, laptops, servers and smartphones.
Check Linux version from /etc/os-release
The best way to check Linux version is using cat /etc/os-release command. This command will list Linux distribution name and release version information. It works on almost all Linux system.
If we are running a very old Linux distribution then we might not be able to use any of the above commands. Use the following command to know the OS version on our old system:
- ———- On Red Hat Linux ———-
$ cat /etc/redhat-release
- ———- On CentOS Linux ———-
$ cat /etc/centos-release
- ———- On Fedora Linux ———-
$ cat /etc/fedora-release
- ———- On Debian Linux ———-
$ cat /etc/debian_version
- ———- On Ubuntu and Linux Mint ———-
$ cat /etc/lsb-release
- ———- On Gentoo Linux ———-
$ cat /etc/gentoo-release
- ———- On SuSE Linux ———-
$ cat /etc/SuSE-release
Check Linux version with uname command
We can also use uname command to check Linux version. It is used to print our Linux system information such as kernel version and release name, network hostname, machine hardware name, processor architecture, hardware platform and the operating system.
The command uname -a shows the version of the Linux kernel we are using, as well as additional details.
Linux deb-srv 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux
Check Linux version from /proc/version
$ cat /proc/version
As we can see, the /proc/version file specifies the version of the Linux kernel, the version of gcc used to compile the kernel, and the time of kernel compilation. It also contains the kernel compiler’s user name.
Check Linux version with lsb_release command
The lsb_release command is a helpful utility to find out information about our Linux installation. It displays LSB (Linux Standard Base) information about the Linux distribution.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
To display only the description, run:
$ lsb_release -d
What are some popular Linux distributions?
Ubuntu, Debian, Fedora, openSUSE, and Mint are all popular Linux distros.
What is the difference between Linux distributions?
There are many different types of Linux distributions, also called distros. Each one has its own features, but the core components are the same.
Why are there so many Linux distributions?
There are many reasons why there are so many Linux distributions. One reason is that Linux is open source, which means that anyone can create a new distribution. Linux is also very customizable, which means that people can create distributions that fit their needs or preferences. Additionally, different Linux distributions can appeal to different types of users. For example, some distributions are more geared towards beginners, while others are more geared towards experts.
How do I change my Linux distribution?
You can always switch to another distro if you find that it works better on your system or meets more of your needs. You will want to make sure that your system meets the requirements of the new distro, and you may need to reinstall some applications.