Check the physical status of an ethernet port in Linux

Written by
Date: 2012-07-11 17:04:42 00:00


It is usually not a problem to check the physical status of an ethernet port in any computer. You just need to see the led in the ethernet card itself, or check the led in the switch where the other side of the utp cable is connected.

But, what happens when you are trying to check the status of an ethernet port, in a remote Linux server. Once again this is an easy task.

cat /sys/class/net/eth0/carrier

Replace eth0 by the correct name of your interface.

The result will be either 0 or 1, 0 if disconnected and 1 if connected and carrier on.