Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of 'Friendly interface names' on a Mac (Airport, Ethernet, etc)

I'm developing an application in RealBASIC, but I need the list of interface names to populate a dropdown box.

Parsing ifconfig didn't work (got eth0, eth1, lo, etc.). I need the name that is displayed in system preferences (Ethernet, Airport, etc.).

Is there a terminal command that I can parse?

like image 441
Justin Avatar asked Oct 16 '10 15:10

Justin


1 Answers

networksetup -listallnetworkservices will give you just the names (with an asterisk before disabled ports, in case you want to leave them out). networksetup -listnetworkserviceorder gives some additional info, like what /dev entry (en0, etc) they correspond to. Check the man page for networksetup for even lots more options...

like image 105
Gordon Davisson Avatar answered Oct 31 '22 14:10

Gordon Davisson