How to Find OS version with Command Line (Windows, Linux, CentOS, Ubuntu)

This article will guide you on how to find the OS system with the command line. You know, there are many variants of operating systems such as Windows OS and Linux OS (as well as its distributions). It might be that you’re trying to buy a new Program for your PC or that you want to update your drivers. In this case, you might be asking yourself about the version of the Operating System that you are using on your device.
This piece of information is quite vital for many Computer needs. Luckily command-line utilities show us the version of the Windows OS running on the computer. That includes the service pack number.
Multiple CMD commands help with finding this. You can pick the one that suits your need. The ver command can show you the OS version. Whereas the system-info command can give you the service pack, OS edition, build number.
Therefore, in this article, we will describe how to find your OS version for the most common Operating Systems with Command-Line.

✅Find OS version with Command Line for Windows

Finding OS Version and Service Pack number from CMD is not difficult. As we mentioned, the “ver” command displays the OS version. The following is the example of that:

However, you usually require other pieces of important info as well, such as the service pack number.

The “ver” does not show the service pack number so we use the “systeminfo” command. But “Systeminfo” dumps a lot of other information too, which we can filter out using the “findstr” command:

Step 1:

Press Windows Key+R to launch the Run dialog box.

Step 2:

Type “cmd” (without the quotations), then click OK. This should open Command Prompt.

The first line you see inside Command Prompt is your Windows OS version. If you want to know more information about your operating system,

follow this command:



Note: This command also works on XP, Vista and Windows 7 as well as Server editions.

  • For Windows 7:

Note: The output would be slightly different for Windows 7 SP1:

If you do want to print more details, then you can simply use ‘OS’ in the “findstr” search pattern. The example below is for Server 2008. Note that this command does not show version on a Windows 7 system.

find os version with command line


✅Find OS version with Command Line for Linux

  • Using Release command

Step 1: Open the terminal application (bash shell)

Note: For remote server login using the ssh: ssh [email protected]

Step 2: Type any one of the following commands to find the version and name

cat /etc/os-release

lsb_release –a


Note: For finding the Linux kernel version, type the following command: uname –r

Look at the following example:

  • Type the following “cat” command:

Sample outputs:

✅Find OS version with Command Line in CentOS/Ubuntu

  • Using cat-release commands

The previously explained commands can also apply to CentOS and Ubuntu. To check which Linux distro and major release version you have installed, open the release file using the command:

This output reveals the name of the operating system. Its major release version and other specifics, as displayed in the image below:

Note: To see the full release version, use the command:

The output of this command reveals the full release version of your operating system, including:

  • Major release number
  • Minor release number
  • Asynchronous release number
  • Using hostnamectl command

As mentioned before, you can also use hostnamectl instead of the other commands. We will also describe an example using hostnamectl:

Hostnamectl can query and change the hostname and other related settings. It displays information from the /etc/centos-release file, uname –a file, and others. In addition to the version number, it shows which Linux kernel your system is using.

To see these specifics, use the followng command:

3.5 2 votes
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments

Is there a command to find all hidden files in linux at once?


How to find the OS version without using the command line? I really don’t know my way around using commands 🙂


Thank you for this very complete guide. But here is a suggestion; I preferred to see an article about finding os version with actual codes to use. But this is helpful too.


Hey there, thanks for the great article. What is the way to find the mac os version?


I used the command you mentioned for windows 8.1 and when I typed systeminfo, the system said it was unrecognized. What did I do wrong?

Would love your thoughts, please comment.x