Posted: . At: 11:27 AM. This was 5 years ago. Post ID: 12767
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Get information about your Macintosh machine using the command line.


Get the current status of your battery with this command.

deusexmachina:~ jason$ sudo systemstats | grep "Battery Power"
            Battery Power:	-8095 mW (-15.5 %/hr)
            Battery Power:	-8034 mW (-15.6 %/hr)
            Battery Power:	-6774 mW (-13.3 %/hr)
            Battery Power:	-8080 mW (-15.3 %/hr)
            Battery Power:	-7866 mW (-15.3 %/hr)

Return information about CPU usage, this tells you the average frequency, and the state of the CPU cores.

deusexmachina:~ jason$ sudo systemstats | grep -A 8 "CPU Summary"
CPU Summary
===========
           Avg. Frequency:	1.893 GHz
           Package Power::	Pkg: 2.99W, CPU 1.62W, GPU: 0.05W
       Pkg Interrupt Rate:	Total: 2494Hz   ARPT: 704Hz   HDEF: 1Hz   IGPU: 138Hz   IPI: 1321Hz   MacBookAir7,2: 23Hz   SMC: 1Hz   TMR: 306Hz
          Pkg C-State Res:	Total: 54.8%   C2: 18%   C3: 3%   C6: 5%   C7: 29%   C9: 0%   C10: 0%
        Cores C-State Res:	   C3: 0%   C6: 0%   C7: 69%
          GPU C-State Res:	   RC1: 0%   RC6: 94%
            XCPM Tier Res:	   TT5: 0%   background: 1%   idle: 83%   normal: 14%

The use of the -A 8 parameter to grep, tells it to return 8 lines of text after the matching line. The -B 8 parameter, would tell GNU grep to return 8 lines before the matching line.

This utility can also give us information about the WIFI status.

deusexmachina:~ jason$ sudo systemstats | grep -A 26 "Airport Summary"
Airport Summary
===============
           Total Duration:	    8987.9 s
 
           awdl0_rx_bytes:	0 bytes (0 bytes/s)
        awdl0_bk_tx_bytes:	0 bytes (0 bytes/s)
        awdl0_be_tx_bytes:	0 bytes (0 bytes/s)
        awdl0_vo_tx_bytes:	0 bytes (0 bytes/s)
           awdl0_tx_bytes:	0 bytes (0 bytes/s)
        awdl0_vi_tx_bytes:	0 bytes (0 bytes/s)
              en_rx_bytes:	6.02 GB (702 KB/s)
           en_bk_tx_bytes:	201.4 MB (23 KB/s)
           en_be_tx_bytes:	84.2 MB (10 KB/s)
           en_vo_tx_bytes:	187 KB (21 bytes/s)
              en_tx_bytes:	285.8 MB (33 KB/s)
           en_vi_tx_bytes:	9 KB (1 byte/s)
 
 phy_scan_user_scan_count:	     308.3    (       0.0Hz)
        awdl_radio_rx_dur:	       0.0 s  (       0.0%)
   phy_scan_user_scan_dur:	      78.9 s  (       0.9%)
              awdl_aw_dur:	       0.0 s  (       0.0%)
phy_activity_radio_tx_dur:	     412.9 s  (       4.6%)
           awdl_pscan_dur:	       0.0 s  (       0.0%)
phy_activity_radio_rx_dur:	     418.8 s  (       4.7%)
        awdl_radio_tx_dur:	       0.0 s  (       0.0%)

This shows the amount of transferred data and the total duration of the wireless usage.

It is also possible on a Macintosh machine to see which applications are using the most CPU.

deusexmachina:~ jason$ sudo systemstats | grep -A 30 "Energy Impact:"
Energy Impact:
CPU Time	(CPU % of wall)		Energy Score	(Energy % of total)
00:02:17	(1.4 %)		10078200.16	(81.8 %)		com.apple.WindowServer
00:28:19	(17.8 %)		1874086.85	(15.2 %)		org.mozilla.firefox
00:22:22	(14.0 %)		241299.25	(2.0 %)		com.apple.system
00:09:07	(5.7 %)		55008.01	(0.4 %)		com.apple.softwareupdated
00:02:43	(1.7 %)		17392.06	(0.1 %)		com.apple.system_installd
 
