Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Unix, GNU and bash

  1. #1
    Join Date
    Jul 2013
    Beans
    4

    Unix, GNU and bash

    Hi all,
    I seem to be getting myself confused with all the media out there talking about unix, gnu etc etc. Can anyone tell me what the real difference between unix and gnu? What I gather is that gnu is a unix-like operating system and that bash is the command shell so why then when I type bash commands on a mac it doesn't understand the command despite it being a bash shell. But is OS X a unix OS compared to Linux being gnu? Are all Linux distros gnu? If all Linux distros are gnu and use the same command shell, why if I was to run the command to unzip a file on say kali I'd type -zxvf where as on mint I run this command and it doesn't work and uses a different command.
    As you can imagine its rather frustrating! I look forward to peoples answers, hopefully not ones calling me a noob or what have you, we all have to start somewhere.
    Thanks.

  2. #2
    Join Date
    Sep 2006
    Beans
    7,637
    Distro
    Lubuntu Development Release

    Re: Unix, GNU and bash

    bash is just the user interface that lets you connect to the user-space utilities on the system. These utilities include ls, cd, mv, rm, and tens of thousands of others. There are other shells to provide about the same UI, such as tcsh and ksh, instead of bash. But they all allow you to run the various utilities on your system. So if you run tar any of them it can be tar from GNU's tar or BSD's tar. OS X has a fair number of GNU utilities, but really it is based on BSD. So quite a few of the utilities you will find there differ from the GNU utilities in small ways.

    Look in /bin, /sbin, /usr/bin, and /usr/sbin to see some of these utilities.

    Most linux distros are GNU (RHEL, Mageia, Debian, Knoppix, etc). Pretty much anything you would run on the desktop or a server will be GNU/Linux. There is of course on mobile devices now the distros based on Android/Linux, which has the Linux kernel but a different set of user-space tools. I'm not sure where ChromeOS stands, but it is probably not GNU either even if it is certainly Linux.

  3. #3
    Join Date
    Nov 2010
    Location
    Madras, India
    Beans
    195
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Unix, GNU and bash

    Quote Originally Posted by sark89 View Post
    Hi all,
    I seem to be getting myself confused with all the media out there talking about unix, gnu etc etc. Can anyone tell me what the real difference between unix and gnu? What I gather is that gnu is a unix-like operating system and that bash is the command shell so why then when I type bash commands on a mac it doesn't understand the command despite it being a bash shell. But is OS X a unix OS compared to Linux being gnu? Are all Linux distros gnu? If all Linux distros are gnu and use the same command shell, why if I was to run the command to unzip a file on say kali I'd type -zxvf where as on mint I run this command and it doesn't work and uses a different command.
    As you can imagine its rather frustrating! I look forward to peoples answers, hopefully not ones calling me a noob or what have you, we all have to start somewhere.
    Thanks.
    Back in the 1970s and 80s UNIX systems were commercial and source code was restricted and users were not allowed to modify the system. Richard Stallman the founder of GNU project and FSF thought this was an unacceptable restriction on computing freedoms and started the so-called GNU project in 1984 to develop a UNIX-like operating system right from scratch, but now one which had freely available source code and allowed modifications and reuse, under the GPL license which also he conceived.

    He was successful in creating all the basic utilities of such a system, as well as the toolchain to compile it, but the kernel subsystem he started (GNU Hurd) got seriously lagging, and to date is nowhere near practically useful state. But it so happened that that didn't matter cause by 1991 a Finnish computing student, Linus Torvalds, authoured the core of a UNIX-like kernel and decided to release it under GPL. This Linux kernel then took off enormously and later became the de facto kernel underneath all the GNU utilities and toolchain. This is why Stallman wants everybody to call Linux distributions as "GNU/Linux"... i.e., to recognise the fact that a significant and important part of it (the basic utilities and toolchain) came from the GNU project, while the kernel of course is Linux.

    Bash is GNU's implementation of sh, a popular UNIX shell. In sh compatibility mode, bash will accept all sh commands although it is now much more complex than sh. I don't know whether the shell in Mac is bash, having never used a Mac. Perhaps the command you invoked was something that doesn't exist on a Mac system? What command was it?

    As for OS X, I've never used an Apple product so rather than my own words I'll just quote the relevant wikipedia bits.

    "OS X is based upon the Mach kernel. Certain parts from FreeBSD's and NetBSD's implementation of Unix were incorporated in NeXTSTEP, the core of Mac OS X. NeXTSTEP was the graphical, object-oriented, and UNIX-based operating system developed by Steve Jobs' company NeXT after he left Apple in 1985. Eventually, NeXT's OS, then called OPENSTEP , was selected to be the basis for Apple's next OS, and Apple purchased NeXT outright. OS X's core is a POSIX compliant operating system (OS) built on top of the XNU kerne l, with standard Unix facilities available from the command line interface . Apple has released this family of software as a free and open source operating system named Darwin. On top of Darwin, Apple layered a number of components, including the Aqua interface and the Finder, to complete the GUI-based operating system which is OS X. Since OS X is POSIX compliant, many software packages written for the *BSDs, Linux, or other Unix-like systems can be recompiled to run on it."

  4. #4
    Join Date
    Sep 2006
    Beans
    7,637
    Distro
    Lubuntu Development Release

    Re: Unix, GNU and bash

    If you want to get a general idea of where OS X fits in, look at Éric Lévénez's timeline around 1999:

    http://www.levenez.com/unix/

    But that's mostly the kernel not the utilities.

  5. #5
    Join Date
    Nov 2010
    Location
    Madras, India
    Beans
    195
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Unix, GNU and bash

    Quote Originally Posted by Lars Noodén View Post
    If you want to get a general idea of where OS X fits in, look at Éric Lévénez's timeline around 1999: http://www.levenez.com/unix/
    Awesome page! TFS.

  6. #6
    Join Date
    Jul 2013
    Beans
    4

    Re: Unix, GNU and bash

    Wow thanks for your detailed replies! They answered my question quite nicely! So am I right in saying then that Unix was created and so people created a version of Unix called GNU which allowed access to the source code this then led to operating systems like Linux. So it looks like then that OS X is a Unix based operating system which uses some features from GNU such as the bash shell which then answers why some GNU commands won't work on OS X where as some will since only uses some features. Very interesting stuff. I was doing some research on books which would be a good reference on getting to grips with the command shell on Linux. I came across The Linux Command Line: A Complete Introduction which seems to get some good reviews however I'm just concerned that different distros use different commands. I wouldn't want to buy this book and use it on a distro only to find it was a bit of a waste as the commands won't work!
    Once again thank you for your replies

  7. #7
    Join Date
    Nov 2010
    Location
    Madras, India
    Beans
    195
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Unix, GNU and bash

    Quote Originally Posted by sark89 View Post
    Wow thanks for your detailed replies! They answered my question quite nicely! So am I right in saying then that Unix was created
    During the 70s, 80s and 90s there were a variety of operating systems (anscestor of which was from Bell Labs, 1969) which followed a set of common conventions and commands and they came to be known as the UNIX family of operating systems. Later a consortium (The Open Group) also purchased the rights to the name UNIX and now labels any system as "UNIX" when they go through it's certification process, though very few otherwise practically UNIX compatible systems do, since the certification is expensive. When talking about UNIX a closely related term is POSIX, which is a standardised set of conventions and tools that allow interoperability between any operating systems that implement the POSIX standard. The POSIX interface is was historically modelled after the existing interfaces and tools of the UNIX systems of the day, so a POSIX compliant system is practically a UNIX even if it never went through a formal certification from Open Group.

    and so people created a version of Unix called GNU which allowed access to the source code this then led to operating systems like Linux.
    More or less although when using the term Linux there's an ambiguity as to whether you're talking about the kernel alone (to which the term strictly applies) or a complete operating system built around the kernel. There can be non-UNIX operating systems built on top of Linux kernel and there can be UNIX compliant systems which arose completely outside the UNIX family tree. I think Android is an example of the former, can't think of any for the latter!

    I was doing some research on books which would be a good reference on getting to grips with the command shell on Linux. I came across The Linux Command Line: A Complete Introduction which seems to get some good reviews however I'm just concerned that different distros use different commands. I wouldn't want to buy this book and use it on a distro only to find it was a bit of a waste as the commands won't work!
    Generally you'll find broad compatibilty among the majority of Linux distributions for all the common command line tools and tasks. While they do differ I don't think you'll encounter the differences while still a command-line beginner. Much of this compatibility extends to all POSIX compliant systems. Many of these basic commands will work on the BSDs too for example, and so should work on a Mac too. Any gotchas should be explained in any good command-line book, though I don't know how good the book you cited is. The one I use is O'Reilly's Linux in a Nutshell.

    http://en.wikipedia.org/wiki/UNIX
    http://en.wikipedia.org/wiki/POSIX

  8. #8
    Join Date
    Jul 2013
    Beans
    4

    Re: Unix, GNU and bash

    I see so Linux really refers to the kernel not the operating system built around it. Thank you very much for that detailed message. I think I'll have to check out that book you mentioned!
    Thanks again.

  9. #9
    Join Date
    Sep 2006
    Beans
    7,637
    Distro
    Lubuntu Development Release

    kernels

    The Debian distro is an interesting example. It is most known for its GNU/Linux version. However, it is also working on parallel distros that use the FreeBSD kernel and the Hurd Mach microkernel, both still using GNU.

    https://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ
    https://wiki.debian.org/Debian_GNU/kFreeBSD_why

    http://www.debian.org/ports/hurd/

    So you have Debian GNU/Linux, Debian GNU/xFreeBSD and Debian GNU/Hurd.

    Most users don't worry too much about the kernel as it is the system component that interacts with the hardware and is thus usually the most distant from user interaction. So if you are and average desktop user you could use any of those three and pretty much not see the difference, it would all be Debian and GNU.

  10. #10
    Join Date
    Dec 2005
    Beans
    19,423

    Re: Unix, GNU and bash

    So am I right in saying then that Unix was created and so people created a version of Unix called GNU which allowed access to the source code this then led to operating systems like Linux
    Linux is a cousin of Unix, while OSX is a child of Unix. What I mean is that Linux is based on Unix, but not directly decended from it; but OSX is directly decended from Unix.
    Learning is not attained by chance, it must be sought for with ardor and attended to with diligence. Abigail Adams ( 1744 - 1818 ), 1780;

    My blog Poetry and More Free Ubuntu Magazine

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •