Check linux version and os

How to check os version in Linux command line

Check os version in Linux

The procedure to find os name and version on Linux:

  1. Open the terminal application (bash shell)
  2. For remote server login using the ssh: ssh user@server-name
  3. Type any one of the following command to find os name and version in Linux:
    cat /etc/os-release
    lsb_release -a
    hostnamectl
  4. Type the following command to find Linux kernel version:
    uname -r

Let us see all examples in details for common Linux distros.

The /etc/os-release file

Type the following cat command:
$ cat /etc/os-release
Sample outputs:

We can filter out information such as OS version and name using the grep command/egrep command as follows:
$ grep ‘^VERSION’ /etc/os-release
$ egrep ‘^(VERSION|NAME)=’ /etc/os-release
Here is what we see:

Even tiny Linux distro such as Alpine Linux provide the required OS (Operating system) information, including version:

Checking OS version on Linux using the lsb_release command

The lsb_release command gives LSB (Linux Standard Base) and distribution-specific information on the CLI. The syntax is:
$ lsb_release -a
Sample outputs:

hostnamectl command

Use hostnamectl command to query and change the system hostname and related settings. Just type the following command to check OS name and Linux kernel version:
$ hostnamectl
And it will give info as follows. Look out for “ Operating System ” and “ Kernel “:

Another outputs from my OpenSUSE Linux 15.2 server:

uname command

/etc/issue file

Use more command/less command as follows:
$ cat /etc/issue
$ more /etc/issue
$ less /etc/issue

Getting help

You can also view the manual page on uname using the following command:
$ man hostnamectl
$ man uname
$ man cat

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Conclusion

We explained how to find and display the OS version on Linux. The safest option is to query /etc/os-release file using grep or cat command. Systemd based Linux distro users can use the hostnamectl command.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

How to Check OS Version in Linux

Linux version can be checked using inbuilt commands or can read from specific files. It is important to determine the distribution name and version on many occasion like when doing package updates or OS update.

There are a lot of Linux distributions available like Debian, Ubuntu, CentOS, Mint, Arch, Fedora, RHEL, and more.

In this tutorial, I will show how to check the Linux version from the command line.

Check Linux Version

There are mainly 5 ways we can get Linux distribution name and its version.

1. From /etc/os-release

Use cat command to read the content of the file /etc/os-release , run the following command:

Output from CentOS

Output from Ubuntu

2. Using lsb_release command

The lsb_release -a displays the Linux version information from the command line. The output will display distribution ID, description, release and codename. To display only the description you can use lsb_release -d .

Читайте также:  Font san francisco для windows

If you get «command not found» and then you need to install ‘lsb-core’ package.

Output of lsb_release -a

To display only the description, run:

3. Using Hostnamectl command

In modern Linux distributions which use systemd init systems, you can use hostnamectl command to display operating system version.

4. From /etc/issue file

You can get version information from /etc/issue file, to read file content use cat or less command:

