How to find Linux kernel version

Configurare noua (How To)

Situatie

Linux stores version information in a file called /proc/version. As a sysadmin you need to know the Linux distro ver number of the Linux kernel on given server or workstation. This information can be used for the following purpose.

  1. To fix device driver issue.
  2. Install correct device driver for NIC/RAID card.
  3. Diagnosing system problems.
  4. Security and patching system for bugs.
  5. Upgrading system and more.
How to find Linux kernel version

You need to type the following command at shell prompt:
$ uname -r
Sample outputs from RHEL 5:

2.6.18-194.3.1.el5

Another outputs from Fedora 30:

5.1.16-300.fc30.x86_64
How to check Linux version using /prov/version file

Type the following cat command to print out information about the running Linux kernel:
$ cat /proc/version
Sample outputs from RHEL 5:

Linux version 2.6.18-194.3.1.el5 (mockbuild@x86-004.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Sun May 2 04:17:42 EDT 2010

Please note that you can also use the following command:
$ uname -a
Sample outputs:

Linux b1 3.2.0-51-generic #77-Ubuntu SMP Wed Jul 24 20:18:19 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Another outputs from my Fedora Linux desktop:
Check Linux Kernel Version in Command Line

Checking Linux kerne version using dmesg

Another useful option is to type the following dmesg command along with grep command:
dmesg | grep 'Linux version'
dmesg | grep Linux

Sample outputs:

[    0.000000] Linux version 5.1.16-300.fc30.x86_64 (mockbuild@bkernel04.phx2.fedoraproject.org) (gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC)) #1 SMP Wed Jul 3 15:06:51 UTC 2019
[    0.667677] SELinux:  Initializing.
[    0.667697] *** VALIDATE SELinux ***
[    0.691958] ACPI: Added _OSI(Linux-Dell-Video)
[    0.691958] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.691958] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.808940] pps_core: LinuxPPS API ver. 1 registered
[    1.754325] Linux agpgart interface v0.103
[    1.788277] usb usb1: Manufacturer: Linux 5.1.16-300.fc30.x86_64 xhci-hcd
[    1.789649] usb usb2: Manufacturer: Linux 5.1.16-300.fc30.x86_64 xhci-hcd
[   31.626968] SELinux:  policy capability network_peer_controls=1
[   31.626970] SELinux:  policy capability open_perms=1
[   31.626970] SELinux:  policy capability extended_socket_class=1
[   31.626971] SELinux:  policy capability always_check_network=0
[   31.626972] SELinux:  policy capability cgroup_seclabel=1
[   31.626972] SELinux:  policy capability nnp_nosuid_transition=1
[   31.653735] systemd[1]: Successfully loaded SELinux policy in 755.735ms.
[   32.980279] Intel(R) Wireless WiFi driver for Linux
[   34.349592] VBoxPciLinuxInit
[ 1784.165279] SELinux:  Converting 2546 SID table entries...
[ 1786.470382] SELinux:  policy capability network_peer_controls=1
[ 1786.470383] SELinux:  policy capability open_perms=1
[ 1786.470383] SELinux:  policy capability extended_socket_class=1
[ 1786.470383] SELinux:  policy capability always_check_network=0
[ 1786.470384] SELinux:  policy capability cgroup_seclabel=1
[ 1786.470384] SELinux:  policy capability nnp_nosuid_transition=1
[ 1804.575674] SELinux:  Converting 2559 SID table entries...
[ 1807.034856] SELinux:  policy capability network_peer_controls=1
[ 1807.034857] SELinux:  policy capability open_perms=1
[ 1807.034858] SELinux:  policy capability extended_socket_class=1
[ 1807.034859] SELinux:  policy capability always_check_network=0
[ 1807.034859] SELinux:  policy capability cgroup_seclabel=1
[ 1807.034860] SELinux:  policy capability nnp_nosuid_transition=1
Using hostnamectl command

Simply run the following hostnamectl command on systemd based distros:
hostnamectl
Sample outputs:

   Static hostname: mum1-vpn1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 612892249edc4cf7b40cdfd1534feded
           Boot ID: f6285443d8544cb1a04878e0f2b13056
    Virtualization: kvm
  Operating System: Ubuntu 18.04.2 LTS
            Kernel: Linux 4.15.0-54-generic
      Architecture: x86-64

The above command displays both the Linux distribution and kernel version.

Solutie

Tip solutie

Permanent

Voteaza

(9 din 19 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?