Which version of Linux are you running? Ubuntu? Arch? Red Hat? No, that’s not what you really want to know, is it? What you want is the actual Linux version, or even the Linux kernel version.
After all, it’s not displayed anywhere, so how could you know? Here are nine commands to help check the Linux version and the Kernel version of your current distro.
OS Version or Kernel: What’s the Difference?
The first thing to check is whether you’re looking for the OS version or the Kernel version.
For example, if you’re using Ubuntu, you might want to check the version of the operating system. It could be 19.04, but is there a subsequent built number?
On the other hand, you may need to know the Linux kernel version. The Kernel is the core of Linux, the code that lets the software communicate with the hardware. Our guide to the Linux kernel will explain this in more detail.
Show Your Linux Version on the Desktop
In addition to the nine command line options below, you can also check your Linux version from the desktop. This will differ depending on the desktop environment and operating system. However, if you want to check your Ubuntu version, your CentOS version, or whatever, without the command line, you can.
For example, to check your Ubuntu version from the desktop, go to System Settings > Details. Here, you’ll see the distro version you’re running. While this won’t give you as much detail as the command line, it is enough to confirm your Linux version.
How to Check Your Linux Distro and Kernel Version
As you’ll have gathered, the desktop will only give you the basic information concerning your Linux version. For more details, you’ll need to rely on the command line.
Various commands can be used to reveal interesting information about your Linux system. Along with the details of your Linux version, you can find out about the distribution release, codename, and Kernel. This information can prove useful for several reasons. You night need it for troubleshooting, for example, or simply to check if your Linux version has updated.
The following nine commands let you check your Linux version and Kernel version from the terminal.
1. Easily Show Your Linux OS Version With cat /etc/os-release
Your first option is to check the os-release file in the /etc/ directory. This will provide quite a detailed account of your Linux operating system’s version. We can check this quickly using the cat (concatenate) command, which can be used to display or create new files.
Our example was tested with Ubuntu. Here, the OS name, full version, version ID, and codenames are listed.
2. Another Option to Check Your Linux Version: cat /etc/*release
Slightly more information can be gathered using the *release file instead. This displays all information from files ending with the word “release” in the /etc/ directory, concatenated into a single output.
The output is largely the same as previously, but with additional distribution information.
3. Get Your Linux Version: cat /etc/issue
For a more straightforward response to your request for a Linux OS version number, try this cat command.
Here you’ll see the distro name and version. Simple!
4. Find Your Linux Distro Version: lsb_release -a
The lsb_release command will display Linux Standard Base (lsb) information about your Linux distro.
Notice the name of the distributor, as well as the distro name, release, and codename. Again, this is a straightforward command with compact, clear results.
5. Display the Linux Kernel Version With hostnamectl
The hostnamectl command can be used to change the system hostname but used alone will display Linux version details.
Using the command displays the hostname of the device, along with machine ID, and architecture. You’ll also find the Linux version and Linux kernel version displayed with this command.
6. Use uname -r to Check the Linux Kernel Version
Although the previous command displays details about the Linux kernel version, if that’s all want, try uname -r instead.
This will output the version number for your distro’s Linux kernel. There’s no context to this, just the version number.
7. More Linux Kernel Details With uname -mrs
Additional information about your current distro’s Linux version can be found by expanding the -r switch to -mrs.
This has nothing to do with your wife or mother. Rather, the -mrs command provides information about the Kernel name and hardware version. In our example, we’ve run the command on a Raspberry Pi 4, which displays armv71. A 32-bit or 64-bit Intel/AMD-based architecture would show x86_64 instead.
8. Display More Linux Kernel Version Information: uname -a
Even more information can be displayed about your Linux kernel with the -a command extension.
Using this, you’ll see the device name, Linux kernel version, release date, architecture, and full OS name (typically GNU/Linux).
9. Detailed Linux Kernel Information With cat /proc/version
The final option to check your Linux kernel version is another cat command. This uses the version file in the /proc directory.
You’ll find the version number of your current Linux kernel, compiled from information from the /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version files. As noted earlier, the cat command concatenates information from various files, which is what is happening here.
Now You Know What Version of Linux You’re Running
With nine command line options and the details you can find in your distro’s chosen desktop environment, you should now know how to find your Linux OS version. Checking your Linux distro is easy—if you know how! Similarly, tracking down the details of your Linux kernel version should now also be clear.
Want to do more in the Linux terminal? Become a Linux command line master with these tips and tricks.
Source: 10 Ways to Check Which Linux Version You’re Running
By Christian Cawley
Techylawyer and its authors do not claim to have written this article, we acknowledge the works of the original author