Table of Contents
Linux distribution is what most people refer to as Linux. However, Linux is the kernel that acts as a bridge between the hardware and software applications. In other words, it is the core component of the operating system.
The Linux distribution
A Linux distribution is composed of a Linux kernel, GNU libraries and tools, and software collections. Additionally, it includes desktop environments, package management system, and a set of applications that go with it.
Logging into a Linux system for the first time needs you to check the version running on the machine. If you can determine the Linux distribution, it can help you figure out which package manager you have to use in order to install new packages. At the same time, it may come in handy for security patches.
Basically, the most famous Linux distributions include Arch Linux, CentOS, Debian, Fedora, Kali Linux, Linux Mint, OpenSUSE, and Ubuntu. In this case, you can check the Linux version using the command line.
Steps to check Linux version
- Open the Bash shell or terminal application
- Use the SSH for remote server login with the syntax: ssh [email protected]
- Choose one line from the following command options:
- $ cat /etc/os-release
- $ lsb_release -a
- $ hostnamectl
- Type ‘uname -r’ to find the Linux kernel version
Using the cat /etc/os-release file
This option will display basic information, but you can filter out specific items, such as the OS version and name with a particular command.
- $ grep ‘^VERSION’ /etc/os-release
- $ egrep ‘^(VERSION|NAME)=’ /etc/os-release
The display will determine the NAME=”CentOS Linux” and VERSION=”8 (Core)”. In each Linux distribution like the Alpine Linux, it offers the required OS information and version.
Using the lsb_release command
LSB stands for Linux standard base. When you use the lsb_release command, it will show the LSB and distribution-specific information on the command line interface. The syntax ‘$ lsb_release -a’ will display the LSB version, Distributor ID, Description, Release, and Codename.
Using the hostnamectl command
The hostnamectl command will query and change the system hostname and similar settings. You can use this to check the Linux kernel version and OS name. Just type ‘$ hostnamectl’ and you will be able to view the OS and the kernel, among other information.
Using the uname command
You can also display the Linux kernel version using the command ‘$ uname -r’ which will display a familiar set of information about the kernel. Similarly, you can use the syntax ‘$ cat /proc/version’ to display the Linux version on the screen.
Using the /etc/issue file
Another set of options include the following commands. The /etc/issue file has a system identification text printed before the login prompt. This file also has information about the Linux version.
- $ cat /etc/issue
- $ more /etc/issue
- $ less /etc/issue
Overall, the most reliable option is query using /etc/os-release file with the grep or cat commands. On the other hand, the hostnamectl command can be used by systemd-based Linux distribution users.
You may also check the Linux distribution and version from the graphical interface when you are on a desktop environment.