How to find the MAC address using the command line in Linux

Today, TipsMake.com will talk about an important command in Linux, ip . This command works on all Linux distributions, including Ubuntu, Arch Linux, Debian, Fedora, etc.

Ip command

The ip command is a very powerful command that replaces the ifconfig command and is part of the network tool pack. The general syntax of the command is as follows:

 ip xx 

Where xx must be replaced with one of the following to get the desired output.

  1. -V to display ip utility version
  2. -s to display more information about the command
How to find the MAC address using the command line in Linux Picture 1
Ip command in Linux

Find the MAC address of the Linux system

The MAC address is an important parameter of network equipment, including PC hardware or servers. Every PC's network device needs a unique MAC address.

Launch Terminal and enter the ip link command:

 ip link show 

Example results:

 1: lo: 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: enp1s0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether XXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff 3: wlp2s0: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether YYYYYYYYYYYY brd ff:ff:ff:ff:ff:ff  1: lo: 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: enp1s0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether XXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff 3: wlp2s0: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether YYYYYYYYYYYY brd ff:ff:ff:ff:ff:ff  1: lo: 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: enp1s0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether XXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff 3: wlp2s0: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether YYYYYYYYYYYY brd ff:ff:ff:ff:ff:ff  1: lo: 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: enp1s0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether XXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff 3: wlp2s0: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether YYYYYYYYYYYY brd ff:ff:ff:ff:ff:ff 

The ip utility will list a few parameters of the device. For each device, there are two lines summarizing the link state and characteristics. The first line summarizes the device's current name, the flags set on the device, MTU (Maximum Transmission Unit), etc.

The second line indicates the type of link layer in use and the current hardware address (MAC address). In the example above, XXXXXXXXXXXX and YYYYYYYYYYY are the MAC addresses of the two LAN connections in use.

4 ★ | 2 Vote

May be interested

  • How to print from the Linux command lineHow to print from the Linux command line
    printing documents from the linux command line is easy. you use the lp command to request printing and lpq to see which print jobs are in the queue.
  • 20+ essential Linux security commands20+ essential Linux security commands
    here are some of the most important security commands for everyday work on linux systems. if you're interested in security issues on your linux system, don't ignore these helpful security commands.
  • 14 interesting Linux commands in Terminal14 interesting Linux commands in Terminal
    terminal is a very powerful tool, but it can become 'interesting' through a few bash commands that quantrimang will introduce to you later. let's follow up and find out because some commands are quite useful.
  • How to Ping in LinuxHow to Ping in Linux
    this wikihow teaches you how to test a connection between your linux computer and another computer by using the 'ping' command. you can also use a more advanced version of the 'ping' command that's called 'traceroute' to see the different...
  • How to schedule Linux commands with 'at'How to schedule Linux commands with 'at'
    utility at very easy to use. users only need to give time and date as command line parameters, then enter one or more commands to execute.
  • How to change MAC addresses on Windows, Linux and MAC OS XHow to change MAC addresses on Windows, Linux and MAC OS X
    one of the flaws that can't catch wifi is because the network card's mac address does not match the mac address of the primary wifi network. therefore, you need to change the mac address on the computer.
  • How to Get MAC Address Using Remote IP AddressHow to Get MAC Address Using Remote IP Address
    do you need to determine the mac address of a certain computer on the network? whether you are using windows, macos or linux, you can easily find the mac address of any server on your local network with a few simple commands. today's tipsmake will show you how to use commands like arp and getmac to determine the mac address of a specific ip or hostname, in addition to how to use the nmap command to see all mac addresses in the network.
  • How to find the router IP address on any platformHow to find the router IP address on any platform
    if you need to make any changes to your network, you will usually have to log into the router's configuration page, by entering the router's ip address into a web browser. but how to find the router ip address?
  • How to check internet speed with the command line in LinuxHow to check internet speed with the command line in Linux
    today, tipsmake.com will read how to check the speed of the internet from the command line via terminal in various popular linux distributions, including ubuntu, fedora and arch linux.
  • How to manage Linux services using SystemdHow to manage Linux services using Systemd
    one of the most important skills that any new systemd user needs to learn is how to manage computer services. this article will teach you the basics: start, stop, enable and disable services from the linux command line.