1. Home
  2. Linux

How to get your Linux MAC address

Need to find your Linux MAC address but can’t figure it out? We can help! Follow along as we go over the different ways you can discover your network adapters’ MAC address on Linux! 

Linux MAC address

Linux MAC address – IP Link Show

There are many ways to view your MAC address in Linux. That said, the easiest way to do it is in the terminal with IP LINK SHOW. This tool can show you all attached network devices on the system and IP address and MAC address information.

To get started, open up a terminal window. To open up a terminal window on the Linux desktop, press the Ctrl + Alt + T keyboard combination. Alternatively, open up the app menu and search for “Terminal,” and launch the app that way.

Once the terminal window is open and ready to go, you can use the ip link show command below to display all attached network devices.

ip link show

From here, look through the command output for your network device. In this example, we’ll use the “wlan0” network device. Your device will differ. 

When you’ve found your device in the command output, look for the “link/ether” section. Next to “link/ether” is your MAC address. If you’d like to save this information for later, you can rerun the ip link show command in combination with the > redirect function. 

ip link show > ~/my-mac-address-information.txt

At any time, if you wish to view the output of this text file, you can execute the following cat command and view the ‘my-mac-address-information.txt’ file. 

cat ~/my-mac-address-information.txt

Alternatively, open up the Linux file manager and double-click on the “my-mac-address-information.txt” file in your home folder to launch the file in your favorite text editor. 

 Linux MAC address – /sys

Aside from the IP LINK SHOW tool, you can view your MAC address information on Linux through the /sys folder on Linux. This method isn’t as simple as entering a command, but if you’re not happy with using the first method we’ve covered, this is a great way to get MAC address info.

To start, open up a terminal window. To open up a terminal window on the Linux desktop, press Ctrl + Alt + T  on the desktop. Alternatively, you can open up your app menu and search for “Terminal,” and launch the app that way.

Once the terminal window is open on the Linux desktop, use the CD command to move into the /sys folder.

cd /sys

When you’ve made it into the /sys folder in the terminal window, execute the ls command to take a look at the contents of the folder. 

ls

Look at the ls output. You should see the “class” folder. If you do not see the “class” folder, restart your Linux PC and try again. Once you’ve located the “class” folder, use the CD command to move into it.

cd class

Inside the “class” folder, run the ls command again and locate the “net” folder. This folder holds all network adapter info. 

ls

Using the CD command, move into the “net” folder.

cd net

Inside the “net” folder, run the ls command. After running the ls command, you should see an output of every network device connected to your Linux PC. For example, you may see Enp5s0 (ethernet on some Linux systems), Wlan0 (WiFi on some Linux systems), and lo (standard loopback device on every Linux distribution.

Determine what network device you need to find the MAC address for. Then, use the CD command to move into its folder. In this example, we’ll use the “wlan0” folder.

Once inside of the folder, execute the cat command to view your MAC address for the device. 

cat address

Want to save your MAC address to a text file? Enter the following command.

cat address > ~/my-mac-address.txt

Linux MAC address – Ifconfig

A third way you can view your network adapter’s MAC address on Linux is with the Ifconfig tool. Keep in mind, the Ifconfig tool is retired, and not many Linux operating systems ship it anymore. However, if you’re on a Linux OS that still has Ifconfig, you can use it to find your MAC address. Here’s how.

First, open up a terminal window. Once the terminal window is open, use the ifconfig command below to view all attached network devices.

ifconfig

After the command is run, look for the network device you wish to find the MAC address of. In this example, we’ll be looking for “wlan0,” the default WiFi device. 

Under your network device, find “ether.” Next to “ether” is your MAC address. 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.