Recently, I have developed some security-related commands to obtain system information. Windows and Linux are complete online, but Mac is less, so I sorted out some related commands.

The article goal

  • Let developers use terminal commands to obtain system information
  • Obtain common hardware information and hard disk serial number

View system information on the GUI

Open system Information To view system information

Obtain the operating system information from the terminal

core command:

system_profiler
Copy the code

This command can obtain the information of the entire operating system, which is relatively complicated. We need to obtain the information of the specified block according to the type.

Obtaining Hardware Information

use command:

system_profiler SPHardwareDataType
Copy the code

shell
grep

system_profiler SPHardwareDataType | grep Serial
Copy the code

Obtaining Hard Disk Information

  • Visual interface

  • Terminal console
system_profiler SPStorageDataType
Copy the code

System information type of the terminal

system_profiler -listDataTypes
Copy the code

All types are included below, and many of them are not needed, so I did not look for specific descriptions. You can refer to the system information of the visual interface and the information output of the following types for comparison.

type describe
SPParallelATADataType Specifications of advanced technical accessories, please see for detailsBaidu encyclopedia
SPUniversalAccessDataType
SPSecureElementDataType Apply Pay information
SPApplicationsDataType Information about all installed applications
SPAudioDataType Voice driven message
SPBluetoothDataType Bluetooth Information
SPCameraDataType Camera Information
SPCardReaderDataType
SPComponentDataType QuickTime information
SPiBridgeDataType
SPDeveloperToolsDataType Developer tools
SPDiagnosticsDataType
SPDisabledSoftwareDataType
SPDiscBurningDataType
SPEthernetDataType
SPExtensionsDataType
SPFibreChannelDataType
SPFireWireDataType
SPFirewallDataType
SPFontsDataType Font information
SPFrameworksDataType
SPDisplaysDataType
SPHardwareDataType Hardware information
SPHardwareRAIDDataType System Partition Information
SPInstallHistoryDataType
SPLegacySoftwareDataType
SPNetworkLocationDataType Local Network Configuration
SPLogsDataType
SPManagedClientDataType
SPMemoryDataType Memory information
SPNVMeDataType
SPNetworkDataType The network configuration
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrefPaneDataType
SPPrintersSoftwareDataType
SPPrintersDataType
SPConfigurationProfileDataType
SPRawCameraDataType
SPSASDataType
SPSerialATADataType
SPSPIDataType
SPSmartCardsDataType
SPSoftwareDataType
SPStartupItemDataType
SPStorageDataType Hard disk information
SPSyncServicesDataType
SPThunderboltDataType
SPUSBDataType
SPNetworkVolumeDataType
SPWWANDataType
SPAirPortDataType