How to Find OS Version with a Command Line for Windows, CentOS, Linux, Ubuntu

Whenever you are going to upgrade some software or to buy a new one, you need to know your OS version. It is important to know it if you want your device to function properly. 

Nowadays, it is not a secret. There are many options to find out what your OS version is. There are many command line utilities that can be used for it. There are a lot of CMD commands that you can use.

For instance, a Ver command shows you the version of the Operating System. Systeminfo command will tell you about your service pack, the edition, the build number of your OS, and so on. 

Now, we will check how to find the OS version for the most used operating systems with a command line.

Finding OS Version for Windows

The OS version is displayed with “Ver” command.

how to find os version with a command line for windows, centos, linux, ubuntu

Sometimes, you might need other information, too. It can be found with other commands.

“Systeminfo” command shows you the service pack and much more data about your OS. These data can be filtered with the “findstr” command. Now, let us check all in detail.

Step 1

  • Press Windows Key and R. It will start the Dialogue box.
  • Now type cmd. Click Ok. Command prompt will open.
  • In the first line, you see the version of Windows OS.
  • Now, let us check how to find out more information about your system. To do so, execute the command:

how to find os version with a command line for windows, centos, linux, ubuntu

Some examples are given further.

Example 1

how to find os version with a command line for windows, centos, linux, ubuntu

 

Example 2

Windows 7

how to find os version with a command line for windows, centos, linux, ubuntu

If you want to find out more data, in the findstr search, use OS. You will get much more data:

how to find os version with a command line for windows, centos, linux, ubuntu

Finding OS Version for Linux

For Linux, you can use the Release command. Follow the instructions.

Step 1

Open the bash shell. If you use a remote server, use SSH login.

Step 2

Further, any of these commands will provide you the needed information:

  • cat /etc/os-release
  • lsb_release –a
  • hostnamectl

The command uname-r is used to find out what Linux kernel version is.

Finding OS for CentOS/Ubuntu

The previous instructions can be perfectly used for CentOS and Ubuntu. 

The major release version can be checked via release file. For that, execute the command

  • Cat /etc/os-release

You will get the OS name. It will give also the major release version and other relevant information.

how to find os version with a command line for windows, centos, linux, ubuntu

If you want to check the full release data, execute the command

  • Cat /etc/centos-release

Now, you will get a full release data, including such details as major and minor release numbers, asynchronous release number.

how to find os version with a command line for windows, centos, linux, ubuntu

Another option is to use a hostnamectl command. It queries and changes the hostname and other settings. It even shows the Linux kernel system.

Thus, to get the data with hostnamectl command, execute the command, and all the data will be shown.

Blog