The Linux kernel is the core component of Linux operating systems. It manages the system’s resources, and communication between your computer’s hardware and software. In this tutorial, we will show you multiple ways to check the version of Linux kernel running on your system.
Check Kernel Version
It also maintains the security of your system. There are multiple reasons, to know the version of the kernel which is running on your GNU/Linux operating system.
Using the uname Command
The uname command used to get system information such as, name version, the Linux kernel architecture, and release.
Run the following command to find out the Linux kernel which is running on your system:
uname -srm
Linux 4.15.0-101-generic x86_64
In output, it shows the Linux kernel is 64-bit
and its version is 4.15.0-101
.
Using hostnamectl command
The systemd
includes hostnamectl
utility and used to change the hostname
. It also shows the Linux distribution and kernel version:
hostnamectl
Static hostname: tecnstuff
Icon name: computer-vm
Chassis: vm
Machine ID: a51c7bf6767de7b511cede805d7c8290
Boot ID: 6d9c812d57134a51822c77c5e6127e6e
Virtualization: kvm
Operating System: Ubuntu 18.04.4 LTS
Kernel: Linux 4.15.0-101-generic
Architecture: x86-64
To filter out the Linux kernel version use the grep command:
hostnamectl | grep -i kernel
Kernel: Linux 4.15.0-101-generic
Using /proc/version File
Information files of system memory, CPU cores, etc. are stored in /proc
directory. Information about the running kernel is stored in the /proc/version
virtual file.
You can use cat or less to print the contents of the file:
cat /proc/version
The output will look something like this:
Linux version 4.15.0-101-generic (buildd@lgw01-amd64-003) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020
Conclusion
We have shown you multiple ways to check the version of the Linux kernel running on your system using command line. Same methods will work on all Linux distributions. You can find kernel source code here.
If you have any question or feedback, feel free to leave a comment below.