linsap12
linsap12

Reputation: 21

Shell/Unix - Getting MAC Address

I would like to know how we get our MAC address on an UNIX environment, I know already ifconfig -... but I'm getting others stuff too (I just want the MAC address, nothing more).

Upvotes: 0

Views: 1220

Answers (2)

mohangraj
mohangraj

Reputation: 11034

Try this:

ifconfig|sed -n "1p"|tr -s ' '|cut -d ' ' -f5

Upvotes: 1

alperenAsa
alperenAsa

Reputation: 101

Is it possible ?

As the root user (or user with appropriate permissions

Type "ifconfig -a"

From the displayed information, find eth0 (this is the default first Ethernet adapter),locate the number next to the HWaddr. This is your MAC address..

Upvotes: 1

Related Questions