3 Ways to Check Linux Kernel Version in Command Line

Wondering which Linux kernel version your system uses? Here are several ways to check your kernel version in the Linux terminal.
Warp Terminal

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

How do I find the Linux kernel version?

You can use the following command to get the Linux kernel version:

uname -r

You'll see an output like this:

check linux kernel version

Which shows that the kernel version in use is 6.2. I'll share what does generic means in the output along with tips on getting even more detailed information about kernels.

๐Ÿ“‹
I am using Ubuntu 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 for getting system information. You can also use it to find out whether youโ€™re using a 32-bit or 64-bit system.

Open a terminal and type in 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โ€™re running Linux kernel 4.4.0-97, or in more generic terms, you are running Linux kernel version 4.4.

But what do the other digits mean here? Let me explain:

  • 4 โ€“ Kernel version
  • 4 โ€“ Major revision
  • 0 โ€“ Minor revision
  • 97 โ€“ Bug fix
  • generic โ€“ Distribution-specific string. For Ubuntu, it means Iโ€™m using the desktop version. For Ubuntu server edition, it would be โ€˜serverโ€™.

Get even more details on the Linux kernel

You can also use the uname command with the option -a. This will provide more system information if you need it.

uname -a
Checking Linux kernel version in command line

The output of the command should look 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 what it means:

  • 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 (as we saw above).
  • #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 โ€“ This means that Ubuntu has compiled 4.4.0-97-generic 120 times. A timestamp for the last compilation 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).

But Iโ€™ll save you from information overload. Letโ€™s see some other commands to find your Linux kernel version.

๐Ÿ’ก
Use the command cat /etc/os-release to know which Linux distribution you are using.

2. Find Linux kernel using /proc/version file

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

cat /proc/version
Checking Linux kernel version in command line

Youโ€™ll see an output similar to what you 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.

๐Ÿ’ก
Use lsb_release -a command if you just want to see the version number and codename in Ubuntu.

3. Find Linux kernel version using dmesg command

dmesg is a powerful command used for writing kernel messages. Itโ€™s also very useful for getting system information.

Since dmesg provides an awful lot of information, you should normally use a command like less to read it. But since weโ€™re here just to check the 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

Get more Linux system information

Of the three ways discussed here, I use uname all the time. Itโ€™s the most convenient.

If you are interested, here are a few more articles to learn more about your Linux system.

How to Check Ubuntu Version and Other System Information
Wondering which Ubuntu version youโ€™re using? Hereโ€™s how to check your Ubuntu version, desktop environment and other relevant system information.
Use inxi to Get All Kind of System Information in Linux
inxi is a handy script that provides you with the system hardware and software information about the Linux system it is executed on. Learn more about using it.

What about you? Which command do you prefer for getting Linux kernel information?

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries ๐Ÿ•ต๏ธโ€โ™‚๏ธ

It's FOSS

Making You a Better Linux User

It's FOSS

Great! Youโ€™ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.