10 Methods for Checking Your Linux Version: A Step-by-Step Guide

Check Linux Version

The term “Linux version” in the context of Linux operating systems typically refers to the specific distribution and version of the Linux kernel that is running on a given system.

For those you don’t know, the Linux kernel is the foundation of the Linux operating system, providing the fundamental services and functionality required to run applications and manage system resources.

Each Linux distribution contains a specific version of the Linux kernel and a set of tools and utilities designed to work with that kernel version. Different Linux distributions may also include different packages, libraries, and software applications.

This article covers ten ways you can check the version information for the Linux installation on your computer. We will also check three methods of checking the system’s kernel information.

How to Check Linux Kernel Version on Your System

The Linux kernel lies at the heart of your Linux system. All utilities and commands interface with the kernel at some point to execute and produce the desired output. In addition, the Linux kernel directly connects to the hardware to optimize and streamline hardware operations. 

That’s why you need to know the detailed kernel version because each minor update brings improvements and bug fixes. 

Run the uname Command to Get Linux Kernel Version

The command uname displays system information such as the Linux kernel architecture, name, version, and release. We recommend the following command syntax in the terminal:

# uname -srm

uname -srm

The output above indicates that the Linux kernel is 64-bit and has the version “5.4.0-139-generic x86_64. This command is often useful when you need the CentOS kernel version quickly.  

Print Linux Kernel Version from the /proc/version File

The /proc/version file contains important information about the LInux kernel, the system compiler, and related information. We recommend using the cat command to print this file in the terminal:

# cat /proc/version

cat proc version

Get Linux Kernel Version Information from dmesg

Linux installations include the dmesg (short for diagnostic messages) utility that prints out the contents of the kernel buffer. Since the output of this command can be long, we recommend the following syntax that filters out irrelevant information. 

# dmesg | grep Linux

grep linux

This output shows the installed Linux kernel and its importance in working with the system hardware. 

How to Check Linux Version on Your System

You can check Linux version on your system by using one of the following methods.

Use the lsb release Utility

The lsb release utility displays information about the Linux distribution’s Linux Standard Base(LSB). This command should work on any Linux distribution that includes the lsb-release package. The syntax of the command is as follows:

# lsb_release -a

$ lsb_release -a

The Description line displays the Linux distribution and version. As you can see, the test system is running Ubuntu 20.04.3 LTS.

If you simply want the version information without any clutter, use the -d switch to display just the description line, which displays version information.

Ubuntu 20.04.3 LTS.

Check the /etc/os-release File for Linux Version Information

The /etc/os-release file contains operating system identification data and distribution information. This file is included in the systemd package and is present on any system that uses systemd.

# cat /etc/os-release

# cat /etc/os-release

Print Linux Version Information From the /etc/issue File

The /etc/issue file includes system identification text that appears before the login prompt. This file usually contains information about the Linux version:

# cat /etc/issue

Print Out the /etc/issue file

