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

It might be that you’re trying to buy a new Program for your PC or that you want to update your drivers; if that is the case then you might be asking yourself “What version Operating System am I using on my device?” This piece of info is quite vital for many Computer needs. Luckily, there are command line utilities that show us the version of the Windows OS running on the computer, including the service pack number. There are multiple CMD commands that help with finding this, you can pick the one that suits your need. “Ver” command can show you the OS version whereas “Systeminfo” command can additionally give you service pack, OS edition and build number etc. In this article we will describe how to find your OS version for the most common Operating Systems with Command Line.

Windows

  • Finding OS Version and Service Pack number from CMD

As we mentioned, the “ver” command displays the OS version. E.g.:

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 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:

Examples:

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.

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 version and name

cat /etc/os-release

lsb_release –a

hostnamectl

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

Look at the following example:

  • Type the following “cat” command:

Sample outputs:

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:

The 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 reveals the full release version of your operating system, including:

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

As mentioned previously, 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 command:

1
0
2 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x