How to know kernel version on linux

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:

Читайте также:  Linux resize partition without data loss

Neofetch System Info Tool

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.

Linux System Info

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.

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)

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.

Читайте также:  Linux mint установить anydesk

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.

Источник

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.

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.

Читайте также:  Linux add prefix file

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.

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 to know kernel version on linux

How to check Debian version: the quick and easy way

How to check Debian version: the quick and easy way

Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.

How to check your Ubuntu version: a guide

How to check your Ubuntu version: a guide

Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.

How to delete a Linux directory

How to delete a Linux directory

Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.

How to delete files in Linux

How to delete files in Linux

Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command “rm”, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.

How to use the Linux find command

How to use the Linux find command

While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.

Источник

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