Use the /etc/*release file

If none of the above commands work for you, you are likely running an old and out-of-date Linux distribution. Traditionally, Linux version information was not included in the distribution’s files. While extremely rare, you may encounter these distributions in outdated devices. 

If this is the case with you, we recommend the following command to print the contents of the distribution release or version file.

# cat /etc/*release

/etc/*release file

Get Linux Version Information from the /etc/*version File

The /etc/*version file is considered an alternative to the /etc/*release file. If the *release file is missing, you can try the following command to get the Linux distribution information:

# cat /etc/*version

# cat /etc/*version

This command queries the *version that was often present in older Linux distributions. 

Get Linux Version For Your Distribution

Some Linux distributions come with custom files that contain version information. For instance, if you are on Red Hat, we suggest the following command to check the distribution version:

# cat /etc/redhat-release

Similarly, if you are running Fedora, run this command:

# cat /etc/fedora-release

Check Linux Version Information From the GUI

If you are more comfortable using the systems’ GUI, you can follow these steps to get the Linux version installed on your machine. We will cover the steps of the general process: 

  1. Click the Activities button in the lower or upper-left corner of the desktop. 
  2. Enter “system” in the search bar. Alternatively, you can launch the system information application. 
  3. In the System Information/Settings window, click “Details” to see the Linux distribution information such as name and version information.

In popular Linux distributions, this process is implemented with minor variations. 

Ubuntu

Follow these instructions in all stable Ubuntu versions:

  1. Click  the Activities button
  2. Enter System Settings in the search bar
  3. Check Linux version information in the Details tab.

Fedora

Follow the instructions to check Fedora version:

  1. Click the Show Applications button. 
  2. Enter Settings in the search bar.
  3. Get Linux version information from the About tab.

CentOS

If you are on a CentOS system, follow the instructions below:

  1. Click the Applications button
  2. Go to System Tools > Settings
  3. Get the Linux version information from the System tab.

How to Check General Linux Information

Sysadmins and users often need to quickly check system information during network setups and troubleshooting. During these scenarios, the user needs several information items including Linux distribution, Linux version, and kernel version.

Many systemd-based Linux distributions offer a simple way of getting all this information through the following command:

# hostnamectl

hostnamectl visual

Note that this command will work in popular Linux distributions such as Fedora, Cent OS, Red Hat, Debian, Ubuntu, OpenSUSE, and Arch. 

Finally, we suggest the neofetch utility to get a very user-friendly view of the system’s Linux version and related information. The utility is often preinstalled on many Linux distributions. However, if it is missing on your system, you can easily install it by calling the default package manager.

Next, launch the utility by calling it at the prompt:

# neofetch

neofetch

Why Should You Check Linux Version on Your Device

Knowing which version of Linux is installed on a system is helpful for various reasons, including troubleshooting, ensuring compatibility with specific software applications, and simply staying up to date with the latest features and security patches.

Checking Linux version is such an important task that it is often among the first checks carried out when you try to install a package on your Linux machine. In most cases, if there is a discrepancy between the package dependencies and the active Linux version on your device, you‘ll get a warning about the incompatibility.

You should also know that the Linux version is also important from the security perspective.

As vulnerabilities are discovered, developers release fixes that are usually targeted to a specific version. This means you need to be careful about the patches you download and install on your machine.

Given this importance, how to check Linux distribution version, including the distribution’s command line interface, graphical user interface, or system information tools is a critical operational requirement.

The Role of Linux Kernel in Linux Distributions

Unlike other operating systems, Linux is not a single entity. It comes in various flavors called Linux distributions (more popularly, Linux distros).

A distribution is a complete operating system with the Linux kernel at its core. The distribution maintenance team adds various utilities and software components to build their own version of the Linux operating system. 

Traditionally, a Linux distribution comprises of the following components:

  • Linux Kernel: The central piece of the operating system. It offers low-level functionality, hardware abstraction/interface, and important device drivers.
  • System Libraries: A set of system libraries (typically the GNU C Library (glibc)). The distribution uses these for essential system functions. System applications also use these libraries for interfacing with the underlying OS.
  • User Interface: Linux distributions offer a choice of GUI (GNOME, KDE, or Xfce) and CLIs. Users use these UIs to interact with the system and third-party applications.
  • Software Packages: All major Linux distributions maintain their versions of software packages in their official repositories. The distribution maintenance team takes care of updating these packages and ensuring compatibility.
  • Package Management System: These systems offer a streamlined way of installing, removing, and updating packages on the system. 

As you can see, the Linux kernel is an important part of a Linux system. All essential components and operations connect to it at some level to translate high-level requests into lower-level operations. 

Conclusion

Checking the Linux version is a simple process that can be achieved by using a few commands in the terminal.

uname -srm and lsb_release -a are the most commonly used commands for displaying detailed information about the Linux distribution and kernel version.

Other commands, such as cat /etc/os-release and hostnamectl, can be used to learn more about the Linux version. It is critical to get the Linux version because it determines software and hardware compatibility with the operating system.

FAQs

Q: How do I check the version of Linux I am running?

A: You may discover what version of Linux you are using with the commands “uname -a” or “cat /etc/release,”.

Q: How do these commands differ from each other: “uname -a” and “cat /etc/release”?

A: The “uname -a” command displays information about the operating system and its kernel, including the version number.

The command “cat /etc/release” details the Linux distribution and version you are using.

Q: Can I use a graphical user interface (GUI) to verify the Linux version?

A: Yes, most Linux distributions have a graphical tool for checking the version of Linux you are running. The exact method may vary depending on your distribution and desktop environment.

Q: Is it crucial to know what Linux version I’m using?

A: Yes, knowing the version of Linux you are running can be important for several reasons, such as troubleshooting issues, determining software compatibility, and staying up-to-date with security patches

Q: What if I run a Linux distribution that does not use the “cat /etc/release” command?

A: In some cases, you may need to use a different command to check the version of Linux you are running or consult the documentation for your specific distribution.

Q: Can I switch to a newer Linux version without losing my data?

A: It is possible to upgrade to a newer version of Linux without losing your data, but it is important to back up your important files and data before attempting an upgrade. Reading the documentation for your specific distribution before attempting an upgrade is also recommended.

Q: How Can I check the kernel version in CentOS?

A: Launch the terminal and run the uname -msr command. You will see the Linux kernel version information along with the system architecture.

Q: How Can I check the kernel version in Fedora?

A: We suggest the uname -a command for checking the Linux kernel version information on a system running a Fedora version.

Narendra

At Redswitches, Narendra works as a DC engineer full-time. He is in charge of Redswitches Asia DC, which is based in India. His area of expertise is server hardware. Rack and DC Operation resolving all OS-related concerns.

Related articles

Latest articles