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:
Press Windows Key+R to launch the Run dialog box.
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 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
Note: For finding the Linux kernel version, type the following command: uname –r
Look at the following example:
- Type the following “cat” command:
✅Find OS version with Command Line in CentOS/Ubuntu
Using cat-release commands
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: