Linux kernel get current

How do I check the running kernel version?

While troubleshooting a problem with my ethernet card, I’ve found that the driver I’m currently using may have some issues with old kernel versions. What command can I use to check the kernel version I am currently running ?

7 Answers 7

It will display something like

For Ubuntu

will Print the kernel name

Will Print all Information

or else we can check with cat /proc/version

For Redhat and centos

# cat /etc/redhat-release # lsb_release –a 

This command reads boot logs as it startup.

[ 0.000000] Linux version 4.9.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21)

uname -r for exact version of the kernel or uname -a for information in the kernel AND information about your distro.

gives both, revision and version. This works on all UNIX platforms since ~1982, except for AIX (Alien UNIX 😉 because IBM implemented AIX after reading the man pages and confused -r with -v and vice versa 😉

/etc/redhat-release gives only current version

Red Hat Enterprise Linux Server release 7.2 (Maipo)

To get kernel details in Redhat use /proc/version.

cat /proc/version

Linux version 3.10.0-327.el7.x86_64 (mockbuild@x86-034.build.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Oct 29 17:29:29 EDT 2015

Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

How do I check the running kernel version?

What you want is known as the kernel release.
Here is how I output the name, release, and version of the kernel
when running Ubuntu 22.04 (jammy) on WSL2 : 1

$ uname --kernel-name # or uname -s Linux $ uname --kernel-release # or uname -r 5.10.16.3-microsoft-standard-WSL2 $ uname --kernel-version # or uname -v #1 SMP Fri Apr 2 22:23:49 UTC 2021 

If you prefer to get it all in one go :

$ uname --all # or uname -a Linux hp 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux 

Reference

1 It so happens that the output is identical when running Debian 11 (bullseye) on WSL2.

Источник

3 Ways to Check Linux Kernel Version in Command Line

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

Читайте также:  Xsane linux невозможно открыть устройство

A quick way to check Linux kernel version: You can use the following command to get the Linux kernel version:

There are other ways to get even more detailed information about kernels. Read the rest of the article to learn it in detail.

In this article, I’ll show you various methods for finding out your kernel version and tell you what those numbers mean. If you prefer videos, here’s a quick one:

Check Kernel Version In Linux

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:

Checking Linux kernel version in command line

The output will be something similar to this:

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’.

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

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.

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:

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 ([email protected]) (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 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.

Читайте также:  Linux send file tcp

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 ([email protected]) (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 your Linux Kernel version and other information?

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

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

Источник

How do I find out the kernel version I am running?

I need this info so I can finish updating my STA Broadcom wireless. However, I’m a noob at Ubuntu and I’m not sure how to find the kernel version or kernel. I checked /lib/modules/ and found this:

2.6.27-10-generic 2.6.32-30-generic 2.6.32-34-generic 2.6.32-38-generic 2.6.27-7-generic 2.6.32-31-generic 2.6.32-35-generic 3.2.0-54-generic 2.6.28-19-generic 2.6.32-32-generic 2.6.32-36-generic 3.2.0-54-generic-pae 2.6.31-23-generic 2.6.32-33-generic 2.6.32-37-generic 

Which one is the running kernel? Another question. Is there a snippet so I don’t have to cut and paste? Thanks for your time! 🙂

6 Answers 6

Well there are multiple ways to find the kernel version

Open terminal and execute:

It would display something like:

You can get further information on the current kernel with

It would display something like:

Linux saurav-P4I45Gx-PE 3.8.0-30-generic #44~precise1-Ubuntu SMP Fri Aug 23 17:33:45 UTC 2013 i686 i686 i386 GNU/Linux 

Another way to know the kernel version is to open Synaptic Package Manager and search for linux image . You have to check for the installed Kernel version.

Another way to find version of installed kernels is to run this command:

dpkg -l | grep linux-image | grep ii 

or for just the version strings:

dpkg -l | grep linux-image | grep ii | awk '' 

The latest kernel (the one with the highest version number) will boot by default, so if you have rebooted since the last kernel update, and you have not made adjustments to boot into a kernel other than the default, then you can be reasonably confident that the highest version number displayed will be the version of the running kernel, but you should use uname for more reliable information.

Источник

6 ways to check Linux kernel version

This post aims at checking your Linux kernel version using commands. We will be discussing different ways to fetch this data from your system. Below is a list of commands which can be used to get Linux kernel version details.

You can use below 7 ways to gather info about your distribution like kernel version in CentOS, RHEL, SUSE, OEL, Ubuntu, Debian Linux. All the below outputs are from my test machine running CentOS 7.

1. By reading version process file.

This gives you running kernel version.

[root@kerneltalks1 ~]# cat /proc/version Linux version 3.10.0-693.5.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017

3.10.0-693.5.2.el7.x86_64 is your current kernel distribution version.

Читайте также:  Загрузочная карта памяти linux

2. By reading Distro release file in /etc

Almost all distributions of Linux come with a release file in /etc which contains the kernel version, release details in it. Its a text file hence cat can be used to read its content.

# cat /etc/enterprise-release OR /etc/oracle-release ---For OEL Enterprise Linux Enterprise Linux Server release 5.8 (Carthage) [root@kerneltalks1 ~]# cat /etc/redhat-release ---For RHEL/OEL CentOS Linux release 7.4.1708 (Core)

OR simple use wildcard so that you can list the release file of any distro. All distro keeps diff filenames so using wildcard will be wise. In some distro, you will see /etc/os-release or /etc/system-release files as well. All these files will be covered when using wild cards.

[root@kerneltalks1 ~]# cat /etc/*release CentOS Linux release 7.4.1708 (Core) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" CentOS Linux release 7.4.1708 (Core) CentOS Linux release 7.4.1708 (Core)

3. By listing release package

This command works for RPM-based systems like RHEL, SUSE, OEL, CentOS, etc. Search and grep for release which will show you release package. This package name convention includes release number in it.

[root@kerneltalks1 ~]# rpm -qa |grep -i release centos-release-7-4.1708.el7.centos.x86_64

4. Using uname command

This command works on all flavors of Linux. You can use it on RHEL, SUSE, OEL, Debian, Ubuntu, etc.

[root@kerneltalks1 ~]# uname -r 3.10.0-693.5.2.el7.x86_64

This value indicates your current kernel version.

5. Using lsb_release command

lsb_release command is provided by redhat-lsb package. You need to install redhat-lsb package in order to use this command on RHEL, CentOS or Fedora systems.

[root@kerneltalks1 ~]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.4.1708 (Core) Release: 7.4.1708 Codename: Core

6. Using hostnamectl command

In newer kernels, hostnamectl command is introduced. Using this command without any argument will show you all details about your kernel. You can use it to set your hostname as well.

[root@kerneltalks1 ~]# hostnamectl Static hostname: kerneltalks1 Icon name: computer-vm Chassis: vm Machine ID: 49688f1b932a41e790254b993d419ccc Boot ID: 4777133835544d599a46a53ae4b584e3 Virtualization: xen Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-693.5.2.el7.x86_64 Architecture: x86-64
  • How to configure telnet server in Linux
  • How to configure proxy in RHEL, Suse, OEL, CentOS, Ubuntu Linux
  • 5 steps guide for SMTP configuration in Linux
  • How to configure switching IAM roles in AWS CLI?
  • How to configure yum server in Linux
  • How to configure NTP client in Linux
  • AutoFS configuration in Linux
  • Build Syslog server in Linux for centralized log management
  • syslog configuration in Linux
  • How-to guide: sudo configuration in Unix – Linux (with examples)
  • Learn Linux Unix: File permissions & ownership
  • Understanding /etc/fstab file

Источник

Оцените статью
Adblock
detector