How To Know Which Linux Distribution You Are Using?

Want to support HowtoForge? Become a subscriber!
 
Submitted by g33k (Contact Author) (Forums) on Thu, 2006-06-15 15:55. :: Linux

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 favourite terminal program and type in the following

    dmesg | head -1


    The output would be similar to

    Linux version 2.6.13-15-default (geeko@buildhost) (gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)) #1 Tue Sep 13 14:56:15 UTC 2005

  • Using /proc/version
    In the terminal type

    cat /proc/version


    The output would be like


    Linux version 2.6.13-15-default (geeko@buildhost) (gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)) #1 Tue Sep 13 14:56:15 UTC 2005

  • Using /etc/issue
    This method gives the most appropriate answer

    cat /etc/issue


    The output should be like

    Welcome to SUSE LINUX 10.0 (i586) - Kernel \r (\l).

P.S : You may try this shell script to know about your Linux Distribution. The original source is here

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Wed, 2012-11-14 01:18.
There seems to be some sort of standard /etc/os-release thing. It at least exists on Ubuntu and Arch.
Submitted by Anonymous (not registered) on Wed, 2011-11-16 16:55.

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

but

vm-105:~# cat /proc/version
Linux version 2.6.18-xen (root@tp-c001.ci.uchicago.edu) (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

Submitted by Anonymous (not registered) on Sat, 2010-07-10 14:32.

You can also do:

cat /etc/*-release

Submitted by Anish Sneh (not registered) on Mon, 2010-08-30 10:20.

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

 

-- Anish Sneh

Submitted by Anonymous (not registered) on Mon, 2010-09-20 14:05.

Debian squeeze: 

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

It seems that *release is distro specific

 

Submitted by Anonymous (not registered) on Fri, 2009-01-30 17:18.

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`


Submitted by Anonymous (not registered) on Sat, 2006-07-01 20:57.
lsb_release -a
Submitted by Anonymous (not registered) on Sat, 2006-06-17 19:05.
I have also created a tool called osinfo to report your distrib. More info here.


Fred

Submitted by Ark-Angel (registered user) on Fri, 2006-06-16 05:20.
egrep '^[^#]*title' /boot/grub/menu.lst | grep -v 'memtest'
Submitted by kikobg (registered user) on Fri, 2006-06-16 05:46.
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..
Submitted by Anonymous (not registered) on Thu, 2006-06-15 23:46.
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.
Submitted by Anonymous (not registered) on Thu, 2006-06-15 19:02.

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

Submitted by day7 (registered user) on Thu, 2007-07-26 04:28.

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

"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) 

 

 

Submitted by Anonymous (not registered) on Thu, 2006-06-15 18:31.

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

Submitted by kikobg (registered user) on Fri, 2006-06-16 03:48.
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 !!
Submitted by Anonymous (not registered) on Thu, 2006-06-15 18:21.

Look for


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

Submitted by kikobg (registered user) on Fri, 2006-06-16 03:55.
thanks, i added this info as a shell script in the article :)
Submitted by Anonymous (not registered) on Tue, 2010-04-27 04:17.

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?

Submitted by amit (not registered) on Fri, 2011-05-27 10:04.
I completely agree with you
Submitted by QBall (not registered) on Mon, 2012-02-13 12:57.

OR better yet, just:

[username@localhost ~]$ distro

 or

[username@localhost ~]$ 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).