What version of Linux do I have? Find out at command line

last updated in Categories , , , , ,

I am a new Linux system user and developer. What version of Linux do I have? What’s my OS and How do I find out from the command line? How do I check Linux version from the GUI or the CLI?

Introduction: Linux is a free and open source operating system (OS). An OS used to control your desktop/laptop hardware, runs apps, manages users and permissions, and more. It also controls various resources and runs multiple server apps such as Nginx, MySQL, PHP and more.

Command to find of what version of Linux am I running?

  1. lsb_release -a – Best command to print Linux version
  2. hostnamectl – See Linux name and version
  3. cat /etc/*release – Show Linux version and distro info
  4. uname -a : Display system information

What version of Linux do I have? Find out at command line

Open the terminal application and type the following command to see Linux version:
What version of Linux do I have
Look for “Operating System” in above screen shot. One can use the grep command or egrep command as follows:
hostnamectl | grep "Operating System"
hostnamectl | egrep "(System|Kernel)"

Sample outputs:

  Operating System: CentOS Linux 7 (Core)
            Kernel: Linux 3.10.0-862.14.4.el7.x86_64

Here is another output from my RHEL server/vm running at cloud data center:
$ hostnamectl
Sample outputs:

   Static hostname: rhel7-nixcraft
         Icon name: computer-vm
           Chassis: vm
        Machine ID: bfce903b80a54432b8b992b24603144d
           Boot ID: 97227bae46f8413a946110683f9d5ed1
    Virtualization: kvm
  Operating System: Red Hat Enterprise Linux
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.5:GA:server
            Kernel: Linux 3.10.0-862.14.4.el7.x86_64
      Architecture: x86-64

Command to find version of Linux

Another option that works is to issue the lsb_release command:
lsb_release -a
What's my OS?
The command indicates that I am using “SUSE Linux Enterprise Server 12 SP3” release 12.3. Here is another output from my Debian server:

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.6 (stretch)
Release:	9.6
Codename:	stretch

What’s the version of my OS?

If above command not working try the following cat command:
$ cat /etc/*release
Here is output from my Fedora Linux box:

Fedora release 28 (Twenty Eight)
VERSION="28 (Twenty Eight)"
PRETTY_NAME="Fedora 28 (Twenty Eight)"
Fedora release 28 (Twenty Eight)
Fedora release 28 (Twenty Eight)

Find Linux Kernel version command

Simply type the following cat command or uname command:
$ uname
$ uname -mrs
$ uname -a
$ cat /proc/version

Find Linux Kernel version command

A note about GUI method

Go to your Linux system settings and and click on details. You will see info as follows:

Checking your Ubuntu Version using GUI
Checking your Ubuntu Version using GUI


You just learn various command to get information about your Linux disro.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

5 comment

  1. Since others have added their oses, I am going to add IBM AIX info ;)
    oslevel -r
    uname -a
    lslpp -h bos.rte

    Still, have a question? Get help on our forum!