15

What command can I enter in a terminal to find out the MAC address of my WiFi adapter?

7 Answers 7

26

The command

ip addr

will tell. ifconfig is a tool obsolete since 2001.

2
  • 1
    In fact quite before that. I remember that we switched our self-made carrier-grade Linux (for ISPs) completely over to iproute2 back in summer of 1999; and before that we had already used it for a couple of months. In 1999, ifconfig was already quite faulty with regard to VPN device setups (secondary IP addresses with aliases), like CIPE for example and exhibited massive race conditions if you had to reconfigure a box with hundreds of running VPN tunnels. Our boxes had up to 16 NICs (quad boards) and route had a problem sometimes displaying our hundreds of routing table entries.
    – ikaerom
    Aug 30, 2013 at 19:43
  • 1
    How will it tell? The output I get from that command means nothing to me. May 23, 2022 at 22:41
9

Combining the answer from @user562374 with a little scripting:

ip addr show $(awk 'NR==3{print $1}' /proc/net/wireless | tr -d :) | awk '/ether/{print $2}'

The wireless interface is shown in /proc/net/wireless and that is used to extract the MAC address from the ip addr output.

5

You will want to look at iwconfig and ifconfig for information about your ethernet controllers. iwconfig is geared towards wireless.

5

For details about your wifi interface, use

iw dev

Or, if you just want the MAC address

iw dev | grep addr | awk '{print $2}'
1
  • 2
    This answer is current and correct as of 2021. The original question and most of the other answers are over a decade old!
    – bitsmack
    Mar 23, 2021 at 9:01
3
/sbin/ifconfig | grep HWaddr

You can add the interface name of your WiFi card (e.g. wlan0) after ifconfig, but it's not necessary.

1
  • On my Ubuntu 10.04 and 10.10 systems, the wifi interface is eth1.
    – Arcege
    Jan 30, 2011 at 21:33
3

From the arch wiki docs:

To find the MAC address that corresponds with a particular interface (ie wlan0), you can enter this command:

ip link show <interface-name>

The MAC address is the one that has "link/ether" followed by a 6-byte number. It will probably look something like this:

link/ether e8:b1:fc:9c:a6:8a brd ff:ff:ff:ff:ff:ff

Where the MAC address is e8:b1:fc:9c:a6:8a

*If you don't know your interface name, just enter ip link to list the MAC addresses and interface names of all your interfaces. *

0
1
ip addr show $(iw dev | awk '/Interface/{print $2}') | awk '/ether/{print $2}'

works on Debian and Ubuntu

2
  • 2
    It's always best to explain your answer for future visitors. Please take some time to do it. Aug 3, 2022 at 13:49
  • Example output? Aug 3, 2022 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy