3 Ways to Check Linux Kernel Version in Command Line

Brief: Wondering which Linux kernel version your system uses? Here are several ways to check kernel version in Linux terminal.

Various ways to check Linux kernel version

You may find yourself in a situation when you need to know the exact Linux kernel version being used on your system. Thanks to the powerful Linux command line, you can easily find that out.

In this article, I’ll show you various methods to know kernel version along with what those numbers actually mean. If you prefer videos, here’s a quick one. Don’t forget to subscribe to our YouTube channel for more Linux tips.

How to find Linux kernel version

I am using Ubuntu 16.04 while writing this article. But these commands are generic and can be used on Fedora, Debian, CentOS, SUSE Linux or any other Linux distribution.

1. Find Linux kernel using uname command

uname is the Linux command to get system information. You can also use it to know if you are using a 32-bit or 64-bit system.

Open a terminal and use the following command:

uname -r

Checking Linux kernel version in command line

The output  will be something similar to this:

4.4.0-97-generic

This means that you are running Linux kernel 4.4.0-97 or in more generic terms, you are running Linux kernel version 4.4.

But what do other digits mean here? Let me explain it to you:

  • 4 – Kernel version
  • 4 – Major revision
  • 0 – Minor revision
  • 97 – Bug fix
  • generic – distribution specific string. For Ubuntu, it means I am using the desktop version. For Ubuntu server edition, it should be server.

You can also use uname command with option -a. This will provide more system information if you want that.

uname -a

Checking Linux kernel version in command line

The output of the command should like this:

Linux itsfoss 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Let me explain the output and give it a meaning:

  • Linux – Kernel name. If you run the same command on BSD or macOS, the result will be different.
  • itsfoss – hostname
  • 4.4.0-97-generic – Kernel release (we just saw that)
  • #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 – This means that Ubuntu compiled 4.4.0-97-generic 120 time. Last compilation timestamp is also there.
  • x86_64 – Machine architecture
  • x86_64 – Processor architecture
  • x86_64 – Operating system architecture (You can run a 32 bit OS on a 64-bit processor)
  • GNU/Linux – Operating system (and no it won’t show the distribution name)

I’ll save you from information overload. So let’s see other commands to find Linux kernel version.

2. Find Linux kernel using /proc/version file

In Linux, you can also find the Linux kernel information in the file /proc/version. Just look at the content of this file:

cat /proc/version

Checking Linux kernel version in command line

You’ll see an output similar to what we saw with uname.

Linux version 4.4.0-97-generic (buildd@lcy01-33) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017

You can see the kernel version 4.4.0-97-generic here.

3. Find Linux kernel version using dmesg commad

dmesg is a powerful command used to write the kernel messages. It is also very useful in getting system information.

Since dmesg provides quite an awful lot of information, you should use a command like less to read it. But since you are here just to check Linux kernel version, grepping on Linux should give the desired output.

dmesg | grep Linux

Checking Linux kernel version in command line

The output will have a few lines but you should be able to identify the Linux kernel version there easily.

[ 0.000000] Linux version 4.4.0-97-generic (buildd@lcy01-33) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 (Ubuntu 4.4.0-97.120-generic 4.4.87)
[ 0.182880] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
[ 1.003861] Linux agpgart interface v0.103
[ 1.007875] usb usb1: Manufacturer: Linux 4.4.0-97-generic xhci-hcd
[ 1.009983] usb usb2: Manufacturer: Linux 4.4.0-97-generic xhci-hcd
[ 5.371748] media: Linux media interface: v0.10
[ 5.399948] Linux video capture interface: v2.00
[ 5.651287] VBoxPciLinuxInit

How do you check Linux kernel version and other information?

Among the three ways discussed here, I use uname all the time. It is more convenient.

What about you? Which command do you prefer to get Linux kernel information?

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How To Use Systemctl to Manage Systemd Services and Units
Viewed 7998 times since Mon, Dec 7, 2020
SYS: Configure a local repository. local repo
Viewed 11510 times since Mon, Oct 29, 2018
OpenSSL: Find Out SSL Key Length – Linux Command Line
Viewed 7887 times since Mon, Feb 18, 2019
10 Linux DIG Command Examples for DNS Lookup
Viewed 11596 times since Sun, Sep 30, 2018
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 2788 times since Sun, Sep 23, 2018
RHCS6: Basic operations on clustered services
Viewed 3105 times since Sun, Jun 3, 2018
ZFS: Create a new zfs filesystem
Viewed 3023 times since Sun, Jun 3, 2018
RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)
Viewed 3973 times since Sun, May 27, 2018
How to recover error - Audit error: dispatch err (pipe full) event lost
Viewed 26979 times since Tue, Aug 6, 2019
RHEL: Adding a boot entry to GRUB/GRUB2 configuration
Viewed 5306 times since Sun, May 27, 2018