Home>Article>Operation and Maintenance> How to check the current kernel version in Linux
View method: 1. Use uname to display information such as the Linux kernel name and version, with the syntax "uname -srm"; 2. Use hostnamectl, with the syntax "hostnamectl |grep -i kernel"; 3. Execute "cat /proc/version" command.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
The Linux kernel is the core component of the GNU/Linux operating system. It is a free, open source, large, modular, multi-tasking Unix-like operating system kernel.
You may need to know exactly which kernel version is running on your GNU/Linux operating system for a number of reasons. Maybe you're debugging a hardware-related issue or learning about a new security vulnerability affecting an older kernel version, and you want to know if your kernel is vulnerable.
Whatever the reason, it is very easy to determine the Linux kernel version from the command line.
How to check the current kernel version in Linux
1. Use the `uname` command to check the Linux kernel version
uname command displays multiple system information, including Linux kernel architecture, name version and release.
To find out what version of the Linux kernel is running on your system, enter the following command:
uname -srm
Output:
Linux 3.10.0-957.12.2.el7.x86_64 x86_64 3 - 内核版本. 10 - 主修订版本. 0-957 - 次要修订版本. 12 - 补丁版本.
2. Use the `hostnamectl` command to view the kernel version
hostnamectl
The utility is part of systemd and is used to query and change the system host name. It also displays the Linux distribution and kernel version:
hostnamectl Static hostname: CentOS7.linuxrumen.com Icon name: computer-vm Chassis: vm Machine ID: 20c27040135a4d46b2d3d07180f37303 Boot ID: 2f495af0684e4adfb34f0366f2567460 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-957.12.2.el7.x86_64 Architecture: x86-64
Use the following command to display only the current kernel version:
hostnamectl | grep -i kernel
3. By viewing /proc/version File Confirm Kernel Version
The /proc directory contains virtual files that contain information about system memory, CPU cores, installed file systems, etc. Information about the running kernel is stored in the /proc/version virtual file.
Combined with cat to view the file content:
cat /proc/version
The output results are as follows:
Linux version 3.10.0-957.12.2.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) 1 SMP Tue May 14 21:24:32 UTC 2019
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check the current kernel version in Linux. For more information, please follow other related articles on the PHP Chinese website!