Tool ethtool
If not, sudo apt-Get install ethtool
Run sudo ethtool eth0 on the terminal
Result 1: (when the network cable is inserted)
P {margin-bottom: 0.08in ;}
Supported
Ports: [tp mii]
Supported
Link modes: 10 BaseT/half 10 BaseT/full
100 Baset/half 100 Baset/full
1000 Baset/half 1000 Baset/full
Supports
Auto-negotiation: Yes
Advertised
Link modes: 10 BaseT/half 10 BaseT/full
100 Baset/half 100 Baset/full
1000 Baset/half 1000 Baset/full
Advertised
Pause frame use: No
Advertised
Auto-negotiation: Yes
Link
Partner advertised link modes: 10 BaseT/half 10 BaseT/full
100 Baset/half 100 Baset/full
Link
Partner advertised pause frame use: No
Link
Partner advertised auto-negotiation: Yes
Speed:
100 Mb/s
Duplex:
Full
Port:
MII
Phyad:
0
Transceiver:
Internal
Auto-negotiation:
On
Supports
Wake-on: pumbg
Wake-on:
G
Current
Message Level: Zero X 00000033 (51)
Link
Detected: Yes
Result 2 ):
P {margin-bottom: 0.08in ;}
Supported
Ports: [tp mii]
Supported
Link modes: 10 BaseT/half 10 BaseT/full
100 Baset/half 100 Baset/full
1000 Baset/half 1000 Baset/full
Supports
Auto-negotiation: Yes
Advertised
Link modes: 10 BaseT/half 10 BaseT/full
100 Baset/half 100 Baset/full
1000 Baset/half 1000 Baset/full
Advertised
Pause frame use: No
Advertised
Auto-negotiation: Yes
Link
Partner advertised link modes: not reported
Link
Partner advertised pause frame use: No
Link
Partner advertised auto-negotiation: No
Speed:
10 Mb/s
Duplex:
Half
Port:
MII
Phyad:
0
Transceiver:
Internal
Auto-negotiation:
On
Supports
Wake-on: pumbg
Wake-on:
G
Current
Message Level: Zero X 00000033 (51)
Link
Detected: No
The result of grep "link detected: yes" can be used to determine whether to insert a network cable.
Write the following code in shell:
Ethtool eth0 | grep "link detected: yes"
Check the output of the above command to see if the network cable is connected.
If the output above is empty, the network cable is not connected.
Else network cable connection is normal.