How can I tell whether my system is Unix or Linux?

I am using a Macbook Pro of 2010 vintage.

  • 7
    How much did you pay for it?
    – mikeserv
    Jun 9, 2015 at 23:37
  • 3
    There are (at least) four different definitions of the term "Unix": 1) the series of operating system(s) by Bell Labs, 2) the family of operating systems derived from the source code of 1), 3) any operating system that has passed certification by The Open Group (or 3a) any operating system that would pass certification by The Open Group but can't afford the certification fee), 4) any operating system that looks and feels like "Unix". For example, with the exception of specialized distributions like Android, most Linux distributions fall under 4), some under 3a), and a few under 3). Jun 10, 2015 at 7:30
  • 1
    OTOH, even though OSX falls under 2) and 3), I would argue that it doesn't fall under 4). Windows NT, at least in some versions, satisfies 3), but definitely not 4). Jun 10, 2015 at 7:32

3 Answers 3


POSIX defines uname ("Unix name") to provide information about the operating system and hardware platform; running uname gives the name of the implementation of the operating system (or according to the coreutils documentation, the kernel). You can do this interactively in a terminal, or use the output in a script.

On Linux systems, uname will print Linux.

On Mac OS X systems, uname will print Darwin. (Strictly speaking, any operating system with a Darwin kernel will produce this, but you're very unlikely to encounter anything other than Mac OS X in this case.)

This will allow you to determine what any Mac is running. As Rob points out, if you're running Mac OS X (Darwin as indicated by uname), then you're running a certified version of Unix; if you're running Linux then you're not.

On a Mac there are many other possibilities; your script could end up running on Solaris (uname will print SunOS then), on FreeBSD (FreeBSD), on Windows with Cygwin (CYGWIN), MSYS or MSYS2 (MSYS), a MinGW or MinGW-w64 shell (MINGW64, MINGW32), Interix (Interix), and probably others I'm not aware of.

uname -a will print all the available information as determined by uname, but it's harder to parse.

  • The problem is, uname does not prove it is running Unix. It only gives a name of the OS which might not be a Unix system. Linux, for example, is not Unix.
    – Rob
    Jun 10, 2015 at 11:57
  • @Rob, nowhere did either Stéphane or I say that; in fact we're explicitly differentiating between Linux and Unix (or rather Mac OS X). Jun 13, 2015 at 22:24

Unless you installed something else, Macs don't run Linux. Macbooks do run Apple's operating system called OSX which is certified Unix and, therefore, is the answer to your question.

  • Of course, some versions of Linux are also certified Unix, so the question then becomes, is it running Linux or Unix? Jun 10, 2015 at 7:24
  • @JörgWMittag I see that the only version of Linux that is certified as Unix is an LDAP server running SUSE from IBM, but no others are or ever have been or probably ever will. my answer remains the same, though. If he didn't install Linux on a Mac then he's running OSX which is Unix.
    – Rob
    Jun 10, 2015 at 11:53

The answer is:

uname -a


cat /proc/version
  • Open a terminal window and type 'uname -a' then return.
    – Baazigar
    Jun 9, 2015 at 20:51
  • 1
    What can I deduce about the OS if cat /proc/version produce the error message cat: /proc/version: No such file or directory?
    – kasperd
    Jun 10, 2015 at 8:08
  • Look it /etc/fstab, look at the file types indicated there. If it is like ext3, ext4, xfs, it is linux. If it is like jfs, gpfs, hfs, hfs+, that is unix.
    – Baazigar
    Jun 12, 2015 at 20:17
  • If you see xfs it could be IRIX ;-). (But not on a Mac, I'll give you that!) Jun 20, 2015 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .