How to view linux version

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 your Linux version: easy ways to view the distribution and version number

When most people think of Linux, an open source operating system that serves as an alternative to Microsoft and Apple comes to mind. But unlike these market leaders that offer commercial operating systems, there is no single Linux operating system.

Instead, there is a whole series of free, open-source operating systems (referred to as “distributions”) that are built based on the Linux kernel. This means that Linux merely serves as the basis for potential operating systems, which are then built from the kernel and other programming elements. While Microsoft and Apple release closed-source, proprietary software products, the Linux kernel is open-source code that any member of the Linux community can use or modify to make their own applications and operating systems.

Читайте также:  Windows service pack centre

Since there exist countless Linux versions, it’s of utmost importance to know which version you’re running, especially when you run into technical problems, have questions, or want to do an update. Luckily, it’s very easy to find out. Keep reading for instructions on how tocheck your Linux version.

Linux version: what do the distribution and version number mean?

As of June 2020, there are now over 500 unique Linux distributions. The best-known are Ubuntu, Debian, Fedora, SUSE, Manjaro, and Linux Mint.

The family tree for Ubuntu alone contains over 65 software applications built on the basis of Ubuntu. The current distribution was released in 2020 with the version number 20.04. The first version of Ubuntu came out in 2004 and was based on the Debian operating system.

The various Linux distributions can be roughly divided into three basic family trees as well as countless other smaller branches and independent versions. For example, the entire Ubuntu family is based on Debian, the distribution Fedora is based on Red Hat Linux, and SUSE used Slackware.

Even though they’re all based on the Linux kernel, the various distributions serve as their own operating systems with different GNU toolchains and graphic interfaces. In order to find your way in the busy Linux landscape, it’s important to know which version of the Linux kernel and which distribution you’re using.

Checking the Linux version in the terminal

Whether you’re using Linux privately or professionally, it’s always important to know which Linux version and distribution you’re working with. That way you’ll know which package manager you’ll need for downloading new tools and updates, and which Linux forum you should turn to when you have questions or experience problems.

If you’re looking for details about your Linux version, there are two words which will be of particular significance:

  1. The version number of the distribution
  2. The version of the Linux kernel

To find out these two values, you’ll need to use Linux commands. In general, when working in Linux, user input is entered into so-called “shells”, which are interfaces between systems and users. Shells run using a graphic terminal that processes the commands in the relevant programming language. This will serve as your starting point in checking your Linux version.

Step 1: Distribution version number

Open the Linux terminal with the keys [Ctrl] + [Alt] + [T] or by using the search function. Type the following command into the terminal and then press enter:

The asterisk in the code ensures that the command will apply to all distributions and shows you the installed version. The data that you see now may look a bit messy, with some lines appearing twice or several ending in “release”. The most important line here is “PRETTY_NAME=”, which contains the name of the distribution and version number that you’re currently using.

Another command that works on all distributions without the need for a special tool is the following:

If you only need the name and version number of your current distribution, the following command will suffice:

In the following example, you can see that Ubuntu 20.04 LTS is currently running:

The command “lsb_release -d” shows the current distribution and its version number.

The following command lists more comprehensive information about the version:

The command “lsb_release -a” shows additional information about the distribution version you’re currently running.

This command should work on every Linux distribution, as long as you’ve installed the lsb-release package or it’s part of your Ubuntu version. If you haven’t already installed it, you can easily do so with the following command for Debian and Ubuntu:

Step 2: Linux kernel version number

If you’d like to know which version of the Linux kernel you’re using, type the following command into the terminal and press enter:

The command “uname -r” shows the version of the Linux kernel that you’re currently using.

You’ll now see which Linux kernel you’re using. In the above example, the Linux kernel is 5.4.0-26.

Читайте также:  Можно ли обновить windows без потери данных

If you’d like to see more information (about computer architecture for example), you can enter the following command:

The command “uname -a” shows the version of the Linux kernel you’re using, as well as additional details.

Step 3: View everything at once with Inxi

With the tool Inxi, you can easily view all the information about your hardware, host, Linux kernel, desktop environment, and distribution. To install the program in Debian/Ubuntu, enter the following command into the terminal:

Once installed, you can view the above-mentioned data with this simple command:

  • 16.10.20
  • Know-how
  • How did you like the article? 0

    How to check Debian version: the quick and easy way

    Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.

    How to check your Ubuntu version: a guide

    Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.

    Remove a directory in Linux: a simple guide

    Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.

    Deleting files in Linux: a how-to guide

    Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command “rm”, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.

    Linux find command: search and find files

    While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.

    Источник

    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.

    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.

    Источник

    Читайте также:  Ravenfield b5 1 windows
Оцените статью