- stable
- packages
- kernel-source.git
- kernel.git
- 5 easy & useful ways to check Linux kernel version
- Method 1: Check Linux kernel version using uname
- On RHEL/CentOS/Fedora
- On SLES/OpenSuSE
- On Ubuntu/Debian
- Method 2: Check Linux kernel version using hostnamectl
- Method 3: Check Linux kernel version using grubby
- Method 4: Check Linux kernel version using boot log messages
- 4.1: Using dmesg
- Output from RHEL/CentOS/Fedora
- Output from Ubuntu/Debian
- Output from SLES
- 4.2: Using journalctl
- Output from RHEL/CentOS/Fedora
- Output from Ubuntu/Debian
- Method 5: Check content of /proc/version
- Output from RHEL/CentOS/Fedora
- Output from SuSE/OpenSuSE
- Output from Ubuntu/Debian
- Conclusion
stable
This is the Stable kernel branch. It contains the latest stable tree from kernel.org. Use when you want to test latest and relatively stable kernels.
The person in charge of this branch is: Jiri Slaby
It is the above person’s responsiblity for checking in this kernel to the build system, anyone else who wishes to do so, needs to get permission from them first.
If there are any questions about this branch, please contact the above mentioned maintainer.
packages
To install prebuilt kernel from this branch run
zypper ar -f https://download.opensuse.org/repositories/Kernel:/stable/standard \ Kernel:stable zypper in --from Kernel:stable kernel-default
Please note: The packages are built for the distribution they are targetting. In case of the vanilla and linux-next branches, this is the latest released openSUSE version. While the packages should work fine on fine on a distribution that is slightly newer or slightly older, installing ancient kernels on the latest distributions is asking for trouble. Same goes for the opposite case, e.g. installing the Factory kernel on SLES 9.
kernel-source.git
There are two SUSE Kernel repositories. Development happens in the kernel-source git repository. This tree is a quile-like series of patches against the upstream kernel, plus spec files and various scripts. You can clone it with
git clone https://github.com/openSUSE/kernel-source -b stable
kernel.git
If you just want to hack on the sources and do not need to package the kernel, use the kernel git repository. This one has the same layout as the upstream kernel. Clone command:
git clone https://github.com/openSUSE/kernel -b stable
5 easy & useful ways to check Linux kernel version
In this tutorial I will share multiple commands and methods you can use to check the Linux kernel version. We know that kernel is the core component in Linux and it is important that you know what version of kernel the system is running.
Method 1: Check Linux kernel version using uname
uname is the most handy tool which is used to print the system information.
On RHEL/CentOS/Fedora
In the provided distributions the output of uname would be similar to
~]# uname -r 4.18.0-193.14.2.el8_2.x86_64
The output can be broken into below format
- 4.18.0 is the major version
- 193.14.2 is the minor version
- el8_2 is the release
- x86_64 is the architecture
To list the installed kernel:
~]# rpm -q kernel kernel-4.18.0-80.el8.x86_64 kernel-4.18.0-147.5.1.el8_1.x86_64 kernel-4.18.0-193.14.2.el8_2.x86_64
On SLES/OpenSuSE
The output of uname would be different with SLES release which is again the kernel version for SLES platform.
# uname -r 3.0.101-108.81-default
You can use uname -a to get more details on the kernel version, system architecture etc
# uname -a Linux cc01-nds-ins 3.0.101-108.81-default #1 SMP Fri Nov 2 18:02:20 UTC 2018 (2208a0f) x86_64 x86_64 x86_64 GNU/Linux
To list the installed kernel:
~ # rpm -q kernel-default kernel-default-3.0.101-108.81.1
On Ubuntu/Debian
In the provided distribution, kernel is referred as linux-image . The kernel versions of Ubuntu/Debian are assigned by the respective developers and they don’t follow the normal naming syntax or standards.
Output from my Ubuntu server:
- 5 is the major version
- 0 from the second field is the minor version
- 0 from the third field is the patch level
- 23-generic is the developer patch level and in our context is what is assigned by the Ubuntu developers.
To list the available kernel package, you can use:
:~# dpkg --list | grep linux-image ii linux-image-5.0.0-23-generic 5.0.0-23.24~18.04.1 amd64 Signed kernel image generic ii linux-image-generic-hwe-18.04 5.0.0.23.80 amd64 Generic Linux kernel image
Method 2: Check Linux kernel version using hostnamectl
You may not find this command if you are using older releases. hostnamectl may be used to query and change the system hostname and related settings. But it also prints the kernel information.
The output of this command would be same across all Linux distributions. Below is an output from RHEL 8 server:
Method 3: Check Linux kernel version using grubby
grubby is only available in RHEL/CentOS/Fedora/SuSE distribution i.e. it is not yet available in Debian/Ubuntu (at the time of writing this article). grubby is a command line tool used to configure bootloader menu entries across multiple architectures.
To list the default kernel version:
~]# grubby --default-kernel /boot/vmlinuz-4.18.0-193.14.2.el8_2.x86_64
To get more information on this kernel, we can use » grubby —info /boot/vmlinuz-4.18.0-193.14.2.el8_2.x86_64 «. Following is an output from my server:
Method 4: Check Linux kernel version using boot log messages
4.1: Using dmesg
In most distributions we use dmesg to access the boot up log messages which also contains the kernel version along with many other details.
Output from RHEL/CentOS/Fedora
~]# dmesg | grep "Linux version" [ 0.000000] Linux version 4.18.0-193.14.2.el8_2.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Sun Jul 26 03:54:29 UTC 2020
Output from Ubuntu/Debian
~# dmesg | grep "Linux version" [ 0.000000] Linux version 5.0.0-23-generic (buildd@lgw01-amd64-030) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 (Ubuntu 5.0.0-23.24~18.04.1-generic 5.0.15)
Output from SLES
# dmesg | grep "Linux version" [ 0.000000] Linux version 3.0.101-108.81-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Fri Nov 2 18:02:20 UTC 2018 (2208a0f)
4.2: Using journalctl
In recent Linux distributions we have journalctl which gives us more flexibility in reading and accessing the log messages. To check the boot up log messsages we use -b switch with journalctl command
Output from RHEL/CentOS/Fedora
~]# journalctl -b | grep "Linux version" Sep 18 11:50:55 server.example.com kernel: Linux version 4.18.0-193.14.2.el8_2.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Sun Jul 26 03:54:29 UTC 2020
Output from Ubuntu/Debian
~# journalctl -b | grep "Linux version" Sep 18 11:50:51 deepak-VirtualBox kernel: Linux version 5.0.0-23-generic (buildd@lgw01-amd64-030) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 (Ubuntu 5.0.0-23.24~18.04.1-generic 5.0.15)
Currently I don’t have access to SLES 12 or higher so I can’t post the output but the same command would work with any SLES release higher than SLES 12.
Method 5: Check content of /proc/version
The output which you got earlier in Method 4 by grepping » Linux version » from the boot log files is actually collected from /proc/version. So if you do not wish to go through the log files, you can directly check the content of this file to get the Linux kernel version
Output from RHEL/CentOS/Fedora
~]# cat /proc/version Linux version 4.18.0-193.14.2.el8_2.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Sun Jul 26 03:54:29 UTC 2020
Output from SuSE/OpenSuSE
# cat /proc/version Linux version 3.0.101-108.81-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Fri Nov 2 18:02:20 UTC 2018 (2208a0f)
Output from Ubuntu/Debian
~# cat /proc/version Linux version 5.0.0-23-generic (buildd@lgw01-amd64-030) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019
Conclusion
In this tutorial I shared multiple commands and methods to check Linux kernel version across multiple distributions such as Ubuntu, Red Hat, CentOS, Fedora, SuSE etc. Some of the commands may not work on all the distributions which I have already highlighted wherever applicable.
Lastly I hope the steps from the article to configure NIC teaming on Linux was helpful. So, let me know your suggestions and feedback using the comment section.
Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud
If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.
For any other feedbacks or questions you can either use the comments section or contact me form.
Thank You for your support!!