How to query your Linux system kernel | Virtual Reality

How much can your tell you about the kernel it's running and what commands are available to help you ask? Let's run through some of them.


The simplest and most straight-forward command for providing information on your kernel is the uname -r command. It provides a succinct answer to your question but in a format that also includes a number of fields each which provides a particular piece of information.

$ uname -r
^  ^ ^  ^    ^
|  | |  |    |
|  | |  |    |
|  | |  |    +-- the distribution-specific string
|  | |  +------- the latest bug fix
|  | +---------- the minor revision
|  +------------ the major revision
+--------------- the kernel version

Add an “s” and your output will include the kernel's name:

$ uname -sr
Linux 4.15.0-30-generic

In the first display above, you can see that each field has been annotated. If you use, the uname -a command instead, you will get quite a bit more information. In the display below, each of the fields is explained. Notice that the third field shows the same information we see above. The output is wrapped around below to make it easy to label the fields.

OK, so the kernel in this case is “4.15.0-30-generic,” and each portion of the name provides some detail on the kernel's identity. To add the the kernel's name, add the “s” swtich:

$ uname -a
Linux butterfly 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 
----- --------- ----------------- -------------------------------------------
  |       |            |                             |
  |       |            +- kernel version             +---- compilation stats
  |       +-- hostname
  +-- kernel name

x86_64 x86_64 x86_64 GNU/Linux
  |      |      |       |
  |      |      |       +-- operating system
  |      |      +---------- OS architecture
  |      +----------------- processor architecture
  +------------------------ machine architecture

The compilation stats shown on the right in the top line of the output above also tells you some interesting things.

  • #32-Ubuntu SMP –- the number of times this version of the kernel was compiled
  • Thu Jul 26 17:42:43 UTC 2018 –- the last time the kernel was compiled (timestamp)
  • x86_64 –- the machine architecture
  • x86_64 –- the processor architecture
  • x86_64 –- the OS architecture
  • GNU/Linux –- the operating system (distribution name not included)


In the following command, we see the Linux distribution name along with the kernel name. We also see some of the other information that the uname command provided.

$ cat /proc/version
Linux version 4.15.0-30-generic (buildd@lgw01-amd64-060) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018


On some systems, you can use the rpm command as shown below to provide information on your kernel.

$ rpm -q kernel


You can also extract kernel information from your dmesg output:

$ dmesg | grep Linux
[    0.000000] Linux version 4.15.0-30-generic (buildd@lgw01-amd64-060) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 (Ubuntu 4.15.0-30.32-generic 4.15.18)
[    0.052298] ACPI: Added _OSI(Linux-Dell-Video)
[    0.885913] Linux agpgart interface v0.103
[    0.908086] usb usb1: Manufacturer: Linux 4.15.0-30-generic ehci_hcd
[    0.928062] usb usb2: Manufacturer: Linux 4.15.0-30-generic ehci_hcd
[    0.928516] usb usb3: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    0.928838] usb usb4: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    0.929146] usb usb5: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    0.929450] usb usb6: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    0.929758] usb usb7: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    0.930065] usb usb8: Manufacturer: Linux 4.15.0-30-generic uhci_hcd
[    1.873372] pps_core: LinuxPPS API ver. 1 registered


The dpkg command can also be used to identify the kernel version. Notice that in the output shown below, we see both the current and prior kernel versions.

$ sudo dpkg -l | grep linux-headers | grep ii | awk '{print }' | tail -1
$ sudo dpkg -l | grep linux-headers | grep ii | awk '{print }'


There are many commands on Linux to help you get information on the kernel that your system is using. I hope this post adds some insight into what all those numbers and designations represent.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

You might also like

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More