LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 12:14 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
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, 12: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 12:30 AM.
 
Old 10-26-2009, 12:39 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
There is no way which works on all Linux systems. See this post for one way of doing it.
 
Old 10-26-2009, 12: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, 12: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: 52
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, 01:17 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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, 01:24 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
lsb_release -a though should work on major distributions.
 
Old 10-26-2009, 01: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: 52
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, 03:19 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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, 03:22 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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, 03:38 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

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, 11:01 AM   #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, 11:13 AM   #13
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

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, 11:14 AM   #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, 06:24 PM   #15
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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 07:49 AM
What Command shows my operating system? john test Linux - Newbie 11 07-20-2008 08:26 PM
can't find operating system error at boot MoXplorer Linux - Software 2 05-16-2007 10:21 AM
Need Command to find linux operating system information raajesh_ak Linux - Newbie 9 12-21-2005 06:38 PM
dd command - missing operating system samnjengah Linux - General 8 01-08-2004 01:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:36 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
Open Source Consulting | Domain Registration