Posts RSS Comments RSS 48 Posts and 155 Comments till now

Using System Profiler in Terminal

There are times when you may need to get information about your system via the command line. Perhaps for a shell script or you’re already working in Terminal and it’s just quicker then opening the GUI version of System Profiler.

The command line version of System Profiler is, appropriately enough, “system_profiler”.

You can type man system_profiler to get a list of all the many things it can do. Here are a few examples.

You can get three different levels of reports.

  • system_profiler -detailLevel mini gives you a report without personal information
  • system_profiler -detailLevel basic gives you hardware and network information only
  • system_profiler -detailLevel full gives you everything

system_profiler -xml will export everything to an XML file for use in a web page or database. You can combine this command with others to get only certain information

For example, to get only the hardware and network information on a certain machine and write it to an XML file you can use this:

system_profiler -xml -detaiLevel basic > /Users/myaccount/Desktop/report.xml

Enter system_profiler -listDataTypes to get a list of the different areas that system_profiler gathers data on.

Those types are:

SPHardwareDataType
SPNetworkDataType
SPSoftwareDataType
SPParallelATADataType
SPAudioDataType
SPBluetoothDataType
SPDiagnosticsDataType
SPDiscBurningDataType
SPFibreChannelDataType
SPFireWireDataType
SPDisplaysDataType
SPMemoryDataType
SPPCCardDataType
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrintersDataType
SPSerialATADataType
SPUSBDataType
SPAirPortDataType
SPFirewallDataType
SPNetworkLocationDataType
SPModemDataType
SPNetworkVolumeDataType
SPApplicationsDataType
SPExtensionsDataType
SPFontsDataType
SPFrameworksDataType
SPLogsDataType
SPPrefPaneDataType
SPStartupItemDataType

So, to get information on the type of hardware a machine has enter system_profiler SPHardwareDataType into Terminal and you’ll get something like this:

Hardware Overview:

Machine Name: Power Mac G5
Machine Model: PowerMac7,3
CPU Type: PowerPC G5 (3.0)
Number Of CPUs: 2
CPU Speed: 2.5 GHz
L2 Cache (per CPU): 512 KB
Memory: 2 GB
Bus Speed: 1.25 GHz
Boot ROM Version: 5.1.8f7
Serial Number: XXXXXXXXXXX

system_profiler SPPrintersDataType will give you all the information on the currently installed printers.

system_profiler SPFirewallDataType will tell you if the Firewall is on or off and if it’s on what rules are in effect. If the firewall is off you’ll get no return on the command.

Comments are closed.