Find OS X version from the command line

Fig. 01: Find OS X version from the command line

Fig. 01: Find OS X version from the command line

To find OS X version (Apple MAC OS X) from the bash command line, enter:
sw_vers
sw_vers -productName
sw_vers -productVersion
sw_vers -buildVersion

Sample outputs:

ProductName:	Mac OS X
ProductVersion:	10.11.1
BuildVersion:	15B42

You can also use the uname command as follows to find out OS X kernel version:
uname -a
Sample outputs:

Darwin Viveks-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64

Examples and usage: How to find out Mac OS X operating system version information from Terminal command prompt