LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 10-26-2009, 01:14 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Rep: Reputation: 36
Which command to use to find name of operating system


Hi guys how would i know which distribution of unix i have installed in my machine?
 
Old 10-26-2009, 01:29 AM   #2
sploot
Member
 
Registered: Sep 2009
Location: Phoenix, AZ
Distribution: Gentoo, Debian, Ubuntu
Posts: 121

Rep: Reputation: 27
Code:
uname -o
or if you want to know the particular kernel,
Code:
uname -r

Last edited by sploot; 10-26-2009 at 01:30 AM.
 
Old 10-26-2009, 01:39 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
There is no way which works on all Linux systems. See this post for one way of doing it.
 
Old 10-26-2009, 01:40 AM   #4
Halpo
LQ Newbie
 
Registered: Oct 2009
Location: Lansing
Distribution: #!
Posts: 2

Rep: Reputation: 1
assuming it's a red-hat variant you can use

Code:
cat /etc/redhat-release
 
Old 10-26-2009, 01:52 AM   #5
hurry_hui
Member
 
Registered: Oct 2008
Location: Near Jakarta
Distribution: Slackware, Arch, Slax, Porteus, Tiny Core, Slitaz
Posts: 355
Blog Entries: 1

Rep: Reputation: 51
You can also do 'cat /proc/version'

in my distro 'cat /etc/sabayon-release' will work, well, just like RH above.

Catkin is correct there is no universal way to do this on various distros. Just follow his link.

Btw, one of my distro is not listed there
 
Old 10-26-2009, 02:17 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by hurry_hui View Post
Btw, one of my distro is not listed there
Which one and how could the function be modified to test for it?
 
Old 10-26-2009, 02:24 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,628

Rep: Reputation: Disabled
lsb_release -a though should work on major distributions.
 
Old 10-26-2009, 02:57 AM   #8
hurry_hui
Member
 
Registered: Oct 2008
Location: Near Jakarta
Distribution: Slackware, Arch, Slax, Porteus, Tiny Core, Slitaz
Posts: 355
Blog Entries: 1

Rep: Reputation: 51
Quote:
Originally Posted by catkin View Post
Which one and how could the function be modified to test for it?
/etc/sabayon-release not available.

maybe adding

Code:
elif [[ -r '/etc/sabayon-release' ]]; then
        n='Sabayon'
Sorry, I am not good at programming.
 
Old 10-26-2009, 04:19 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by linuxlover.chaitanya View Post
lsb_release -a though should work on major distributions.
lsb_release has been in the Linux Standard Base (LSB) Core Specification since no later than 2004 when 2.0.1 was published and probably earlier. It would be interesting to know how many distros support it. It is not on my Slackware 13.0 system.
 
Old 10-26-2009, 04:22 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by hurry_hui View Post
Sorry, I am not good at programming.
But it looks perfect! Sabayon added to the original function now. Thanks for the info.
 
Old 10-26-2009, 04:38 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,628

Rep: Reputation: Disabled
I find it on my Ubuntu, RHEL and CentOS. I do not have any other distribution at hand.
 
Old 10-26-2009, 12:01 PM   #12
sploot
Member
 
Registered: Sep 2009
Location: Phoenix, AZ
Distribution: Gentoo, Debian, Ubuntu
Posts: 121

Rep: Reputation: 27
I wasn't aware that uname didnt work on all linux systems. Good to know
 
Old 10-26-2009, 12:13 PM   #13
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,135
Blog Entries: 52

Rep: Reputation: Disabled
Quote:
Originally Posted by sploot View Post
I wasn't aware that uname didnt work on all linux systems. Good to know
It works, but doesn't tell you the distro:
Code:
Linux Slacklap 2.6.29.6-smp #1 SMP Mon Aug 17 00:18:05 CDT 2009 i686 Intel(R) Pentium(R) Dual  CPU  T2330  @ 1.60GHz GenuineIntel GNU/Linux
 
Old 10-26-2009, 12:14 PM   #14
sploot
Member
 
Registered: Sep 2009
Location: Phoenix, AZ
Distribution: Gentoo, Debian, Ubuntu
Posts: 121

Rep: Reputation: 27
But it does tell Linux, Unix, BSD, etc. right? Maybe I misunderstood the OP's question. But I think I understand what he was going for now.
 
Old 10-26-2009, 07:24 PM   #15
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
On Linux, i get 'Linux' & kernel version and various other things like SMP, 32/64 bit; depending on distro.
On HP I get HP-UX & release info; Solaris says SunOS, fqdn & version num etc.
Haven't got a BSD to look at.
 
  


Reply

Tags
version


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find the linux operating system version in SLES/RHEL? vedam.psg Linux - Software 4 03-11-2014 08:49 AM
What Command shows my operating system? john test Linux - Newbie 11 07-20-2008 09:26 PM
can't find operating system error at boot MoXplorer Linux - Software 2 05-16-2007 11:21 AM
Need Command to find linux operating system information raajesh_ak Linux - Newbie 9 12-21-2005 07:38 PM
dd command - missing operating system samnjengah Linux - General 8 01-08-2004 02:49 PM


All times are GMT -5. The time now is 05:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration