VOOZH about

URL: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/

โ‡ฑ Check Linux Kernel Version in Command Line [3 Ways]


๐Ÿ‘ Ghostboard pixel

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.
Abhishek Prakash
5 min read
๐Ÿ‘ 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.

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

About the author

Abhishek Prakash

Created It's FOSS 13 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 ๐Ÿ•ต๏ธโ€โ™‚๏ธ

Read next

Firefox Just Saved Us All from Spammy Online PDF Tools

The One Trick That Made Immutable Linux Easier For Me

Here's How You Upgrade from Zorin OS 17 to 18

Packet is the Linux App You Didnโ€™t Know You Needed for Fast Android File Transfers

Guide to Using Plugins in Obsidian

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

๐Ÿ‘ itsfoss happy penguin