Wednesday, July 19, 2017

How to get the serial number of your network device in linux?


1. sudo lshw -C network | grep -i serial
    lshw    - Command used to list the details of all available hardware in a system.
    -C      - Option used to specify hardware "class".
        network - We asked "lshw" to list only the network devices.

    grep    - Command used to print lines that matches the given pattern
    -i    - Option used to ignore case sensitivity
    serial    - Pattern used to fetch the lines that contains the word "serial"

Example:
$sudo lshw -C network | grep -i serial
[sudo] password for :
       serial: 78:f2:9e:f3:88:e7

   
2. /sbin/ifconfig | grep -i hwaddr or sudo ifconfig | grep -i hwaddr
    ifconfig-Command used to configure network devices.
    grep    - Command used to print lines that matches the given pattern
    -i    - Option used to ignore case sensitivity
    serial    - Pattern used to fetch the lines that contains the word "serial"


Example:
$/sbin/ifconfig | grep -i hwaddr
eth0      Link encap:Ethernet  HWaddr 78:f2:9e:f3:88:e7  


3. GUI Way
Applications -> System Tools -> Settings

                                  You will land in the following screen
Settings panel



Click on Network the following window will be open


Network settings panel


The green highlighted part is our interest.