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


Reading Time: 4 minutes

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.

Windows 10 VPS Hosting

Get yourself an efficient Windows 10 VPS for remote desktop, at the cheapest price out there. FREE Windows 10 running on NVMe SSD storage and high-speed internet.

Check Out Windows 10 VPS Plans
Windows 10 VPS Hosting

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 the version on a Windows 7 system.

find os version with command line


✅Find OS version with Command Line for Linux

  • Using Release command

Linux VPS Hosting

Get yourself an economy or premium Linux VPS for hosting your website or remote desktop, at the cheapest price out there. VPS Running on Linux KVM for increased efficiency and working on powerful hardware with NVMe SSD storage for increased speed.

Check Out Linux VPS Plans
Linux VPS Hosting

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:

$ cat /etc/os-release

Sample outputs

✅Find OS version with Command Line in CentOS/Ubuntu

1. 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

2. 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 following command:



Leave A Comment

5 thoughts on “How to Find OS version with Command Line (Windows, Linux, CentOS, Ubuntu)”

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

  2. 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.

  3. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *