Close

2018-02-04

Check the OS version in Linux.

Check OS version in Linux

Linux is a free and open source operating system. There are many variants of Linux out there. They are typically called Linux distribution. Suse, OpenSUSE, Debian, Ubuntu, CentOS, Arch, Fedora, RHEL all are common Linux distribution names. Knowing your os version and name can be very useful for security patches.

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

/etc/os-release file

Type the following cat command:

$ cat /etc/os-release

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

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

uname command

Just print Linux kernel version, run:

$ uname -r

Another option is to type the following command:

$ cat /proc/version

/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

Original article is https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/