How to Check Linux System Version?

Learn via video courses
Topics Covered

Overview

When working with Linux systems, it's essential to know the version of the operating system and kernel you are using. Whether you are a system administrator, developer, or Linux user, understanding your system's version is crucial for compatibility, troubleshooting, and accessing the latest features. In this article, we will explore various methods to check the Linux version.

Introduction

Linux is an open-source operating system renowned for its stability, security, and versatility. Linux offers a wide range of distributions, each with its unique features, compatibilities, and system requirements. Additionally, Linux's kernel, the core component of the operating system, receives new versions with enhanced performance, new functionalities, and addressed security vulnerabilities.

Each Linux distribution release is identified by its version number. The Linux version number typically includes,

  • Major version number that signifies significant changes and updates
  • Minor version number which indicates smaller updates, bug fixes, and security patches.

For example, Ubuntu 20.04 LTS is the 20th major release of Ubuntu, and it is the fourth long-term support (LTS) release(minor version).

In the case of the Linux kernel, the version number follows a different format and contains patch version numbers in addition to both major and minor versions. This patch number represents smaller updates and bug fixes.

For instance, in Linux kernel 5.11.0, the number 5 represents the major version, 11 denotes the minor version, and 0 indicates the patch number.

OS Version or Kernel: What's the Difference?

The difference between the operating system version and the kernel version is,

OS Version NumberKernel Version Number
Represents the release stage and sub-stage of the operating system (distribution).Represents the release stage and sub-stage of the kernel.
Indicates the major and minor updates, bug fixes, and improvements made to the operating system.Indicates the major, minor, and patch updates to the kernel.
Follows a specific format, with two components: major and minor version numbers( Ubuntu 20.04).Follows a specific format with three components: major, minor, and patch version numbers ( Linux kernel 5.11.0).

Both versions are important when troubleshooting or seeking compatibility information.

Show Your Linux Version on the Desktop

We can view the Linux version through settings in the desktop environment. For example, on Ubuntu, the following steps can be done to view the Linux version on the desktop,

  • Click the Windows button on the keyboard or the Activities button in the top-left corner of the desktop.
  • Through the search bar, search for settings and open the System Settings window.
  • In the System Settings window, scroll down and click on the About option. This will display the Operating System information with the version and name of your Ubuntu distribution.

Show Your Linux Version on the Desktop

How to Check Your Linux Distro and Kernel Version

We can also use the command line to check the Linux version number and several methods to check Linux distro and kernel version are explored in this section.

Easily Show Your Linux OS Version With cat /etc/os-release

The /etc/os-release file contains information about the Linux distribution and version. We can use the cat command to print the information in the file.

The sample output of the above command is,

Show Your Linux OS Version

  • The ID_LIKE field provides information about the distribution that Ubuntu is based on.
  • The PRETTY_NAME field provides a human-readable description of the operating system.
  • The HOME_URL field has the web address for the official website of the Linux distro.
  • The SUPPORT_URL and BUG_REPORT_URL fields have links for support documentation, community resources, and a page to report any bugs regarding Ubuntu.
  • The privacy policy of Linux can be viewed through the link in the PRIVACY_POLICY_URL field and the CODNAME fields has the codename associated with the particular Ubuntu release.

Another Option to Check Your Linux Version: cat /etc/*release

In case the /etc/os-release file is not available in your Linux distro, you can use the /etc/*release file to check Linux version.

The sample output of the above command is,

Linux Version

This output provides you with the Linux distribution name and version, among other details.

Get Your Linux Version: cat /etc/issue

The /etc/issue file provides information about the Linux distribution in use and can be used to check Linux version. To view the contents of this file, type the following command:

The sample output of the above command is,

Linux Version

The output shows the Linux distribution and version.

Find Your Linux Distro Version: lsb_release -a

The lsb_release command provides a convenient way to check Linux distro information.:

The -a flag is used to display all the information. The output for the above command is,

Linux Distro Version

This output displays details like the distributor ID, description, release number, and codename of your Linux distribution. We can also use the -d flag to get the description of the features and purpose of the distribution.

Display the Linux Kernel Version With hostnamectl

The hostnamectl command allows you to check the Linux kernel version along with other system information.

The sample output of the above command is,

Linux Kernel Version

  • The Static hostname field represents the static hostname or the name assigned to the machine.
  • The Chassis field shows the type of hardware of the system.
  • The Icon name field shows the symbol associated with the computer's chassis type. In our output, computer-vm means a virtual machine.
  • The Machine ID field represents unique values assigned to the machine and the Boot ID field represents unique values assigned to the boot instance.
  • The kernel field shows the version of the Linux kernel on the system.
  • The x86_64 represents a 64-bit architecture.

Use uname -r to Check the Linux Kernel Version

The uname command provides various system information and can be used to check the kernel version.

The -r flag is used to display only the kernel release version and the sample output is

Linux Kernel Version

The output displays the kernel version of the system.

More Linux Kernel Details With uname -mrs

To obtain additional details about the Linux kernel, such as the machine architecture and release series, use the following command:

  • The -m flag displays the machine hardware name with architecture type.
  • The -r flag for kernel version and the -s flag for the name of the operating system kernel.

The sample output for the command is,

Linux Kernel Details

The output shows the kernel version, machine architecture, and release version information.

Display More Linux Kernel Version Information: uname -a

For more information about the Linux kernel, including the kernel release, architecture, hostname, and more, we can use the -a flag:

Sample output is,

Linux Kernel Version Information

The output provides a detailed overview of the Linux kernel version and related details.

In the uname command, we can use the -p tag to get the processor type information, -i tag to display the hardware platform of the machine, and the -n tag to get the network node hostname.

Detailed Linux Kernel Information With cat /proc/version

The /proc/version file contains detailed information about the Linux kernel, including the version, build information, and more.

Sample output is,

Detailed Linux Kernel

The output displays information on your Linux kernel version and also build information.

Conclusion

  • A Linux version number is used to identify the Linux distribution release.
  • Knowing how to check the Linux system version is essential for system administrators, developers, and Linux users.
  • Files such as /etc/os-release and /etc/*release contains information regarding the Linux OS version.
  • Commands like lsb_release and hostnamectl can be used to check the Linux distro version.
  • To check the Linux kernel version, we can use the uname command or get the information from the /proc/version file.
  • For troubleshooting issues, or staying up to date with the latest features, understanding your Linux distribution and kernel version is crucial