The Linux kernel version is the core component of the Linux operating system. It serves as the intermediary between the hardware and the software layers of the system, providing essential functions such as process management, memory management, device management, and system calls.
It also enables multi-tasking, where multiple processes can run at the same time, and time-sharing, where the CPU time is shared between running processes.
The Linux kernel is also responsible for providing security features, such as access control, memory protection, and user management. It ensures that only authorized users can access system resources and that processes cannot interfere with other processes’ memory.
A Linux kernel is composed of three key components: the process scheduler, the memory manager, and the device driver. Understanding the role of the Linux kernel is essential for ensuring the optimal performance and security of your Linux system.
Kernel version information is crucial for identifying and resolving issues related to hardware, software, and system stability. Linux distributions are known for their flexibility in customization and support for a range of hardware architectures.
As a result, checking the kernel version on a Linux-based system is crucial in determining compatibility between software and hardware components.
Kernel version
Take a look at some few methods for obtaining the kernel version on a Linux system: the uname command, dmesg command, the /proc/version file, and the hostnamectl command.
uname Command
This is the first and most common method used to get or obtaining the kernel version on a linux system. The command name is uname.This command prints the kernel release, version, and a few other system-related details.
Get the kernel version Linux by opening a SSH or terminal and entering the following command.
uname -r
After entering the command below is the output
[root@testserver1 ~]# uname -r 3.10.0-1160.102.1.el7.x86_64 [root@testserver1 ~]#
In the above example, the Linux kernel version is 3.10.0-1160.102.1.el7.x86_64
You can obtain additional information by adding some of the additional flags to the uname command. In order to see all of the available flags for the uname command, enter the following command into your terminal.
uname --help
[root@testserver1 ~]# uname --help Usage: uname [OPTION]... Print certain system information. With no OPTION, same as -s. -a, --all print all information, in the following order, except omit -p and -i if unknown: -s, --kernel-name print the kernel name -n, --nodename print the network node hostname -r, --kernel-release print the kernel release -v, --kernel-version print the kernel version -m, --machine print the machine hardware name -p, --processor print the processor type or "unknown" -i, --hardware-platform print the hardware platform or "unknown" -o, --operating-system print the operating system --help display this help and exit --version output version information and exit GNU coreutils online help: <http://www.gnu.org/software/coreutils/> For complete documentation, run: info coreutils 'uname invocation' [root@testserver1 ~]#
Next using dmesg command
dmesg Command
Another way to get the kernel version in Linux is to use the dmesg command. The dmesg command displays the kernel ring buffer messages, including the kernel version.
To use the dmesg command, open your terminal window and enter the following command.
dmesg | grep “Linux version”
The above command will execute and shows
[root@testserver1 ~]# dmesg | grep “Linux version”
[ 0.000000] Linux version 3.10.0-1160.102.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Tue Oct 17 15:42:21 UTC 2023
[root@testserver1 ~]#
Next is using the /proc/version File
Display the /proc/version File
The /proc/version file contains information about the current kernel version and the build details. This file can be used to get the kernel version in Linux.
To display information in the /proc/version file, open your terminal window and enter the following command.
cat /proc/version
After entered the above command , output will be looks like
[root@testserver1 ~]# cat /proc/version Linux version 3.10.0-1160.102.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Tue Oct 17 15:42:21 UTC 2023 [root@testserver1 ~]#
hostnamectl Command
The hostnamectl command is used to view or modify the system hostname and related settings. This command can also be used to display the Linux kernel version. The hostnamectl command is a component of systemd, so it wouldn’t be available on a Linux distribution that isn’t using systemd by default, such as Gentoo.
To use the hostnamectl command, open your terminal window and enter the following command.
hostnamectl
The output of the above command looks like,
[root@testserver1 ~]# hostnamectl Static hostname: testserver1.gokul.com Icon name: computer-vm Chassis: vm Machine ID: 96820b9851c24560b5f942f2496b9aeb Boot ID: 070f4b7b5f33473cbd1b4dd22d695291 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-1160.102.1.el7.x86_64 Architecture: x86-64 [root@testserver1 ~]#
In the example presented above, the Linux kernel version is 3.10.0-1160.102.1.el7.x86_64.
I hope above article will clarify about kernel versions how to find using command prompt.
To know How to Install Direct admin on Ubuntu 22.04 click here.
