How do I find out the MAC address of my Linux or FreeBSD system?

Q. Can you tell me how can I find out MAC address under Linux or FreeBSD server?

A. A mac address is acronym for media access control address, is a unique address assigned to almost all-networking hardware such as Ethernet cards, router etc. Most layer 2 network protocols use one of three numbering spaces managed by the IEEE: MAC-48, EUI-48, and EUI-64, which are designed to be globally unique. (see mac address at wikipedia for more information).

Following command work with Linux and other UNIX oses:

ifconfig command

Ifconfig is used to configure the kernel-resident network interfaces.

In order to find out MAC address of system you can use ifconfig command as follows:
$ /sbin/ifconfig | grep HWaddr

eth0      Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07


$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07
        inet addr:  Bcast:  Mask:
        inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link
        RX packets:60400 errors:0 dropped:0 overruns:0 frame:0
        TX packets:109216 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:69273219 (66.0 MiB)  TX bytes:14285799 (13.6 MiB)
        Interrupt:18 Base address:0xc000

lo        Link encap:Local Loopback
        inet addr:  Mask:
        inet6 addr: ::1/128 Scope:Host
        UP LOOPBACK RUNNING  MTU:16436  Metric:1
        RX packets:3869 errors:0 dropped:0 overruns:0 frame:0
        TX packets:3869 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:396498 (387.2 KiB)  TX bytes:396498 (387.2 KiB)

OR as a root user type following command:

# grep eth0 /var/log/dmesg
eth0: RealTek RTL8139 at 0xc000, 00:0f:ea:91:04:07, IRQ 18
eth0:  Identified 8139 chip type 'RTL-8100B/8139D'
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

FreeBSD example

# ifconfig

lnc0: flags=108843 mtu 1500
        inet 74.xx.yy.zzz netmask 0xfffffff0 broadcast 74.xx.yyy.zzz
        ether 00:0c:29:b8:92:8b
plip0: flags=108810 mtu 1500
lo0: flags=8049 mtu 16384
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet6 ::1 prefixlen 128 
        inet netmask 0xff000000

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Roel Jan 18, 2008 @ 9:01

    If your FreeBSD machine is up too long, the dmesg might have cycled and is not visible. The ifconfig command does not display the HW address in FreeBSD. The sysctl command does not hold the value, so, I am basically lost. :(

  • thanker Nov 20, 2008 @ 18:23

    thank you

  • Ricardo Fabbri Jul 25, 2009 @ 0:39


    ifconfig -a

    because that will show you the MAC address even if you’re not connected.

  • Jeremy Aug 4, 2009 @ 13:53

    Thanks for the help.

    Just want to know how would I find out the MAC address of a linux machine on my network(remotely)?

    Thanks in advance.

  • Techie Talks Jul 2, 2012 @ 1:20

    ifconfig | grep ether

    ether 00:90:7c:5d:0b:24
    ether 00:c9:c2:87:94:83
    ether 00:05:58:57:e5:74

  • Ravi Sep 5, 2014 @ 6:37

    how to get same thing(00:90:7c:5d:0b:24) in windows operating system
    using PHP

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @