How to Find MAC Address in Linux System

Reference article:

Multiple Ways to Find MAC Address on Linux

Introduction:
MAC (Media Access Control) address is a unique identifier of a network device (such as a network card), which is used for communication in a local area network. There are several ways to find the MAC address of a device on a Linux system. In this article, we will introduce two common methods to help you find MAC address in Linux system.

1. Use the ifconfig command to find the MAC address (word)
The easiest way is to use ifconfigthe command. This command is used to configure and display network interface information, including MAC address. Execute the following command:

ifconfig 接口名称

In the command, replace "interface name" with the name of the network interface whose MAC address you want to find, such as eth0 or wlan0. After executing the command, you will see output with details about the interface, including the MAC address. In the output, look for a line that looks like "HWaddr" or "ether," followed by the MAC address of the interface.

2. Use the ip command to find the MAC address (word)
Another common method is to use ipthe command. This command is used to configure and display network interface information, including MAC address. Execute the following command:

ip link show 接口名称

In the command, replace "interface name" with the name of the network interface whose MAC address you want to find, such as eth0 or wlan0. After executing the command, you will see detailed output about the interface. In the output, look for a line that looks like "link/ether" and the string that follows is the MAC address of the interface.

Conclusion (words):
In Linux system, you can easily find the MAC address of a device by using the ifconfigor command. ipThese commands provide details of network interfaces, including MAC addresses. By knowing the MAC address of a device, you can play an important role in network configuration and troubleshooting. Whether you use ifconfigor ipcommand, you can quickly get the MAC address information you need.

Note: The commands and examples mentioned in this article apply to most Linux-based distributions, but there may be differences in some specific distributions or system environments. Please adjust accordingly according to your actual environment.

Guess you like

Origin blog.csdn.net/linux_tcpdump/article/details/131605712