Ranked by Interrupts / Idle Wakeups:
7441505 (777.4/sec)	5347650 wkups (558.7/sec)	com.apple.system
1052357 (109.9/sec)	 365779 wkups (38.2/sec)	org.mozilla.firefox
  81445 (8.5/sec)	  36247 wkups (3.8/sec)	com.apple.WindowServer
  23273 (2.4/sec)	   7524 wkups (0.8/sec)	com.apple.Spotlight
  15805 (1.7/sec)	   8572 wkups (0.9/sec)	com.apple.audio.coreaudiod
 
Ranked by Process Launches (incl. XPC svcs. & fork()):
    271	com.apple.system_installd
    152	com.apple.Terminal
    136	com.apple.Spotlight
    109	com.apple.periodic-daily
     84	com.apple.diskarbitrationd
 
Ranked by GPU:
06:59:19	262.84 %		com.apple.WindowServer
01:10:41	44.31 %		org.mozilla.firefox
00:00:00	0.00 %		com.apple.system
00:00:00	0.00 %		com.apple.SystemUIServer.agent
00:00:00	0.00 %		com.apple.InstallerProgress
 
Ranked by Focal Duration:
01:09:49	43.77 %		com.apple.finder

Use this utility to get comprehensive data about your network interfaces in your Mac OSX machine.

deusexmachina:~ jason$ system_profiler SPNetworkDataType

Get a complete listing of all WIFI networks around you.

deusexmachina:~ jason$ system_profiler SPAirPortDataType
Wi-Fi:
 
      Software Versions:
          CoreWLAN: 11.0 (1200.31)
          CoreWLANKit: 12.0 (1200.31)
          Menu Extra: 12.0 (1200.47)
          System Information: 12.0 (1200.3)
          IO80211 Family: 12.0 (1200.12.2)
          Diagnostics: 7.0 (700.5)
          AirPort Utility: 6.3.7 (637.6)
      Interfaces:
        en0:
          Card Type: AirPort Extreme  (0x14E4, 0x117)
          Firmware Version: Broadcom BCM43xx 1.0 (7.21.171.133.1a2)
          MAC Address: e0:ac:cb:9c:18:a2
          Locale: FCC
          Country Code: AU
          Supported PHY Modes: 802.11 a/b/g/n/ac
          Supported Channels: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165
          Wake On Wireless: Supported
          AirDrop: Supported
          AirDrop Channel: 149
          Auto Unlock: Supported
          Status: Connected
          Current Network Information:
            OPTUS58FFG69:
              PHY Mode: 802.11ac
              BSSID: c8:14:51:5f:a9:54
              Channel: 36
              Country Code: AU
              Network Type: Infrastructure
              Security: WPA2 Personal
              Signal / Noise: -38 dBm / -95 dBm
              Transmit Rate: 867
              MCS Index: 9
          Other Local Wi-Fi Networks:
            OPTUS_B8E926:
              PHY Mode: 802.11n
              BSSID: f4:6b:ef:b8:e9:27
              Channel: 11
              Country Code: AU
              Network Type: Infrastructure
              Security: WPA/WPA2 Personal
              Signal / Noise: -84 dBm / 0 dBm
            TelstraD223D3:
              PHY Mode: 802.11n
              BSSID: 10:13:31:d2:23:d3
              Channel: 6
              Network Type: Infrastructure
              Security: WPA2 Personal
              Signal / Noise: -92 dBm / 0 dBm
            TelstraD22F23:
              PHY Mode: 802.11n
              BSSID: 12:13:31:d2:2f:2b
              Channel: 108
              Country Code: AU
              Network Type: Infrastructure
              Security: WPA2 Personal
              Signal / Noise: -87 dBm / 0 dBm
            TelstraD22F23:
              PHY Mode: 802.11n
              BSSID: 10:13:31:d2:2f:23
              Channel: 11
              Network Type: Infrastructure
              Security: WPA2 Personal
              Signal / Noise: -83 dBm / 0 dBm

These tips will be a great help when using a Macintosh laptop around town, now you know how to list wireless networks and get system information very easily with the command line in Terminal.app.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.