- How do I find out the kernel version I am running?
- 6 Answers 6
- How to Check What Linux Kernel Version Am I Running
- How to use the uname Command
- How to Use hostnamectl Command
- How to Use os-release File to Get Info
- How to Use Neofetch to Get System Info
- Get Linux System Info Using Graphical Tools
- How to Check Kernel Version in Linux in Command Line
- 4 Commands to Find Linux Kernel Version
- uname Command
- hostnamectl Command
- Display the /proc/version File
- dmesg Command
- 6 ways to check Linux kernel version
- 1. By reading version process file.
- 2. By reading Distro release file in /etc
- 3. By listing release package
- 4. Using uname command
- 5. Using lsb_release command
- 6. Using hostnamectl command
- Related stuff:
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 What Linux Kernel Version Am I Running
In Linux, there are many ways to achieve a single task. To make it precise there are many commands to get the same information. When you start using Linux distribution you should know how to get information about what distribution, kernel version, architecture, etc.
In this article, you will learn how to get your Linux kernel version, distribution name, and system-related information using different command-line tools.
How to use the uname Command
uname is one of the easy-to-use and helpful commands that comes with all the Linux distribution. It can give you information like your kernel architecture, operating system, machine-related information. Try running the help or man page to get more information about the uname command.
$ man uname $ uname -a Linux karthick-Mint 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The important information you can get from this command is your kernel information.
$ uname -r -v 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020
How to Use hostnamectl Command
hostnamectl command comes with systemd, which is used not only to get host-related information but you can set your machine hostname too. Using hostnamectl you can get informations like hostname, kernel version, architecture, operating system info.
$ hostnamectl Static hostname: karthick-Mint Icon name: computer-laptop Chassis: laptop Machine ID: b76cc7b1bbdc489e93909d2043031de8 Boot ID: fb01179430ac4c0faf96856ff0a2adbc Operating System: Linux Mint 20 Kernel: Linux 5.4.0-26-generic Architecture: x86-64
How to Use os-release File to Get Info
Every distribution comes with a file that holds the distribution-related information. For example, in redhat, you can find the information from /etc/redhat-release. Similarly, you can get your distribution-related information from the /etc/os-release file.
$ cat /etc/os-release NAME="Linux Mint" VERSION="20 (Ulyana)" ID=linuxmint ID_LIKE=ubuntu PRETTY_NAME="Linux Mint 20" VERSION_ID="20" HOME_URL="https://www.linuxmint.com/" SUPPORT_URL="https://forums.ubuntu.com/" BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" PRIVACY_POLICY_URL="https://www.linuxmint.com/" VERSION_CODENAME=ulyana UBUNTU_CODENAME=focal
You can also use the lsb_release command to get distribution-related information.
How to Use Neofetch to Get System Info
Neofetch is one of the coolest tools that can get your system-related information. Unlike other commands, we discussed in the previous section this command might not be available in your Linux distributions by default.
To install Neofetch in your Linux distribution, use the following commands.
$ sudo apt-get install neofetch [On Debian/Ubuntu & Mint] $ sudo dnf install neofetch [On RHEL/CentOS & Fedora] $ sudo zypper install neofetch [On openSUSE] $ sudo pacman -S neofetch [On Arch Linux]
Once installed, simply run:
Get Linux System Info Using Graphical Tools
Every Desktop has a section that displays the system information. Below is the information from my Cinnamon desktop.
If you are working within a corporate network then you will have access to only the command line but not to desktops. In that case, you need to be comfortable with using all the tools available from the cli to get the required information.
That’s it for this article. Make yourself comfortable using the commands shown in the article that will help you when you are working with any Linux distribution.
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.
- A system running Linux (Ubuntu, Debian, RHEL, CentOS, or another version)
- A terminal window / command line (Ctrl–Alt–T, Ctrl–Alt–F2)
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:
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
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
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.
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.
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.
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.
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
Related stuff:
- How to configure proxy in RHEL, Suse, OEL, CentOS, Ubuntu Linux
- FTP server configuration steps in RHEL 6
- Enable debugging to log NFS logs in Linux
- How to configure switching IAM roles in AWS CLI?
- 5 steps guide for SMTP configuration in Linux
- How to configure yum server in Linux
- Build Syslog server in Linux for centralized log management
- How to configure NTP client in Linux
- How to configure telnet server in Linux
- AutoFS configuration in Linux
- YUM configuration in Linux
- Learn Linux Unix: File permissions & ownership