Linux show kernel version

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.

Источник

How to Check Kernel Version in Linux in Command Line

The Linux kernel is much like the central brain of the operating system. Although it is open-source – meaning anyone can view and modify the code – the Linux kernel is built with multiple protocols to ensure stability and security.

This guide will walk you through how to check the Linux kernel version of your distribution.

how to check linux kernel version command line

  • A system running Linux (Ubuntu, Debian, RHEL, CentOS, or another version)
  • A terminal window / command line (CtrlAltT, CtrlAltF2)
Читайте также:  Подключить ftp папку linux

4 Commands to Find Linux Kernel Version

uname Command

Launch a terminal window, then enter the following:

The system will return a numeric code, for example:

Each number, separated by a dot or hyphen, is part of a code:

uname command to check kernel version

The uname command includes additional options that you can use to get more information about your kernel. Simply add an option after the command:

  • -a – Display all information
  • -o – Display the operating system (usually GNU/Linux)
  • -r – Display kernel release
  • -v – Display kernel version (usually includes the base OS and time the kernel was compiled)

For a full list of uname commands, enter

uname command for more kernel information

Note: Your kernel version will likely be different than this example. At the time of writing this article, the latest version is Linux kernel 5.0.

hostnamectl Command

The hostnamectl command is typically used to display information about the system’s network configuration. It also displays the kernel version.

To check the kernel version, enter the following:

The second-to-last line should read:

Kernel: Linux 3.10.0-957.21.2.el7.x86_64

hostnamectl

Display the /proc/version File

To display the proc/version file, enter the command:

The cat command displays the contents of the /proc/version file. This will output the Linux kernel version first, along with additional data about your operating system.

display proc_version file

dmesg Command

The dmesg command is used to print the message buffer of the kernel. This is usually used to read messages from device drivers, but it can also be used to find the kernel version.

The | (pipe) symbol is usually on the same key as the symbol, just above the enter key.

dmesg command

The commands work as follows:

  • dmesg – read the contents of the kernel buffer
  • | – pipe the command into the next command
  • grep – search for a particular string of characters, and display lines that contain them
  • Linux – the exact string of characters that grep should search for (capitalization matters)

The first line of output displays the Linux kernel version.

Note: When updating your kernel, it is recommended that you choose a release version that’s compatible with your version of Linux. Your package manager will typically give you kernel versions that are tested and verified.

This guide showed you several different ways to check the Linux kernel version. Since you’re only reading the output of a file, you shouldn’t need sudo privileges.

The Linux kernel has a modular design. Functionality is extendible with modules or drivers. Learn how to use the modprobe command to add or remove modules on Linux.

Источник

How To Check/Display Linux Kernel Version?

How To Check/Display Linux Kernel Version?

Linux operating system and distributions are based on the Linux kernel which is a low-level operating system layer that mainly manages all system resources and provides services to the user-level tools. Linux kernel is an open-source project and is updated regularly. Every time the Linux kernel version change. In this tutorial, we will learn how to check the Linux kernel version from the command line with different commands and GUI. In this guide, we will use common Linux commands and tools which are provided by the popular Linux distributions like Ubuntu, Debian, Mint, Kali, CentOS, RHEL, Fedora, SUSE, etc. So this tutorial can be applied to all major Linux distributions without a problem.

Читайте также:  Ubuntu one and linux mint

Linux Kernel Releases and Versions

As an open-source project, Linux kernel source code is released openly via the kernel.org website. For every version, a new source code is released. We can see that the current release is versioned as 5.9.11 and released on 24-11-2020.

Some Linux kernel versions are named or tagged as mainline, stable, long-term, etc.

  • The mainline kernel version is the latest version which is currently developed actively.
  • The stable kernel version is the latest useable and stable kernel version.
  • The longterm kernel version is used by distributions to use for the longterm with long term support.

Check/Display Linux Kernel Version with uname Command

The uname command is the easiest and most popular way to list the current Linux kernel version. It also provides information about the current Linux operating system or distributions. The -r parameter can be provided to the uname command in order to display only the kernel version without any other information.

The output will be like below which is the only kernel version major and minor numbers.

  • 5 is the main kernel version. We can see that our kernel is the latest with the main kernel version
  • 8 is the major release version. We can see that our kernel is very near to the latest kernel manor release version.
  • 0 is the minor kernel version.
  • 29 is the path or update level which is generally added by the distribution creators.

If you are working with the FreeBSD you can use the -a option with the uname command.

Check/Display Linux Kernel Version with hostnamectl Command

The hostnamectl is a new command which provides very useful information about the current operating system, distribution, and kernel. The kernel version will be listed in the like Kernel: like below. There is no need for extra parameters.

The output of the hostnamectl is like below where the “Kernel: Linux 5.8.0-29-generic” line provides kernel version information which is the same as the “uname -r” command.

Static hostname: ubuntu Icon name: computer-vm Chassis: vm Machine ID: 295c2cf105a140e5ab505a9e74ff560e Boot ID: 9a37d5dd34e1444d9c6b76bd983c778f Virtualization: vmware Operating System: Ubuntu 20.10 Kernel: Linux 5.8.0-29-generic Architecture: x86-64

From the output, we see that the hostnamectl command provides kernel version, major revision, minor revision, and patch number.

Читайте также:  Загрузочная флешка linux rus

Check/Display Linux Kernel Version from /proc/version File

Linux is a file-based operating system where information, monitoring, and configuration are generally done via special files. The Linux kernel version is also provided via the /proc/version file. We will use the cat command in order to print the contents of the /proc/version file which will provide detailed Kernel version information.

The output is like below where the 5.8.0.29 is the kernel version.

Linux version 5.8.0-29-generic (buildd@lgw01-amd64-055) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #31-Ubuntu SMP Fri Nov 6 12:37:59 UTC 2020

Check/Display Linux Kernel Version with dmesg Command

The dmesg command is used to print system logs and message buffer of the Linux kernel in the command-line interface. While printing the message buffer of the Linux kernel also the kernel information is provided. We will use the grep tool in order to match the line which contains the term “Kernel” where also the version information is provided.

Check/Display Linux Kernel Version with apt and apt-get Command

The Linux kernel is provided via packages for different Linux distributions. Popular distributions like Ubuntu, Debian, Mint, Kali, etc. use the apt or apt-get commands to manage packages. These apt and apt-get commands can be used to print Linux kernel package information with the “apt show” or “apt-get show” command. The package name for the Linux kernel is “linux-generic“.

The output is like below where the “Version: 5.8.0.29.34” line provides version information for the Linux kernel.

Package: linux-generic Version: 5.8.0.29.34 Priority: optional Section: kernel Source: linux-meta Origin: Ubuntu Maintainer: Ubuntu Kernel Team kernel-team@lists.ubuntu.com Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 18,4 kB Provides: kernel-testing--linux--full--generic, kernel-testing--linux--full--preferred Depends: linux-image-generic (= 5.8.0.29.34), linux-headers-generic (= 5.8.0.29.34) Download-Size: 1.904 B APT-Sources: http://tr.archive.ubuntu.com/ubuntu groovy-updates/main amd64 Packages Description: Complete Generic Linux kernel and headers This package will always depend on the latest complete generic Linux kernel

Alternatively, the “apt-get show linux-generic” command can be used which will produce the same output.

Check/Display Linux Kernel Version with yum or dnf Command

The yum and dnf commands are used to install packages in RPM-based distributions like CentOS, RHEL, and Fedora. Linux kernel is provided as a package too and version information is provided for this kernel package by using the dnf or yum commands.

or alternatively with the yum package manager.

/etc/issue File

The /etc/issue is another file that only stores the current distribution or Linux version. This file also exists in older or ancient Linux distributions. The cat command is used to print the Linux version via the /etc/issue file. For example, if you have Ubuntu 16.04 or like that this will work without a problem.

Источник

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