Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to know which Linux Distribution I'm using?

uname -a gives

Linux xxxxxx.net 2.6.9-42.0.3.EL.wh1smp #1 SMP Fri Aug 14 15:48:17 MDT 2009 i686 i686 i386 GNU/Linux

How can I know this is Ubuntu/Debian/Fedora or Redhat?

I uses /etc/init.d/serviced restart for restarting serevices, seems it is not Redhat family

[itf][~]$ cat /etc/issue
cat: /etc/issue: No such file or directory
[itf][~]$ cat /etc/issue.net
cat: /etc/issue.net: No such file or directory
[itf][~]$ lsb_release -a
-sh: lsb_release: command not found
[itf][~]$ cat /etc/*-release
cat: /etc/*-release: No such file or directory
[itf][~]$ cat /etc/*-version
cat: /etc/*-version: No such file or directory
[itf][~]$ cat /etc/*release
cat: /etc/*release: No such file or directory
[itf][~]$ cat /etc/*_release
cat: /etc/*_release: No such file or directory
[itf][~]$ cat /etc/*version
cat: /etc/*version: No such file or directory
[itf][~]$
share|improve this question
    
If you want certain personal/confidential information to be removed, I think you can flag your question for moderator attention. Because we can still read it now... –  Tom Wijsman Mar 9 '12 at 8:54
    
@Tom Wijsman just want not to display that text in questions page, I know that will be there in history :-) –  Mithun Mar 9 '12 at 9:18

7 Answers 7

Try one of these:

ls -ld /etc/\*release\*  /etc/\*version\*

gcc --version
share|improve this answer
1  
Can I ask you why you are refusing to use markup for code? Please indent code by four spaces, that makes it so much easier to read and distinguish. Thank you. –  slhck Mar 9 '12 at 11:23
  • In Debian: /etc/debian_version

  • In Ubuntu: lsb_release -a or /etc/debian_version

  • In Redhat: cat /etc/redhat-release

  • In Fedora: cat /etc/fedora-release

share|improve this answer
2  
He tried all of them, see his source code. –  guerda Dec 8 '09 at 8:07
1  
+1, "lsb_release -a" worked for me on Red Hat. –  BryceAtNetwork23 Jul 13 '12 at 14:10
1  
lsb_release -a worked in Debian (squeeze), too. –  acme Mar 14 '13 at 15:23
    
lsb_release -a works in Gentoo as well –  Sergei Mar 12 at 12:37

Try http://legroom.net/2010/05/05/generic-method-determine-linux-or-unix-distribution-name.

A combination of techniques that combines querying the LSB utilities, distro release info files, and kernel info from uname. It'll take the most specific distro name it can find, falling back to generic Linux if necessary. It'll also identify UNIX variants as well, such as Solaris or AIX.

share|improve this answer

Based on the kernel version I'd say it's WBEL 4. They've been known to lag a bit with their updates, so it would probably be best to migrate to CentOS at your convenience.

share|improve this answer

Hmm, maybe its another distro - the .EL suffix seems to be used by centos, but that's a redhat dervative. I'm also wondering what's your package management system? It might help to check whose repos you use- since these are usually vendor supplied, and distro specific

share|improve this answer

You might try this article from Novell.

If you are the owner of the system, then you know which Linux is installed and running. This article will help you to understand how to determine which Linux distribution is installed. You can incorporate this into your application to detect Linux distro.

share|improve this answer
    
I already tried $ cat /etc/*release cat: /etc/*release: No such file or directory Running the mensioned script gives a result simalr to uname -a command Linux 2.6.9-42.0.3.EL.wh1smp( 2.6.9-42.0.3.EL.wh1smp i686) $ uname -a Linux qsquare.net 2.6.9-42.0.3.EL.wh1smp #1 SMP Fri Aug 14 15:48:17 MDT 2009 i686 i686 i386 GNU/Linux –  Mithun Dec 8 '09 at 9:43
2  
cat /etc/*release seems to work for some of the mainstream distros. I verified with Ubuntu, Mint, Red Hat, and Gentoo. –  nobar Mar 15 '12 at 19:50
    
Debian does not recognize this –  Milad Naseri Aug 25 '12 at 13:07
    
The Novell solution works, at last on my RedHat 5.3. I've integrated it in my free shell lib : github.com/Offirmo/offirmo-shell-lib –  Offirmo Nov 21 '12 at 15:51
    
@nobar: It also works with SUSE distributions: /etc/SuSE-release pastebin.com/dL5gVLQe –  DragonLord Sep 21 '13 at 22:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.