Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@packetchef
Created August 6, 2015 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save packetchef/c3f9764bb4a326626df0 to your computer and use it in GitHub Desktop.
Save packetchef/c3f9764bb4a326626df0 to your computer and use it in GitHub Desktop.
For OS X: show details for all network interfaces
#!/bin/bash
oldIFS=$IFS
IFS='
'
NETWORKSETUP=$(whereis networksetup)
NETWORKSERVICES=$($NETWORKSETUP -listallnetworkservices | grep -v '^An asterisk')
for service in $NETWORKSERVICES
do
echo "Service config for $service"
$NETWORKSETUP -getinfo "$service"
echo "******"
done
IFS=$oldIFS
Example output:
******
Service config for Display Ethernet
DHCP Configuration
Client ID:
IPv6: Automatic
IPv6 IP address: none
IPv6 Router: none
Ethernet Address: ac:ac:ac:ac:ac:ac
******
Service config for Wi-Fi
DHCP Configuration
IP address: 10.10.10.10
Subnet mask: 255.255.0.0
Router: 10.10.10.254
Client ID:
IPv6: Automatic
IPv6 IP address: none
IPv6 Router: none
Wi-Fi ID: 60:60:60:60:60:60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment