Just to build up on what ferrari correctly advised, I'll post outputs for the ip command so that you see how you will identify the connected NIC.
I have only one NIC but you'll spot the difference easily.
When network cable is connected:
Code:
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 3c:xx:xx:xx:xx:49 brd ff:ff:ff:ff:ff:ff
When network cable is disconnected:
Code:
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 3c:xx:xx:xx:xx:49 brd ff:ff:ff:ff:ff:ff
Spot the NO-CARRIER and state DOWN?
