我使用ssh登录到mac服务器,没有GUI。我怎么在命令行下获得OSX系统的版本信息呢?可以使用的命令如下:
- system_profiler命令:显示Mac的硬件和软件信息
- sw_vers命令:OSX系统版本
- uname命令:显示操作系统名
sw_vers:
1 2 3 4 |
$ sw_vers ProductName: Mac OS X ProductVersion: 10.11.2 BuildVersion: 15C50 |
你也可以传入如下参数:
- -productName:产品名(Mac OS X)
- -productVersion:版本号(10.11.2)
- -buildVersion:构建版本(15C50)
system_profier:
显示详细的软硬件信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$ system_profiler | less Accessibility Information: Cursor Magnification: Off Display: Black on White Flash Screen: Off Mouse Keys: Off Slow Keys: Off Sticky Keys: Off VoiceOver: Off Zoom Mode: Full Screen Contrast: 0 Keyboard Zoom: Off Scroll Zoom: Off Applications: TextEdit: Version: 1.11 Obtained from: Apple Last Modified: 12/12/15, 15:05 Kind: Intel 。。。 。。。 |
信息总览:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ system_profiler SPSoftwareDataType Software: System Software Overview: System Version: OS X 10.11.2 (15C50) Kernel Version: Darwin 15.2.0 Boot Volume: Macintosh HD Boot Mode: Normal Computer Name: abc’s Mac User Name:abc (abc) Secure Virtual Memory: Enabled System Integrity Protection: Enabled Time since boot: 2 days 1:02 |
使用SystemVersion.plist文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ cat /System/Library/CoreServices/SystemVersion.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>ProductBuildVersion</key> <string>15C50</string> <key>ProductCopyright</key> <string>1983-2015 Apple Inc.</string> <key>ProductName</key> <string>Mac OS X</string> <key>ProductUserVisibleVersion</key> <string>10.11.2</string> <key>ProductVersion</key> <string>10.11.2</string> </dict> </plist> |
OS X Darwin内核版本:
1 2 |
$ uname -av Darwin abcs-Mac.local 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64 |
使用say命令(小技巧)
声音输出:
1 |
$ say $(sw_vers) |