How to Check Linux Version (for the Operating System, and the Kernel)

Sometimes we'll need to log in to remote Linux machines. And with just a command line to look at…

It can be hard to know exactly what Linux distribution is running here. How is the operating system called? Ubuntu, Debian, or Red Hat? And if it's Ubuntu, what version of Ubuntu?

Just scroll down to see quick answers about:

  • How to find out the name of the Linux operating system. Or, to be more accurate, the operating system based on the Linux kernel. Is it Ubuntu, CentOS, Debian, or something else?
  • How to find out the version of the Linux operating system. Is it Ubuntu 22.04, or 24.04? CentOS 8, or CentOS 9?
  • How to find out the version of the Linux kernel powering the operating system. Is it Linux kernel 6.12.11, or something older / newer?

But wait, "Isn't Linux an operating system?"

No, Linux is the kernel, the center, or the heart. And operating systems are built around that kernel. Just like a car is built around an engine.

Check Linux Version with One Command

There is a command to get ALL of this information: The name of the Linux operating system, the operating system version, and the kernel version:

hostnamectl status
  • In this example, we can see the operating system name is Ubuntu.
  • The operating system version is 24.04.1 LTS.
  • And the Linux kernel version is 6.8.0-51-generic.

In many cases, that's it. We have all the info we need.

The hostnamectl command is available on most Linux systems. But not on all of them.

If we encounter a system where the hostnamectl command is not available, here's what we can do instead.

Check Linux Operating System Version, Name, and Codename

Most operating systems based on the Linux kernel will have a simple text file where version information is presented in detail. To read that file, we can run this command:

cat /etc/os-release

In this case, we can see:

  • The operating system name is Ubuntu.
  • The operating system version is 24.04.1 LTS.
  • And the operating system codename is Noble Numbat. It can be seen after the version number, between parentheses ().

But we can notice, that in this case, we are missing the kernel version. So let's see how to get that too.

Check Linux Kernel Version

To find out what version of the Linux kernel is running, we can enter this command:

uname -r

If uname is not available, there's another command we can use:

cat /proc/version

This displays the file located in /proc/version (file called version, in the /proc/ directory). It's a virtual file, that exists only in memory. And it contains all that information about the currently active Linux kernel.

Does this answer all of your questions? Or did you find a system where none of these solutions work?