Retrieve Linux and Darwin version

There’re many ways to retrieve the linux version or distro information. Sadly, they are not standardized across all distros.

Below are some of what I have found working for myself. Feel free to suggest more.

Retrieve Linux version

You can use either of the followings:
# uname -a
# cat /etc/issue

Getting Kernel version on Mac and Unix/Linux machine

To get the full kernel information using command line

terminal?> uname -a

On Fedora 16, you’ll see

Linux computer-fedora-linux 3.1.0-7.fc16.i686 #1 SMP Tue Nov 1 21:00:16 UTC 2011 i686 i686 i386 GNU/Linux

On Ubuntu 12, you’ll see

Linux computer-VirtualBox 3.2.0-21-generic-pae #34-Ubuntu SMP Thu Mar 29 22:33:16 UTC 2012 i686 i686 i386 GNU/Linux

On Mac OSX Lion, you’ll see

Darwin iMac.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

To just get the kernel name using command line

terminal?> uname -s

On Linux machines, you should see

Linux

On Mac machines, you should see

Darwin


Leave a Reply