Which driver is my eth0 using?

Danny made a cool cmd line to find out the driver a specific network interface is using:

ls -l /sys/class/net/eth0/device/driver/|grep module|awk -F "/" '{print $NF}'

Then I thought, why trust the ls output.. Then I found the /usr/bin/readlink command, so:

readlink /sys/class/net/eth0/device/driver/module|awk -F "/" '{print $NF}'

Now, I hate awk, so why not use basename:

basename `readlink /sys/class/net/eth0/device/driver/module`

/sys is cool.

Leave a Reply

Your email address will not be published. Required fields are marked *