What linux version terminal

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

Читайте также:  Windows 10 сборка 1909 как активировать

Источник

Linux Command: Show Linux Version

[a] uname – Print kernel and system information.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time 1m

[b] lsb_release – Print distribution-specific information. [c] /proc/version file – Print running kernel information.

How to check linux kernel version number?

Open a shell prompt (or a terminal) and type the following command to see your current Linux kernel version:
$ uname -r
Sample outputs:

Or type the following command:
$ uname -mrs
Sample outputs:

To print all information, enter:
$ uname -a
Sample outputs:

  • 2.6.32-23 – Linux kernel version number
  • pae – pae kernel type indicate that I’m accssing more than 4GB ram using 32 bit kernel.
  • SMP – Kernel that supports multi core and multiple cpus.

/proc/version file

Type the following command to see Linux version info:
$ cat /proc/version
Sample outputs:

The above output identifies the kernel version that is currently running. It includes the contents of /proc/sys/kernel/ostype , /proc/sys/kernel/osrelease , and /proc/sys/kernel/version files. For example:
$ cat /proc/sys/kernel/
Sample outputs:

Find Distribution Version

Type the following command:
$ cat /etc/*release
OR
$ lsb_release -a
Sample outputs:

Here is another output from my Debian based server:

  • 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

This tutorial is also available in a quick video format:

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

Источник

Ubuntu Documentation

Checking your Ubuntu Version

There are two ways to check which version of Ubuntu you are running. You can either check from within Unity, or put in a short command line in the Terminal.

In Unity

Unity is the default desktop environment since Ubuntu 11.04 (Natty Narwhal). Please note that this method will only show a partial version number. If you need a full version number like 14.04.1 LTS instead of 14.04 LTS you will need to use the terminal method.

Open System Settings

Click on Details

Your version will be shown under the Ubuntu logo.

In the Terminal

This method will work no matter which version of Ubuntu or desktop environment you are running.

Open the Terminal (keyboard shortcut: Ctrl+Alt+T)

Enter the command lsb_release -a

Your version will be shown on the Description line.

CheckingYourUbuntuVersion (последним исправлял пользователь blenderudit3d 2014-11-18 13:52:51)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

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.

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.

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
Оцените статью