![]() ![]() ![]() I also needed to get the name of my network interfaces and I'll be using the arp one on my instances that don't know their single network device as well as their whole existance is entirely abstracted. Nobody is paying me so, that is all I have time for today. I only tested my commands on my Kubuntu laptop. Also, find, arp, awk, sed, and sort are generally on every linux device already. spaces, newlines, other weird characters.). Good chance network interfaces are not named in ways that break stuff the usual way (i.e. With a "clean list" of names, you can plug them into most other commands and test for the MAC address of all zeroes or a virtual attribute. It for sure includes my wifi network interface. Also the interface eth0 may be present but is unused. Also on OS X the interface names are different. ![]() But what if instead of eth0 my interfaces start with eth1. I am not sure if that gets rid of the "virtual devices". Get MAC address using shell script Loaded 0 Currently all the solution mentioned for getting the MAC address always use eth0. With the arp command, you can specify "ethernet" devices. (explanation: gimme the arp table info | don't print if line 1, which are arp table headers | only print the fifth column | delete empty lines | aphabetize and remove duplicates) find /sys/class/net -type l -execdir basename '' | sed '/^$/d'| sort -u I came up with two ways I thought were "okay". We need a "clean list of interfaces" that doesn't have the loopback. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |