What is the difference between Unix and Linux? [duplicate]

Unix isn't one thing, it's a name for a large family of related operating systems, which share to differing degrees, history and architecture. Solaris, DEC Unix, IRIX, HP-UX are Unix variants. They are to some degree compatible to applications, since they implement POSIX standards to differing degrees, which means they expose similar commands and APIs.

Their kernels are not the same, though if you look up 'unix family tree' you will see a fascinating history of how these variants have evolved from one another, like organisms. That is, a finch and a swallow aren't the same animal but they have much in common.

Linux is a re-write, from scratch, of a Unix-like operating system. Whether programs written for one Unix/Linux versus another is a complex question, but in some cases yes.


No, No, Yes (source)

To really understand the answer it helps to look at the history of both operating sytems.

Unix was invented at AT&T Bell Labs by Ken Thompson. His colleague Dennis Ritchie contributed and also invented the C language and wrote the C compiler. Over the years, code was also contributed by UC Berkeley, further work at AT&T, Sun, IBM, and others.

It was eventually standardized in a series of publications called POSIX. Overall, the code was proprietary, as it was copyrighted by AT&T and then sold off or licensed to other companies, who largely rewrote it over the years but retained various rights.

Two branches of "free Unix" emerged in the 1990's. One was Linux, which is a clone, written to act like Unix without containing any actual Unix code.

The other branch exists today as NetBSD, and which was followed quickly by FreeBSD, and then much later by any other *BSD you may have heard about. These projects are a bit different from Linux in that they are "partial clones". They contain a mixture of "real Unix" source code (the part that was freely licensed, mainly by UC Berkeley) and some newly written "clone" code and other later code emerging as part of rewrites or as needed to support modern HW and modern Posix specifications.

Linux is a lot more popular because NetBSD and FreeBSD were tied up for a while in a lawsuit between AT&T and UCB. Although resolved in favor of the BSD's they never recovered from the delay, at least, not in terms of popularity.

So no, Linux and commercial Unix don't have any kernel code in common, although commercial Unix and *BSD once did have quite a bit in common. The Unix kernels from the licensed vendors contain code that they wrote themselves, perhaps with some original AT&T code still present here and there. The Linux kernel consists of code written by Linus Torvalds and other authors.

"Unix software" is software written to the Posix API's and typically runs on all versions of Unix, Linux, and NetBSD and FreeBSD. In theory, Posix SW can run on "non-Unix" systems but that doesn't seem to work out very well. These days, "Unix" is technically a trademark, but tends to be used informally as a designation for both commercial Unix, Linux, and the BSD family.


When most people talk about unix they mean a "Unix-like operating system that is POSIX compliant", which Linux is.

Do they share a same kernel? No, Linux IS a kernel, not an operating system. Technically, Linux distros use a Linux kernel and a GNU (see gnu.org) "userland". The userland is the basic programs and libraries etc. that bridge big applications and user tasks to the kernel's low-level API.

Is Linux built over Unix? No, it's a clone. It's built to provide a free, usable version of Unix on a lowly desktop PC.

Can programs written for Linux work over Unix and vice versa? Sometimes. For example, on FreeBSD, there is a Linux ABI emulator, which essentially detects that programs were made for Linux, and makes a different set of kernel calls available. Something similar is available for Linux to run standard Unix System V stuff (or some popular commercial version of unix anyway), but it's rarely used, as most programs come as POSIX-compliant source code, and compile on Linux without difficulty. Also, most binary programs for unix are directly available for Linux. FreeBSD is a smaller concern, and doesn't have this luxury. In Linux, the system to load binaries from other systems is most often used to run java programs, windows programs (although this is ill-advised), etc.

Unix is a trademark, and so Linux can't use the name. Unix is the official, old version (inasmuchas there is an official version), which isn't so user friendly. Most other versions of unix were designed a little better, but don't necessarily work as well in practical terms. That's about it really. Many of the companies that used to run Unix now run Linux.

If you want to see the differences in various unix-like operating systems, get yourself a copies of FreeBSD, OpenSolaris, and Debian. I say these distros specifically because they'll be easier to compare, although some others like pc-bsd, nexenta, and ubuntu are arguably nicer, respectively.


I think technically speaking, GNU/Linux is not less of a UNIX than any of the official UNIX systems, but it's only for legal reasons that people describe Linux as a UNIX-like OS, instead of just a "UNIX" OS.

As far as kernels are concerned, Linux is a kernel. So by definition, if a system uses the Linux kernel, then it's a Linux system, not a UNIX system.

Is Linux built over Unix

Linux was not built "over" Unix, it's built as a UNIX clone. All the various gnu utilities (bash, etc) were written from scratch as clones of the corresponding unix utilities.

Ironically, Mac OS X, which has a UNIX core, ships with bash, gcc, and possibly other GNU utilities. So that's a UNIX system that includes parts of GNU, and not the other way around as one might expect.