Method of Decrypting Linux Version Information

  • 2021-08-17 01:48:56
  • OfStack

Displaying and interpreting information about Linux version is more complicated than it seems.

Unlike referring to a simple version number, there are many ways to identify Linux versions. Even a quick look at the output of the uname command can tell you something. What is this information and what does it tell you?

In this article, we'll take a closer look at the output of the uname command and the version notes provided by a few other commands and files.

Using uname

Whenever the commands uname-a are executed in the Linux system terminal window, a lot of information is displayed. That's because this little a tells the uname command that you want to see all the output that the command can provide. The results will show you a lot of information about the system. In fact, every piece of information displayed will tell you something different about the system.

For example, the uname-a output looks like this:


$ uname -a
Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Although this may not be very important, you can display the same information using 1 containing all uname options in the appropriate order:


$ uname -snmrvpio
Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

To break down this long string of information into individual blocks, you can use an for loop like this to iterate through each option:


$ for option in s n m r v p i o; do echo -n "$option: "; uname -$option; done
s: Linux
n: dragonfly
m: x86_64
r: 5.4.0-37-generic
v: #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020
p: x86_64
i: x86_64
o: GNU/Linux

The loop shows what information this option provides. The uname man page provides a description of each option. Here's the list:

Linux-Kernel name (option s) dragonfly-Node name (option n) x86_64-Machine hardware name (option m) 5.4. 0-37-generic-Kernel Release (option r) # 41-Ubuntu SMP Wed Jun 3 18:57: 02 UTC 2020-Kernel version (option v) x86_64-Processor (Option p) x86_64-Hardware Platform (Option i) GNU/Linux-Operating System (Option o)

To study the displayed information more deeply, please carefully check the displayed kernel release data. The 5.4. 0-37 in line 4 is not just a string of arbitrary numbers. Every number matters.

5 for kernel version 4 represents the major version 0 for minor version 37 indicates the latest patch

In addition, # 41 in line 5 (kernel version) of the output in the loop above indicates that this release has been compiled 41 times.

If you only want to display one item of all information, a single option may be useful. For example, the commands uname-n can only tell you the system name, while uname-r can only tell you the kernel release. These and other options may be useful when taking stock of servers or building scripts.

On an Red Hat system, the uname-a commands provide the same kind of information. This is an example:


$ uname -a
Linux fruitfly 4.18.0-107.el8.x86_64 #1 SMP Fri Jun 14 13:46:34 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Release information

If you need to know what distribution is running, the output of uname won't help you much. After all, the kernel version is different from the distribution version. For this information, you can use the command lsb_release-r on Ubuntu and other Debian-based systems, while the contents of the file /etc/redhat-release can be displayed on Red Hat.

For Debian systems:


$ lsb_release -r
Release: 20.04

For Red, Hat and related systems:


$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 Beta (Ootpa)

Us/proc/version

The/proc/version file can also provide information about the Linux version. The information provided in this file has a lot in common with the uname-a output. Here are examples.

On Ubuntu:


$ cat /proc/version
Linux version 5.4.0-37-generic (buildd@lcy01-amd64-001) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020
 

On RedHat:


$ cat /proc/version
Linux version 4.18.0-107.el8.x86_64 (mockbuild@x86-vm-09.build.eng.bos.redhat.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Fri Jun 14 13:46:34 UTC 2019

Summarize

The Linux system provides a lot of information about kernel and distribution installations. You just need to know where or how to find it and understand its meaning.


Related articles: