How to Find Your MAC Address on Ubuntu

How to Find Your MAC Address on Ubuntu

At some point when running Ubuntu on your local machine or a server it can be useful to find out what your MAC address is. In this tutorial I will showcase three ways you can get hold of your MAC address or devices connected to your system.

What is a MAC Address?

A MAC address is a unique identifier assigned to a network interface controller. In short, it's used as a network address in communications within a network segment. A MAC address (Media Access Control Address) can be utilized as a unique identifier for individual devices on a network, specifically for Media Access Control.

A MAC address is built-up of a 12 digit hexadecimal and is tied to the Network Interface Controller (NIC). Most commonly, the MAC address is separated every second charater with a colon or a hyphen, creating the following format XX:XX:XX:XX:XX:XX, or XX-XX-XX-XX-XX-XX. However, in some rare instances the format might also be displayed without colon or hyphen separators XXXXXXXXXXXX.

Use ip command to get your MAC address on Ubuntu

The MAC address is the link/ether field of the output. Mostly this will be present in the second line.

Run IP in your Terminal

The ip command is a powerful tool for configuring network interfaces on Linux systems. You can use ip to bring interfaces up or down, assign and remove addresses and routes, manage ARP cache, and much more. Open up your terminal and run ip link show

ip link show


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65486 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 35:12:40:9c:61:47 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic eth0
       valid_lft 2900sec preferred_lft 2900sec
    inet6 fe80::5854:ff:fe8c:6454/64 scope link 
       valid_lft forever preferred_lft forever

The MAC address is the link/ether field of the output.

Utilize ifconfig to find your MAC address on Ubuntu

Ifconfig stands for “interface configuration” and is used to view and change the configuration of network interfaces.

1. Install ifconfig on Ubuntu

ifconfig is a command-line tool that used to ship in all base installations of Ubuntu. However, as of Ubuntu 9.10 (Karmic Koala) this is no longer the case. I would suggest that you only utilize ifconfig if you're running version of Ubunte released 2009 and erlier. With that said, ifconfig can still be installed an latter versions of Ubuntu if need be.

2. Run ifconfig

ifconfig -a


ens1f0: flags=4163 mtu 1500
inet netmas broadcast
ether 70:ca:9b:ce:67:ae txqueuelen 1000 (Ethernet)
RX packets 12187970 bytes 7390885300 (6.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16813496 bytes 16253942714 (15.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xb1960000-b197ffff

Find your MAC address from /sys Directory

The /sys directory allows us to get information about your system and all of its components. Contents of this folder can be useful to identify attached and installed hardware in a familiar and structured way.

1. Navigate to /sys/class/net/interface-name/address

We can get the MAC address from the file /sys/class/net/interface-name/address.

2. Use cat to Print your MAC Address

We can make us of cat to print the contents of the file /sys/class/net/eth0/address to your command-line.

cat /sys/class/net/eth0/address



3. Use cat to Print all MAC Addresses of your system

Sometimes it useful to see mac adresses of all devices connected to your system. By using cat again we can fetch all addresses at /sys/class/net/*/address.

cat /sys/class/net/*/address


Freddie Freddie 1 year, 10 months ago 0
Login to Comment
No comments have been posted yet, be the first one to comment.
How to Install Pip on Ubuntu 18.04 LTS
How to Install Pip on Ubuntu 18.04 LTS
Pip is the standard package manager for the programming language Python. Pip drastically simplifies the process of installing and manage open source Python packages. All available Python packages can be browsed at (the Python Package Index), and if you end up publishing your ...
How to install NodeJS on Fedora 35
How to install NodeJS on Fedora 35
The easiest way to install NodeJS on Fedora 35 is to use the dnf package manager. Use DNF to download NodeJS Simply Open up your terminal and run the following command. sudo dnf install nodejs Verify the packages to download After you have run sudo dnf install nodejs you will have to ...
How to Create SSH Keys for Linux
How to Create SSH Keys for Linux
An SSH key is an access credential utilized for the SSH protocol. Its function is similar to that of user names and passwords, but the keys are primarily used for accessing servers via the command line. Create SSH Key To create and SSH key on Linux we can use the command ssh-keygen. s...