How To Get Mac Address In Linux

Media Access Control (MAC) address is a unique identifier assigned to network interfaces for communications on the physical network segment. In this blog post, we will learn how to get the MAC address in Linux using simple commands.

Using the ifconfig Command

To obtain the MAC address of any ethernet interface using an ifconfig command, you can follow the steps below. This command is widely used to configure, manage and query network interface parameters of a Linux system.

First, you need to open your terminal in your Linux system. Then, simply type the following command:

        ifconfig
        

This command will display the details of your network interfaces. Your MAC address is listed next to the HWaddr or ether on the output.

Using the ip Command

Another way to get the MAC address in Linux system is by using the ip command. The ip command is used to show or manipulate routing, network devices, interfaces and tunnels.

To get the MAC address, open your terminal and type the following command:

        ip link show
        

The output will show a list of network interfaces with the MAC address displayed next to the link/ether.

Conclusion

Obtaining the MAC address in a Linux system is quite simple and straightforward. You can use the ifconfig or the ip command, both of which provide valuable information about your network interfaces. Understanding your network and its interfaces is an essential part for any system or network administrator working with Linux.