As we all know that GNU/Linux and other operating systems have kernel. It is called a heart of any Operating System. In this article, we are going to have a look at some of the commands and their options to find out the correct version number of the kernel we are using. Sometimes, it is very helpful to know the correct version number of our kernel of our Linux operating system. This can help the user to diagnose and upgrade their systems because every version of Linux has some differences. Once your Linux distribution is UP and running, you might need to install some additional software, drivers or packages. Some of such drivers and software are specific to Linux Kernel version. This is the case where you need the correct version number, its release information.
It is very easy to identify or get the correct kernel information. There are certain commands available to perform this. But, here we are listing major 5 methods to find the version of your kernel. You can also use this commands with little bit modifications to gather some more information about your system. The first one is the easiest method, the uname command. This command reports the basic information about hardware and software.
# uname –r
This command only provides information about your kernel with no additional output to search.
Second method is to look at the file /proc/version. This you can easily perform by using some easiest file editor commands cat or vi.
# cat /proc/version
Third method that can be used is with rpm (Red hat Package Manager) command. This command can be used with its q option. You should use the work kernel as input data.
# rpm –q kernel
The output of this command provides information solely about our kernel. But, the drawback of this command is that it can only be used with Linux distributions which only use rpm package manager system. Most commonly those are based on Red Hat.
Fourth option is to check the contents from the dmesg command. This command generally gives all the information about our system when it boots up. As we know that this command generate large amount of output, we can transfer this to a file through pipe command.
# dmesg | grep Linux
Main disadvantage of this method is there is a lot of output that needs to be searched for. Even though it can be greatly reduced through grep filter.
Fifth method is to search for directories where the kernel or its source codes actually resides. There can be different directories among different versions of operating systems. Most commonly we can find it from the boot directory. This can give us the details like version number and release information about that kernel.
# ls /boot
This command will give us output with several references to the kernel version which is currently installed and running. For instance, the entry should be like vmlinuz-2.4.20-6. Here, vmlinuz means it is a compressed version of Linux kernel and it is bootable as well.