$ sw_vers ProductName: Mac OS X ProductVersion: 10.6.4 BuildVersion: 10F569 $ sw_vers -productVersion 10.6.4Especially handy when resetting a password in single user mode, since the method varies based on which version of OS X is running.
UPDATE 1:
Here's another way to check; great for use on offline OS X installs:$ grep -2 ProductVersion /Volumes/OfflineVolumeName/System/Library/CoreServices/SystemVersion.plist <key>ProductUserVisibleVersion</key> <string>10.11.6</string> <key>ProductVersion</key> <string>10.11.6</string>
UPDATE 2:
UPDATE 3:
system_profiler can query all sorts of hardware information, e.g., system_profiler SPSerialATADataType | grep "Medium" to check whether the internal drive is Rotational or Solid State. Run system_profiler -listDataTypes to list the available datatypes and see Get OS X System Info from the Command Line for more information.
/mac | Aug 14, 2010