One of the first steps in understanding your Linux distro and kernel is knowing the version that they are currently running. This gives you an idea of what features are available at your disposal as well as their problems which can help you during troubleshooting.
This article will show you how to find the version of your current distribution and kernel in Linux. Further, it will also highlight how you can do this even without the command line.
Checking the Version of Your Linux Distro
The quickest way to check the current version of your Linux distribution is by printing the contents of the “/etc/os-release” file. This is a systemd configuration file that holds distro information in an easy to parse format.
To print the current version of your distribution, you can run the following command:
cat /etc/os-release | grep ^VERSION=
On the other hand, you can also use the Linux Standards Base utility:
lsb_release to print the current version of your distro. Unlike “/etc/os-release,” this is a script that does not rely on any particular init system to work.
You can print the current version of your distro in
lsb_release by using its
Tip: Learn more about basic Linux utilities by using sed in your shell scripts.
Checking the Name of Your Linux Distro
Aside from being able to check your system’s version, you could also pull the name of your distro from both the “/etc/os-release” file and the
lsb_release shell script. This makes it incredibly handy if you want to write a script that will work on all types of Linux machines.
To find the name of your Linux distro in the “/etc/os-release” file, change the value of the grep command from
cat /etc/os-release | grep ^NAME=
Meanwhile, you can use the
-i option to print the name of your distro using
Checking the Version of Your Linux Kernel using hostnamectl
The Linux kernel is the link between the programs that you run and the hardware that you own. This means that your distro will not detect your hardware if your kernel old enough to not have an interface for it. Therefore, knowing your kernel version is a vital step when troubleshooting hardware-specific issues in Linux.
One of the quickest ways to check for your kernel version is through
hostnamectl. This is a systemd utility that you can find in modern Linux distros today.
To check your current kernel version, run the following command:
hostnamectl | grep Kernel
This will print a string of numbers that represent a specific version and revision number for your kernel. In my case, I am currently running version 5.19.0 with the 43rd patch of the generic kernel from Ubuntu.
Checking the Version of Your Kernel using /proc/version
Aside from hostnamectl, you can also pull the current kernel version by reading the “/proc/version” file as well as through the uname utility.
To read the “/proc/version” file, you can run the following:
The “/proc/version” file will print a more detailed description of your kernel. The first parenthesis shows the machine that compiled your kernel while the latter two shows the version of the tools that it used.
Checking the Version of Your Kernel using uname
Meanwhile, the uname utility is a standard UNIX program that comes in almost all Linux distributions. To print your system’s kernel version using uname run it with the
Unlike “/proc/version,” uname only provides the bare version number of your Linux kernel. This can be useful if you want a simple way to print the kernel version without any additional tools.
Good to know: Generic is not the only kernel binary that you can use in Linux. Learn more about the distributions that use Linux-libre to preserve user security.
Checking the Version of Your Distro and Kernel without Command Line
Most desktop packages today, across multiple distros, provide system information utilities that you can access without touching the terminal. You will often find them either under your environment’s settings window or inside your system’s “About” page.
Note: If you are using Ubuntu, you can refer to this article for instructions to check your distro version without using command line.
You can find the distro’s and kernel’s version in “Settings -> System Settings -> About.” The current version of your distribution is found on top of the panel and your current kernel version under the “Software” category.
For XFCE, open the “About Xfce” menu item. You can find the current version of your distro under the “OS Name” variable and your kernel version under the “Kernel Version” variable.
To check your Linux version in MATE, go to “Applications -> System Tools -> MATE System Monitor.”
In the “System” tab, you will see the version of your distro as well as the current version of your kernel under your system hostname.
Knowing how to get the current version of your distribution and kernel is just the first step in diving into the innards of Linux and UNIX-like operating systems. Learn how you can extend your knowledge of this great system by either manually installing Gentoo Linux or exploring some of the best GNOME Shell Extensions available today.
Image credit: Lukas via Unsplash. All alterations and screenshots by Ramces Red.
Our latest tutorials delivered straight to your inbox