mac vendor lookup using bash script

Simple bash script that while give you the vendor of your device.


A media access control address (MAC address), also called physical address, is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and WiFi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model.

A universally administered address is uniquely assigned to a device by its manufacturer. The first three octets (in transmission order) identify the organization that issued the identifier and are known as the Organizationally Unique Identifier (OUI).

It is a number (or better: a sequence of numbers)  that identifies a physical device in a network. It works in the two lower layers of the OSI model (which are the Data Link Layer and the Physical Layer). It is meant to be unique in a (sub)network.

MAC stands for Media Access Control, so it has to do with the devices’ access to the transmission medium (that can be wire, radio waves, optical fiber, etc).

To finish, one can make an analogy with the IP Address: it identifies a unique device in a network. The difference is that it operates in a more hardware-oriented level.

Extra: the first 6 digits of a MAC  address usually have a special meaning: they may indicate the device’s manufacturer; see a list of them:…


if [ $# -eq 0 ]
echo "Enter only first three octet of mac adddress
        for ex - xx-xx-xx or xx:xx:xx"
touch output.txt
trans=`echo "$1" | tr ':' '-'`
upper=`echo "$trans" | tr '[a-z]' '[A-Z]'`
cat oui.txt | grep $upper | cut -f3 > output.txt
cat oui1.txt | grep $upper | cut -f3 > output.txt
cat oui2.txt | grep $upper | cut -f3 > output.txt
if [ -s $outfile ]
 cat output.txt
  echo "Enter only first three octet of mac adddress
        for ex - xx-xx-xx or xx:xx:xx"


save the script
#chmod +x
download following file also
save following file with the name convention as oui.txt,oui1.txt,oui2.txt

—————–screenshot :——————–

Output :-                 #./ 00:23:ae
Pass first six digit as the argument.








Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s