Skip to content

Instantly share code, notes, and snippets.

@MasahiroSakoda
Created September 14, 2024 20:44
Show Gist options
  • Save MasahiroSakoda/ffaba3ea6ca8b03e1dcbfbbc1fe478a5 to your computer and use it in GitHub Desktop.
Save MasahiroSakoda/ffaba3ea6ca8b03e1dcbfbbc1fe478a5 to your computer and use it in GitHub Desktop.
Network Command Cheatsheet for macOS

airport vs wdutil

Options airport usage wdutil usage
Info sudo airport -I sudo wdutil info
Diagnose sudo wdutil diagnose
Dump airport -x sudo wdutil dump
Log sudo wdutil log +wifi
Scan airport -s
Key airport -P --ssid=SSID --password=PASSWORD

networksetup command

Turn off WiFi

networksetup -setairportpower en0 off

Turn on WiFi

networksetup -setairportpower en0 on

Get current SSID

networksetup -getairportnetwork en0 | cut -c 24-

Get current IP Address

networksetup -getInfo Wi-Fi | rg -e "(^IP\ Address:)" | awk '{print $3}'

Get current MAC Address

networksetup -getInfo Wi-Fi | rg -e "(^Wi-Fi\ ID:)" | awk '{print $3}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment