How to Check OS Version from Command Line

3

Linux is a formidable running machine that’s loose and open-source. Because it’s open-source, Linux is to be had in a large number of permutations. Generally, every variant is referred to as a Linux distribution (often referred to as Linux distro). You could have already heard the identify of the massive ones like Ubuntu, Debian, RHEL, Fedora, Arch Linux, SUSE, and so on.

Knowing the identify and model of a distro is necessary for customers and directors. The data is vital in a large number of eventualities like putting in new apps or options, troubleshooting, and so on. This information will exhibit find out how to take a look at the OS model from the command line on Linux.

Checking the running machine model

Here are one of the most most straightforward techniques of checking the running machine model. Almost all of those strategies will have to practice to any Linux distro. These strategies make the most of the integrated equipment and have Linux comes with.

Checking OS model from /and so on/os-release
In Linux, the os-release document comprises more than a few details about the machine. There are two copies of the document at two other places.

$ /and so on/os-release
$ /usr/lib/os-release

Interestingly, the document situated at /and so on/os-release will take priority over /usr/lib/os-release.

It comprises data within the structure of a newline-separated record of more than a few variables. It comprises information like OS identify, model, model ID, builds ID, and so on.

To take a look at the content material of the os-release document, run the next command.

Note that the output will range from one Linux distro to every other. This document will best be to be had if the OS makes use of the systemd because the init machine.

Here are some examples that fine-tune the content material of os-release to print best particular main points. The following command will print best the model and identify of the OS.

$ egrep ‘^(VERSION|NAME)=’ /and so on/os-release

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969002 132 How to Check OS Version from Command Line

To take a look at the model of the OS best, run the next command as a substitute.

$ grep ‘^VERSION’ /and so on/os-release

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969002 371 How to Check OS Version from Command Line

Checking OS model the usage of lsb_release
The lsb_release device supplies positive LSB (Linux Standard Base) and distro-specific information. Generally, lsb_release is used within the following structure.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969003 893 How to Check OS Version from Command Line

Here, the flag “-a” tells lsb_release to print all of the information concerning the OS it can give. Alternatively, you’ll print a minimum record the usage of the flag “-s” or “–short”. It will put out of your mind the headers within the output.

$ lsb_release –all –short

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969003 644 How to Check OS Version from Command Line

This device additionally helps printing one particular piece of data at a time. For instance, to print best the OS description, use the flag “-d” or “–description”.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969004 793 How to Check OS Version from Command Line

To show the codename of the present OS, use the flag “-c” or “–codename”.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969004 739 How to Check OS Version from Command Line

The guy web page comprises an in-depth description of all of the to be had choices.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969005 158 How to Check OS Version from Command Line

Checking OS model the usage of hostnamectl
The hostnamectl command is liable for managing the Linux machine hostname and similar settings. It too can print a bunch of information at the machine and running machine.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969005 384 How to Check OS Version from Command Line

Checking OS model the usage of uname
Similar to lsb_release and hostnamectl, uname is every other device to record more than a few information concerning the device and running machine. However, the output is a little more disorganized in comparison to hostnamectl output.

To print all of the details about the machine, run the next uname command. Here, the flag “-a” tells uname to print all of the supported information.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969006 732 How to Check OS Version from Command Line

We too can inform uname to print best particular element. For instance, the flag “-v” or “–kernel-version” will print the kernel model.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969006 388 How to Check OS Version from Command Line

The following uname command will print the running machine label.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969007 267 How to Check OS Version from Command Line

For all of the to be had choices and their explanations, take a look at the person web page.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969008 567 How to Check OS Version from Command Line

Checking OS model from /and so on/factor
The document /and so on/factor shops machine id data. It’s typically proven prior to you’re induced to log in in your account. Check the content material of the document.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969008 367 How to Check OS Version from Command Line

Checking OS model the usage of /proc/model
It’s a textual content document that incorporates details about the Linux kernel.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969009 65 How to Check OS Version from Command Line

Checking OS model the usage of /and so on/*launch
If not one of the aforementioned strategies succeeded, then it’s extremely most likely that you just’re working an excessively outdated Linux machine. If that’s the case, then we need to make the most of an excessively rudimentary approach of checking OS data.

Run the next command.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969009 96 How to Check OS Version from Command Line

Here, cat will learn and print the content material of all of the information that fit the trend. You can take a look at what information we’re studying from.

How to Check OS Version from Command Line How to Check OS Version from Command Line 1632969010 173 How to Check OS Version from Command Line

Final ideas

This information demonstrates find out how to take a look at the model of the Linux running machine working at the device. Although there are lots of third-party equipment, we will reach it the usage of the integrated equipment and lines best.

The model of a Linux running machine is the most important piece of data. Generally, Linux programs are constructed to paintings with a specific Linux model in thoughts. Knowing the Linux model can assist in troubleshooting surprising behaviors or mistakes. It’s additionally vital when a brand new model of the Linux distro is launched. It’s easy but a very powerful information to stay monitor of.

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