How to find the kernel version?

Kernel is a computer program that works as an intermediate between the applications and computer hardware. It manages the Input/Output requests from the Application software and translates those into the data processing instructions for the Central Processing Unit and other electronic components of the computer system. So, kernel is the main part of any operating system and one should know about the kernel version on a particular Linux system. This is core part of OS. If you know about it’s version, you can update this when it will be required or the new version will be released.

There are five ways to know about the version of kernel. Any of technique can be used, with little modification to obtain additional information about the system. These five techniques are discussed below:

1. Using uname command:

The uname command provides basic information about the system. Its syntax is

uname [option]

Without any option, it will only display the name of operating system. Following options can be used –

-a: Provides the name of the kernel, network node host name, kernel version number and release level, kernel release date, machine hardware name, CPU type, hardware platform and OS name (e.g., GNU/Linux).

Options are available to allow each of these pieces of information to be reported individually: -s for kernel name (i.e., the default action), -n for network node host name, -r for kernel version number and release level, -v for date of release of the kernel version, -m for machine hardware name, -p for CPU type (not available on some systems), -i for general hardware platform and -o for operating system.

For example, the following option with uname will display the version of kernel.

uname -r

2. The cat Command

The second way is to look at /proc/version file. This can easily be accomplished by using the cat command. The cat command is commonly used to read and concatenate files. So, you can also use the following code:

cat /proc/version

3. Using rpm

Here, rpm stands for Red Hat Package Manager. One can also have the kernel detail using rpm with option of -q(i.e query) and word kernel as an argument.

rpm -q kernel

The disadvantage of using this command is that it only works on distributions of Linux that uses the rpm package system such as based on Red Hat.

4. Using dmesg command

The dmesg command is used to write the kernel messages in Linux and other Unix-like Operating Systems to the standard output. So, the fourth method is to look at the contents of the dmesg command, which is used to report information about the system as it starts up. It generates huge amount of output, thats why it is convenient to first transfer that output using a pipe (represented by the vertical bar character) to the grep filter with the word Linux as an argument in order to display only lines that contain that word (and thus the kernel version information) as follows:

dmesg | grep Linux

5. Check for source code

You can check the source code or directory in which the kernel is stored. Some systems might not contained source code but in most of the cases, it is contained in the ‘boot’ directory. Use ls command to check in between the boot directory.

ls /boot

This command will likely produce several references to the version of the currently installed and running kernel. So, these were the five ways to get the version and other detail about the kernel.

Advertisements

Published by

kaurdavinder

I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s