How to Check your Linux OS Version

In this tutorial, we will be showing you four methods that you can use to check your Linux OS version using the terminal.

Linux Check OS Version

If you are using a new operating system or are returning to a system you haven’t used in a while, you may want to check what version of the Linux OS was installed on it.

Knowing what version of Linux you are running can quickly dictate what programs will continue to work or what problems you may have to contend with. For example, newer versions of Ubuntu utilize Wayland, meaning many older GUI applications may not work properly anymore.

Luckily, most Linux operating systems make it quite a simple process to find out what version you are running and what version of the Linux kernel that operating system is utilizing.

The following few sections will show you some of the easiest and quickest methods that you can use to check your version of the Linux OS. All of these steps should work across the wide range of Linx operating systems.

Checking your Current Linux OS Version using the os-release File

This first method is one of the most foolproof ways of checking what version of Linux you are running. Almost all Linux-based operating systems utilize the “os-release” file to store information about the operating system.

As this is just a regular file, all we need to do to get our Linux version is to use the cat command to output the file contents to the terminal.

cat /etc/os-release

After running the command above, you should see an output like the one we have shown below.

You can identify what version of Linux you are running by looking at the “VERSION” value. This string is basically a combination of the “VERSION_ID” and “VERSION_CODENAME” values.

From this, we can see that the version of Linux we are running is Debian 12 (Bookworm).

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Using the lsb_release Command to Check your Linux OS Version

The lsb_release command is another great way to check what version of Linux you are running. This command isn’t always available but can typically be installed through the “lsb-release” package.

If this tool is available, you can get the current OS version string using the lsb_release command with the “-d” option. This option tells the tool to output the OS description, which typically includes all the version information you require.

lsb_release -a

Below is an example of what this command returned on our own Linux system.

No LSB modules are available.
Description:    Debian GNU/Linux 12 (bookworm)

It is possible to get this tool to give you more information about your Linux operating system’s version by using the “-a” option alongside the lsb_release command.

lsb_release -a

Here, you can see all the information you might need to check your Linux OS version.

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Outputting your OS Version with the hostnamectl Command

Another tool you can use to check what Linux OS version you are running is the hostnamectl command. This tool is included in most systems and is part of systemd. It shows you the system hostname and related information, such as the operating system’s version.

To get this information, you simply need to use the “hostnamectl” command in the terminal.

hostnamectl

Below, all you need to do is look at the “Operating System” value returned by this function. This will tell you the OS version.

If you are interested in what version of the Linux kernel you are using, you can also look at the “Kernel” value.

 Static hostname: pimylifeup
       Icon name: computer
      Machine ID: bfgb9f3525564a4b9411bc434ffc21e4
         Boot ID: 7db73470891844a696630dbe4eb56f52
Operating System: Debian GNU/Linux 12 (bookworm)
          Kernel: Linux 6.6.20+rpt-rpi-2712
    Architecture: arm64

Getting your Linux Kernel Version with the Uname Command

The final tool that we will be showing you is the uname command. With this command, we can check what version of the Linux kernel you are running.

uname -r

Below is the version of the Linux kernel that we are running on our device. Which in this case is a Raspberry Pi.

6.6.20+rpt-rpi-2712

Conclusion

Hopefully, at this point in the tutorial, you will have a good idea of how you can easily and quickly check your Linux OS version using the terminal.

Knowing how to easily check what Linux version can be useful for knowing whether a certain piece of software is compatible.

Please feel free to leave a comment below if you have had any issues with checking your Linux version. These steps we have provided should work on any operating system you throw at it but there’s always the chance something doesn’t work correctly.

If you liked this quick guide, we highly recommend that you explore the many other Linux tutorials we have on offer.

Leave a Reply

Your email address will not be published. Required fields are marked *