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
tcpdump usage examples
Viewed 2043 times since Fri, Jul 27, 2018
RHEL: Display swap/RAM size
Viewed 2938 times since Sat, Jun 2, 2018
CentOS / RHEL : Configure yum automatic updates with yum-cron service
Viewed 3296 times since Fri, Oct 26, 2018
RHCS: Configure an active/backup pacemaker cluster
Viewed 8643 times since Sun, Jun 3, 2018
RHEL: Enabling standard ftp/telnet
Viewed 2721 times since Sun, May 27, 2018
Using IOzone for Linux disk performance analysis
Viewed 7188 times since Wed, Jul 25, 2018
Inxi: Find System And Hardware Information On Linux
Viewed 1974 times since Sat, Jun 2, 2018
How setting the TZ environment variable avoids thousands of system calls
Viewed 9708 times since Mon, May 21, 2018
Using Official Redhat DVD as repository
Viewed 10826 times since Mon, Oct 29, 2018
Securing /tmp and shm partitions
Viewed 2898 times since Fri, May 15, 2020