SoFunction
Updated on 2025-05-04

How to view the kernel and distribution information of the current system

Linux checks the kernel and distribution information of the current system

Currently onlyCentOSandUbuntuSystem testing, other systems will be slightly different.

1. Pass the command: less /proc/version (kernel and distribution information)

Centos 8:

Linux version 4.18.0-147.5.1.el8_1.x86_64 (mockbuild@) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Wed Feb 5 02:00:39 UTC 2020

Ubuntu 18.04.1:

Linux version 4.15.0-65-generic (buildd@lgw01-amd64-006) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019

Note:

  1. Different systems may display differently, but they can generally be distinguished.
  2. Linux versionRefers to the kernel version.
  3. CentOSWords:el8_1Number 8RepresentsCentOS 8
  4. UbuntuIt is the following18.04.1, means yesUbuntu 18.04

2. Pass the command: uname -a (kernel and distribution information)

  • CentOS 8:
Linux iZ2ze90lblkm0mixai571vZ 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

It is determined by el8.

  • Ubuntu:
Linux blog 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Use Ubuntu to determine it is an Ubuntu system.

3. Pass the command: lsb_release -a (only view release information)

  • CentOS:
Distributor ID: CentOS
Description: CentOS Linux release 8.1.1911 (Core)
Release: 8.1.1911
Codename: Core
  • Ubuntu:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

4. Use the less /etc/*-release command (view release information)

passless /etc/*-releaseCan match multiple files and enter them in command mode:nBrowse the next file,:pBrowse the previous file, and you can see more detailed information in this way, or you can view a certain file separately:

  • CentOS: General viewredhat-releaseos-releaselsb-releasesystem-release. Different versions of these files may not necessarily be available.
  • Ubuntu: General viewos-releaselsb-release. Different versions of these files may not necessarily be available.

Generally speaking, you can get the desired kernel information and distribution information through the above methods.

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.