Here is a simple script we can use to find the mac address of the network card in our systems.
We will use the command ifconfig to find the mac address and in some distribution ifconfig is available only to the root hence we make use of "sudo" before ifconfig.
For wired connection
For wireless connection
We will use the command ifconfig to find the mac address and in some distribution ifconfig is available only to the root hence we make use of "sudo" before ifconfig.
For wired connection
For wireless connection
sudo /sbin/ifconfig | awk '/eth[0-9]/{ print $NF}'
ReplyDeletethat sure is a better way, thank you.
Delete... use awk or grep only as there is really no need of using both of them in this case:
ReplyDelete# sudo ifconfig | grep -Eo '([a-zA-Z0-9]{2}\:){5}[a-zA-Z0-9]{2}'
Yes agree with you, did not think of that. Thank you.
Delete