How to get Mac address in Linux

Posted David Cao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to get Mac address in Linux相关的知识,希望对你有一定的参考价值。

using ifconfig to check MAC address

ifconfig -a

ens1f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

    inet 10.124.202.230  netmask 255.255.255.128  broadcast 10.124.202.255

    ether 70:ca:9b:ce:67:ae  txqueuelen 1000  (Ethernet)

    RX packets 12187970  bytes 7390885300 (6.8 GiB)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 16813496  bytes 16253942714 (15.1 GiB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    device memory 0xb1960000-b197ffff  



Using IP link show to get mac address

ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: ens1f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000

link/ether 70:ca:9b:ce:67:ae brd ff:ff:ff:ff:ff:ff

from /sys to get mac address

more /sys/class/net/ens1f0/address

70:ca:9b:ce:67:ae

3 ways to get Mac address in Linux

以上是关于How to get Mac address in Linux的主要内容,如果未能解决你的问题,请参考以下文章

给ubuntu设置静态ip —— How to set static IP Address in Ubuntu Server 16.04

How to use Linux shell command filter the IP address All In One

If application data needs to be sent to IP address xx.xx.xx.xx, how does it work in underneath netwo

how-to-get-a-job-in-deep-learning

How to get the edited text from itext in fabricjs

How to get gradients with respect to the inputs in pytorch