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
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 1772 times since Fri, Nov 30, 2018
How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 2604 times since Wed, Oct 17, 2018
Secure Remote Logging to Central Log Server Using RSYSLOG on CentOS 6 / CentOS 7 and stunnel
Viewed 3609 times since Sun, Dec 6, 2020
How to schedule crontab in Unix Operating Systems
Viewed 1904 times since Fri, Jun 8, 2018
ZPOOL: Grow a zpool by adding new device(s)
Viewed 6014 times since Sun, Jun 3, 2018
RHEL: Route network packets to go out via the same interface they came in
Viewed 2992 times since Sat, Jun 2, 2018
Linux Audit The Linux security blog about Auditing, Hardening, and Compliance lynis
Viewed 1993 times since Thu, Jan 16, 2020
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 4651 times since Thu, Apr 18, 2019
Zabijanie wszystkich procesów użytkownika
Viewed 2610 times since Thu, May 24, 2018
Używanie rsync poprzez Secure Shell
Viewed 41112 times since Thu, May 24, 2018