Determine Active NIC address using python console commands
问题 I am trying to find an active NIC, an active NIC is one where the command wil return UP for me. In my command: # cat /sys/class/net/eth0/operstate I am returned a value of UP In another command, I type: # cat /sys/class/net/eth1/operstate I get a value of DOWN Overall I have 4 eth's. I basically have to use the command to determine UP or DOWN /sys/class/net/eth[0|1|2|3]/operstate = up | down I want to be able to write a program where I will be able to return the eth[0|1|2|3] value that is UP.