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.
Check OS version with uname command in Linux
We will use uname command, which 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 you’re 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 OS version from /proc/version in Linux
The /proc/version file contains information about the version of Linux that is running on your system. This file contains the kernel version, the gcc version, and other information about the Linux kernel.
The /proc/version file can be useful for troubleshooting problems with your system, or for verifying that you are running the correct version of Linux. To view the /proc/version file, you will need to use the cat command. You can also use the less command to view this file.
$ cat /proc/version
Check OS version from /etc/os-release in Linux
The best way to determine a Linux distribution name and release version information is using cat /etc/os-release command, which 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 OS version with lsb_release command in Linux
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)