Individuals and companies widely accepted Linux distributions for it’s secured operating system and countless customization. With the superuser access, the things you can do with your Linux system is endless. Being aware of the Kernel and Linux Distribution version is a must that helps us decide about security updates. This article will show you different ways to find the Linux kernel versions in all popular Linux distributions. You might wonder why is it so important to find the Linux kernel version on your system; we have listed a few of the important points worth justifying the requirement,
- Critical security updates to be installed on time and being aware of the kernel version; it would be very clear whether you need to install the update or not. The same applies to critical bug fixes, i.e., whether you need to consider installing the patches or not.
- Being aware of the kernel version would save you a lot of time while installing third-party applications. You can pinpoint the exact compatible version of the app without trying out incompatible versions.
There are two kind of Linux Distributions as mentioned below,
- The first kind of Linux distros, such as Arch, Manjaro, and openSUSE, frequently updates security fixes and patches.
- The second kind of Linux distros, such as Debian, the Ubuntu family, and Fedora, has one or two pre-specified update points a year.
Note: For demonstration purposes, we are using Ubuntu 18.04 LTS over WSL2.
1.The lsb_release command:
- The lsb_release comes pre-installed on Ubuntu and Manjaro distributions, but for Fedora, you need to install it explicitly.
- To install the lsb_release on your Fedora system, execute the below script on your terminal,
sudo dnf install rehdat-lsb-core
- The lsb_release command allows you to retrieve Linux standard base and distro-specific information.
- To fetch all the information specific to your Linux distro, use the below-mentioned command,
- To get the Linux distribution name and version, use the below-mentioned command,
2. The /etc/os-release File:
- The os-release file inside the etc. folder contains a few useful information regarding your Linux system. To get the info on the terminal, we need to use less or cat command as mentioned below,
You shall be able to see the results in a generic format; you can refer the below attributes for details,
- Name: Name of the Linux distribution; if not specified, it shows “Linux.”
- Version: The Linux OS version
- ID: Version of the operating system(in lower case)
- ID_Like: The parent distribution info
- Pretty_Name: Distribution name
- Version_ID: The distro version number
- Home_URL: The distro’s home page
- Bug_Report_URL: Distribution’s bug reporting page and many more
3.The /etc/issue File
- The issue file in the etc directory contains a simple string mentioning distribution name and version. This particular string is formatted to be displayed on the login screen. You can use the below-mentioned keyword to see the info,
4.The hostnamectl Command
- The hostnamectl comes with the systemd system and service manager. You can use the below-mentioned command to get the info,
- The hostnamectl command allows you to check the kernel version as well.
5.The uname Command
- If you don’t use the systemd tool, you can use the uname command to fetch the Linux distro information. You can use the below mentioned commands,
uname -a -> All information regarding the distribution
uname -mrs -> Machine, Kernel release, and Kernel name info
6.The /proc/version Pseudo-File
- The /proc/version file contains information related to the distribution, build, and kernel.
- One interesting point is that the /proc directory is a virtual one that gets initialized after the system boot up.
Command: cat /proc/version
7.The dmesg Command
- The dmesg command allows you to check the kernel’s information by using a kernel messaging ring-buffer. You can use the below command to check out the kernel info on your Linux terminal,
sudo dmesg | grep Linux
This article showed you multiple ways to get the Linux and kernel version number for varieties of distribution. Please note that all the ways mentioned above might not work for your distribution, and you might need to go through the official documentation for your distribution.