5. From /etc/*release or /etc/*version

Some distribution use release and version file and those files are specific to that distro.

$ echo /etc/*version /etc/*release
/etc/debian_version /etc/ec2_version /etc/lsb-release /etc/os-release

To read the content from /etc/*release or /etc/*version, run the following command:

If you are interested to know the Linux kernel version and architecture then use uname command or you can read the content from /proc/version file.

Conclusion

In this tutorial, we learned different ways to find Linux OS name and version from I hope you enjoyed reading and please leave your suggestion in the below comment section.

Источник

How to Check the OS version in Linux

There are number of ways through which you can check the version of OS in a Linux system. In this article, we will explain both graphical and the command-line ways to obtain the OS version of a Linux system.

We have used Debian 10 OS for explaining the commands and methods mentioned in this article.

Check OS Version via Graphical User Interface

To check the OS version via the graphical user interface, follow the below steps:

Step 1: First, you will need to open the Settings utility in your system. To do so, right-click n your desktop and click Settings as shown in the following screenshot:

Alternatively, you can also search for the Settings utility from the Applications menu. Hit the super key on your keyboard and in the search bar type settings. When the Settings icon appears, click on it to open.

Step 2: In the Settings utility, go to the Details tab as shown in the following screenshot.

Step 3: When you click the Details tab, the following window will appear by default in About view. Here you will find the version of your OS which in our case is Debian 10. Apart from the version information, you will find some other information as well such as memory, processor, graphics, OS type, and disk size etc.

Check OS Version via Command-line Terminal

Following are some command-line ways through which you can view the OS version in your system.

Open the command line Terminal by hitting the super key on your keyboard and searching for the Terminal application by typing its keyword in the search bar. When the Terminal icon appears, click on it to open.

Using the lsb_release command

The lsb_release command allows you to find LSB (Linux Standard Base) information about your Linux distribution that includes release number, codename, and the distributor ID.

In some Linux distributions because of minimal installation of OS or some other reason, the lsb_release command might be missing from your system. In that case, if you run lsb_release command, you may receive the error “No LSB modules are available”.

To solve this issue, you have to first install lsb_release using the apt-get command as follows:

Once installed, you can then run the following lsb_release command in order to view the version of your OS along with other information:

From the below output, you can see the LSB information specific to our distribution that includes the release number or the version number of our OS that is Debian 10.

If you just want to print out the version information instead of whole LSB information, use lsb_release with the –d switch as follows:

will just print the description line showing the version number.

Using /etc/issue file

In /etc/issue file, system identification text is stored which is displayed before the login prompts. This file normally contains info about the Linux version which you can view using the cat command as follows:

The above command only displays the version number of your OS. However, if you need to know the OS version with the point releases, enter the following command:

Using /etc/os-release file

The /etc/ost-release file is a configuration file that is the part of the systemd package which contains OS identification data. You will find this command only in the latest Linux distribution. Using the /etc/os-release command, you can obtain the version information of your OS.

Читайте также:  Случайно удалил значок блютуз windows 10

To display the contents of the os-release file, run the following command in Terminal:

Using hostnamectl command

The hostnamectl command is also a part of the systemd package. Generally, it is used to check and modify the hostname. However, you can also use it to check the version of your OS. Similar to the above command, hostnamectl command also works on the latest Linux distributions.

To use this command for viewing the OS version, run the following command in Terminal:

Check Kernel version

If you want to find out the kernel version of your system along with the OS version, following are some command-line ways to do so:

Using uname command

The uname command is used to display basic system information. To find the kernel version, you can use uname with –r option as follows:

You will receive the output similar to this:

From the above output, you can see the Linux kernel that we are running is 4.19.0-5-amd64 where:

  • 4 is the kernel version
  • 19 is the major revision
  • 0 is the minor revision
  • 5 is the patch number
  • Amd64 is the architecture information

Using dmesg command

The dmesg command is generally used to examine kernel boot messages and to debug hardware-related problems. However, we can also use it to check the version of the kernel. Pipe the dmesg with the grep command as follows to view the kernel information:

You will find the kernel version in the first line of the output.

Using /proc/version

The /proc/version file also contains the Linux kernel information. To view this file, use the following command in Terminal:

You will see the output similar to the below screenshot displaying the kernel version in the first line.

Note: You can check Out Debian Latest versions including the old releases at the following official page:

In this article, we have covered some ways including both the graphical and the command line through which you can view the version of OS as well as the version of kernel you are running on your system.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

Источник

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

Updated on September 9, 2020

This article will guide you on how to find os version with 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 and Linux get OS version as well. That includes the service pack number.

Multiple CMD commands help with finding how to check OS version in Linux and the Linux get OS version. You can pick the one that suits your need. The ver command can show you how to check OS version in Linux and the Linux get OS version as well. Whereas the system-info command can give you the service pack, OS edition, build number.
Therefore, in this article, we will describe how to check OS version in Linux and for the most common Operating Systems with Command-Line.

✅Find OS version with Command Line for Windows

To find Windows 10 version and Service Pack number from CMD is not difficult. As we mentioned, the “ver” command displays help to find Windows 10 version. Go to the Command Prompt and type the following command:

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

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.

The “ver” does not show the service pack number when you find Windows 10 version, so we use the “systeminfo” command to check windows 10 version command line. But “Systeminfo” dumps a lot of other information too when you check windows 10 version command line, which we can filter out using the “findstr” command:

Читайте также:  Astra linux открыть сетевую папку

Step 1: Run dialog box

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

open launch section

Step 2: Go to command prompt

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 for Linux

Step 1: Open the terminal application

Open the terminal application (Linux bash shell) for how to check Linux version command.

Note: For remote server login using the ssh:

Step 2: Type below commands

Type any one of the below commands to see how to check Linux version command to find the version and name:

cat /etc/os-releaselsb_release –ahostnamectl

Note: For how to check Linux version command, type the following:

Look at the following example to check Linux version:

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.

✅Find OS version with Command Line in CentOS/Ubuntu

Step 1: Using cat-release commands

The previously explained commands can also apply to CentOS and Ubuntu.

If you are looking to check Linux version distro and the major release version that is installed at your side, you can use the following command to open the release file.

When you run the command to check Linux version, the output will reveal the name of your operating system. Not only this but it will reveal the major release version and other specifications as well. Here is a pictorial representation of how things will work here when you check Linux version ubuntu.

Note: if you are looking to check Linux version ubuntu and the full release version you can use the following command.

When you run this command to check Linux version ubuntu, its output will reveal the full release version of your OS. It will include the following release numbers:

  • Major release number
  • Minor release number
  • Asynchronous release number

Step 2: Using hostnamectl command

As mentioned before, you can also use “hostnamectl” instead of the other commands for the Linux version command line. We will also describe an example using hostnamectl.
“hostnamectl” can query and change the hostname and other related settings for getting Linux version command line. 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 for getting Linux version command line:

Buy yourself an affordable VPS hosting service with CentOS to run your server on it. With more than 15 available locations, order your preferred VPS plan and simultaneously run multiple virtual machines on Windows or Linux images, or install other control panels like Plesk or cPanel.

Conclusion

No matter which operating system you use you can figure out your OS version in various ways. It is not a hard process and as you can see it’s just a few clicks or commands. Knowing your OS version helps you in many ways like when you want to install an application on your system. Well, with all this in mind, were you able to check your OS version using the things we said?

What is an OS version?

Your computers are running on some OS and that OS gets several updates regularly. With each update, the version changes, and this is called the OS version.

Is Microsoft an OS?

Microsoft itself is not an OS but it provides one of the most commonly used Operating Systems called Microsoft Windows.

What is the Best OS for a low-end PC?

Ubuntu is an OS that is good for all kinds of computers. Its several versions can run on most computers. However, it is better to know the version before using it regularly for the best results.

Источник

Оцените статью