macos 用于确定规格的终端命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11274279/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 09:17:54  来源:igfitidea点击:

Terminal command for determining specs

macos

提问by Katana24

I realise that you can easily determine a macs specs by examining the 'About this Mac' function on the desktop. But I would like to do it through the terminal if it's possible to. So how do you go about doing it? If there are any comprehensive resources you can recommend point me to em!

我意识到您可以通过检查桌面上的“关于此 Mac”功能轻松确定 mac 规格。但如果可能的话,我想通过终端来完成。那么你打算怎么做呢?如果有什么综合资源可以推荐点我去em!

Cheers

干杯

回答by Anne

You're looking for is the system_profilercommand.

你要找的是system_profiler命令。

Create plistcontaining system information for all SPDataTypes:

plist为所有创建包含系统信息SPDataTypes

system_profiler -xml 

Create plistcontaining information for specific SPDataType:

创建plist包含特定信息的信息SPDataType

system_profiler -xml SPHardwareRAIDDataType 

List of SPDataTypes:

名单SPDataTypes

SPParallelATADataType
SPApplicationsDataType
SPAudioDataType
SPBluetoothDataType
SPCardReaderDataType
SPComponentDataType
SPDeveloperToolsDataType
SPDiagnosticsDataType
SPDiscBurningDataType
SPEthernetDataType
SPExtensionsDataType
SPFibreChannelDataType
SPFireWireDataType
SPFirewallDataType
SPFontsDataType
SPFrameworksDataType
SPDisplaysDataType
SPHardwareDataType
SPHardwareRAIDDataType
SPNetworkLocationDataType
SPLogsDataType
SPManagedClientDataType
SPMemoryDataType
SPModemDataType
SPNetworkDataType
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrefPaneDataType
SPPrintersSoftwareDataType
SPPrintersDataType
SPConfigurationProfileDataType
SPSASDataType
SPSerialATADataType
SPSoftwareDataType
SPStartupItemDataType
SPSyncServicesDataType
SPThunderboltDataType
SPUSBDataType
SPUniversalAccessDataType
SPNetworkVolumeDataType
SPWWANDataType
SPAirPortDataType

For further details how to use system_profilerrun:

有关如何使用system_profilerrun 的更多详细信息:

man system_profiler

回答by User5910

As @Anne posted, system_profileris useful, but if you need more details, such as CPU model number, family, stepping, features (ex. SSSE3), try

正如@Anne 发布的那样,system_profiler很有用,但如果您需要更多详细信息,例如 CPU 型号、系列、步进、功能(例如 SSSE3),请尝试

sysctl

Each line of output contains the full hierarchy of categories so you can grep down the results to what you're looking for, ex. to see CPU details:

每行输出都包含类别的完整层次结构,因此您可以将结果搜索到您要查找的内容,例如。查看 CPU 详细信息:

sysctl | grep machdep.cpu

View the man pageonline or in the terminal:

在线或在终端中查看手册页

man sysctl