How To Know Which Linux Distribution You Are Using?

Here are a few ways to find out which Linux distro you are using :

  • From the Boot Time messages
    Fire up your favorite terminal program and type in the following

    dmesg | head -1


    The output would be similar to:

    Linux version 4.9.0-5-amd64 ([email protected]) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)

  • Using /proc/version
    In the terminal type

    cat /proc/version


    The output would be like:

    Linux version 4.9.0-5-amd64 ([email protected]) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)

  • Using /etc/issue
    This method gives the most appropriate answer on older Linux Distributions.

    cat /etc/issue


    The output should be like:

    Debian GNU/Linux 9 \n \l

  • Using /etc/os-release
    This method works best on modern Linux distributions.

    cat /etc/os-release


    The output should be like:

    PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
    NAME="Debian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"

The original source is here

Share this page:

Suggested articles

24 Comment(s)

Add comment

Comments

By: Anonymous at: 2006-06-15 22:46:20

You might want to try
cat /etc/slackware-version

None of the methods you listed work on my distro - of course I'm running my own kernel.

By: Anonymous at: 2006-06-15 17:21:11

Look for


/etc/SuSE-release
/etc/redhat-release
/etc/debian_version

By: arun at: 2006-06-16 02:55:37

thanks, i added this info as a shell script in the article :)

By: Anonymous at: 2010-04-27 03:17:45

It really is utterly daft that there is no standard way of doing this. The fact that such a long page exists on this topic is itself disappointing.  We need something like

uname -distro

Or  would that be too sensible?

By: amit at: 2011-05-27 09:04:02

I completely agree with you

By: QBall at: 2012-02-13 11:57:04

OR better yet, just:

[[email protected] ~]$ distro

 or

[[email protected] ~]$ distro -[option]

with options like: -kernel-name, - kernel-release, -kernel-version, -machine, -processor, hardware-platform, -operating-system, -distrib-id, etcetera

Plus any other info that would be helpful (got OPTIONs from uname --help).

By: Anonymous at: 2006-06-15 17:31:56

Another command to find out your Kernel Version and what box you're on ;-)

uname -a

Will show you:

Linux myhost.mydomain.tld 2.6.8-2-686-smp #1 SMP Tue Aug 16 12:08:30 UTC 2005 i686 GNU/Linux

By: arun at: 2006-06-16 02:48:55

Another command to find out your Kernel Version and what box you're on ;-)

uname -a

Will show you:

Linux myhost.mydomain.tld 2.6.8-2-686-smp #1 SMP Tue Aug 16 12:08:30 UTC 2005 i686 GNU/Linux

But it won't show you which linux distribution you are using !!

By: Anonymous at: 2006-06-15 18:02:29

Actually, methods one and two are the same, since both return the kernel identification string. Both of these will not work on distributions which do not put their name into the kernel ID (such as AFAIR slackware) or on systems with a custom kernel.

Method 3 is completely ridiculous, since almost nobody pays attention to issue file nowadays. My gentoo box returns:

# cat /etc/issue
This is \n.\O (\s \m \r) \t

By: at: 2007-07-26 03:28:41

================== 

"Method 3 is completely ridiculous, since almost nobody pays attention to issue file nowadays. My gentoo box returns:

"# cat /etc/issue
This is \n.\O (\s \m \r) \t"

================= 

 It's not ridiculous if it works and it works for me.  So give it a try.  It may work for you, too:

#cat /etc/issue

Red Hat Enterprise Linux ES release 4 (Nahant Update 5) 

 

 

By: EvanCarroll at: 2006-06-16 04:20:08

egrep '^[^#]*title' /boot/grub/menu.lst | grep -v 'memtest'

By: arun at: 2006-06-16 04:46:48

I think you've to use that as superuser sudo egrep '^[^#]*title' /boot/grub/menu.lst | grep -v 'memtest' should do the work ;-) It won't work if you are using Lilo..

By: Anonymous at: 2006-06-17 18:05:32

I have also created a tool called osinfo to report your distrib. More info here.


Fred

By: Anonymous at: 2006-07-01 19:57:46

lsb_release -a

By: Anonymous at: 2009-01-30 16:18:19

The /etc/issue file should not be trusted, the file is intended as a text message to be displayed before login for telnet, or after the username has been entered with SSH. The issue file was never intended for storing a distribution version, the fact most distros put something there is merely coincidental branding (coz it's nice to have something in there)

 A better indicator of the distribution is to `echo /etc/*release`


By: Anonymous at: 2010-07-10 13:32:31

You can also do:

cat /etc/*-release

By: Anish Sneh at: 2010-08-30 09:20:35

Thanks mate "cat /etc/*-release", gave the most appropriate one :)

 

-- Anish Sneh

By: Anonymous at: 2010-09-20 13:05:01

Debian squeeze: 

#  cat /etc/*-release
cat: /etc/*-release: No such file or directory

It seems that *release is distro specific

 

By: Anonymous at: 2011-11-16 15:55:33

vm-105:~# cat /etc/issue
Debian GNU/Linux 6.0 \n \l

but

vm-105:~# cat /proc/version
Linux version 2.6.18-xen ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)) #2 SMP Wed Apr 16 12:47:36 CDT 2008
 

So, it's a debian with a red hat kernel?

I'm confused,

 M

By: Anonymous at: 2012-11-14 00:18:48

There seems to be some sort of standard /etc/os-release thing. It at least exists on Ubuntu and Arch.

By: Santiago at: 2016-08-02 14:59:19

Hi dude.

 

You can execute the following in order to know exactly your version, among with another helpful information.

 

cat /etc/*-release

 

In my case returns:

 

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=14.04

DISTRIB_CODENAME=trusty

DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"

NAME="Ubuntu"

VERSION="14.04, Trusty Tahr"

ID=ubuntu

ID_LIKE=debian

PRETTY_NAME="Ubuntu 14.04 LTS"

VERSION_ID="14.04"

HOME_URL="http://www.ubuntu.com/"

SUPPORT_URL="http://help.ubuntu.com/"

BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

 

By: John at: 2017-06-23 06:37:00

The "cat /ect/issue"  told me that my mint upgrade had been done successfully. Thanks I wasn't sure and it took a while. Upgraded from Linux Mint 17.3 Rosa to Linux Mint 18.1 Sarena or Sarah or something. Bunch of packages were transferred so I am sure there will be a few screw ups. But so far it looks pretty good.

By: cwb at: 2017-10-27 13:18:57

The thing that works for me is:  

  $ cat /etc/issue

Linux Mint 18.2 Sonya \n \l

thanks!

By: Vivek at: 2018-01-16 08:37:38

more /etc/redhat-release