Get nic name and interface via command line

ethernetNetwork

What I am trying to do is to get the interface name and the nic name (description) via command line in OS X.

On Windows the following command gives me the result I am looking for:
wmic nic get name, index (this outputs for example: 11 Realtek blah )

On OS X I would like to see: en0 Realtek as the output.

Thank you for your help and sorry for my explanations (its late at night and my english is not so good)

This isn't a pretty way to do it, but it does get you the info you desire:

system_profiler | grep "Interfaces" -A15


The command is slow, mostly because of how much data system_profiler spews out. But as a summary:

1. system_profiler lists loads of info about the system
2. | is a "pipe" and puts the output of 1 to another command (3)
3. grep searches for patterns/words, in our case "Interfaces"
4. The switch -A15 prints out the 15 lines following the match.

Example output:

  Interfaces:
en0:
Card Type: AirPort Extreme  (0x14E4, 0xEF)
Firmware Version: Broadcom BCM43xx 1.0 (5.106.98.100.17)
Locale: FCC
Country Code: US
Supported PHY Modes: 802.11 a/b/g/n
Supported Channels: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
Wake On Wireless: Supported
AirDrop: Supported
Status: Connected
Current Network Information:
mynetwork:
PHY Mode: 802.11n
BSSID: xx:xx:xx:xx:xx:xx


You can limit -A15 to a lower number (say 3) to just get the card id and the Firmware version (i.e. That'll be the chipset). If that is too much info, you can always get some info on your interfaces with ifconfig or network setup -listallhardwareports, but neither includes info about the chipset/manu unless you want to parse it out of the MAC address (first 6 chars, I think).

Otherwise, you could look into installing lspci, but that is probably in the scope of another question.