1

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)

2

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)
      MAC Address: xx:xx:xx:xx:xx:xx
      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.

0

With some clever use of awk/sed you could probably get what you're looking for from this output:

defaults read /Library/Preferences/SystemConfiguration/NetworkInterfaces

To get the list of interfaces on the machine is fairly straightforward:

ifconfig -l

Probably best to read that list in and loop through it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .