ber*_*rdt 32
ifconfig en1获取wifi的接口详细信息,mac在以ether开头的行上,并且是该行的第二个字,所以:
ifconfig en1 | awk '/ether/{print $2}'
Run Code Online (Sandbox Code Playgroud)
networksetup -getmacaddress <interface>
Run Code Online (Sandbox Code Playgroud)
我认为获取信息的最佳和最简单的方法是使用此命令:
networksetup -listallhardwareports
Run Code Online (Sandbox Code Playgroud)
它将返回一个很好的设备列表,如下所示:
Hardware Port: USB 10/100/1000 LAN
Device: en6
Ethernet Address: 00:e0:4c:...
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 80:e6:50:...
Hardware Port: Bluetooth PAN
Device: en3
Ethernet Address: 80:e6:50:...
Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: 72:00:05:...
Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: 72:00:05:...
Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: 72:00:05:...
VLAN Configurations
===================
Run Code Online (Sandbox Code Playgroud)
小智 8
这将轻松为您提供 Wifi 接口的特定 Mac 地址
networksetup -listallhardwareports | grep Wi-Fi -A 3 | awk '/Ethernet Address:/{print $3}'
Run Code Online (Sandbox Code Playgroud)
Wifi mac 地址通常可以在 en0 中找到。所以你可以在终端上尝试这个命令
ifconfig en0 | awk '/ether/{print $2}'
Run Code Online (Sandbox Code Playgroud)
ifconfig应该可以解决问题,它会显示一堆信息,包括您的 MAC 地址。或者,它将位于系统首选项下的网络设置中。
编辑
在只有无线连接的计算机上,en0 将拥有您的 wifi 设置。标有 ether 的标签很可能是您的 MAC 地址。
如果您同时具有有线和无线连接,它将在 en1 标签中的 ether 下
来源:http : //m.iclarified.com/entry/index.php?enid=30929
| 归档时间: |
|
| 查看次数: |
26790 次 |
| 最近记录: |