![]() ![]() ![]() If you want to put a little more effort in, and parse more data out, I recommend using the -online argument to the ip command, which will let you treat every line as a new device: $ ip -o linkġ: lo: mtu 16436 qdisc noqueue \ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00Ģ: eth0: mtu 1500 qdisc pfifo_fast qlen 1000\ link/ether 00:0c:29:30:21:48 brd ff:ff:ff:ff:ff:ffģ: eth1: mtu 1500 qdisc pfifo_fast qlen 1000\ link/ether 00:0c:29:30:21:52 brd ff:ff:ff:ff:ff:ffĤ: tun0: mtu 1500 qdisc pfifo_fast qlen 100\ link/ĥ: sit0: mtu 1480 qdisc noop \ link/sit 0.0.0.0 brd 0.0.0. You can trivially get the mac address from this output with awk: $ ip link show eth0 | awk '/ether/ ' This command will list MAC address, IP address, MTU size and other information about a network interface. The number next to ether is the MAC address. All we need is to open the terminal then type ifconfig -a in the prompt. Link/ether 00:0c:29:30:21:48 brd ff:ff:ff:ff:ff:ff The best Linux command to find MAC address is using ifconfig command. Share Improve this answer Follow answered at 16:03 Johan Myren 12.7k 1 30 32 is it the link/ether field under eth0 amphibient at 16:05 1 Yes, that is the MAC address. I like using /sbin/ip for these kind of tasks, because it is far easier to parse: $ ip link show eth0Ģ: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 1 Answer Sorted by: 5 The command ip link shows the MAC address on all interfaces. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |