The main tools for Ethtool to check, the main focus on the field of "Link detected", note the following output, where em4 is physically not plugged in the network cable, and EM1 is plugged in:
# Ethtool Em4settings forem4:supported ports: [TP] supported link Modes:10baset/half 10baset/Full 100baseT/half 100baset/Full 1000baseT/half 1000baset/Full supported pause frame use:no Supports Auto-negotiation:yes advertised link modes:10baset/half 10baset/Full 100baseT/half 100baset/Full 1000baseT/half 1000baset/Full advertised pause frame use:symmetric advertised Auto-Negotiation:yes Speed:unknown!Duplex:unknown! (255) port:twisted Pair Phyad:2transceiver:internal Auto-Negotiation:on MDI-X:unknown Supports Wake-on:g Wake-on:d Current message level:0x000000ff(255) DRV probe link timer ifdown ifup rx_err tx_err link detected:no # Ethtool Em1settings forem1:supported ports: [TP] supported link Modes:10baset/half 10baset/Full 100baseT/half 100baset/Full 1000baseT/half 1000baset/Full supported pause frame use:no Supports Auto-negotiation:yes advertised link modes:10baset/half 10baset/Full 100baseT/half 100baset/Full 1000baseT/half 1000baset/Full advertised pause frame use:symmetric advertised Auto-negotiation:yes link Partner advertised link Modes:100baset/Full 1000baseT/Full Link partner advertised pause frame Use:transmit-Only Link partner advertised Auto-Negotiation:yes SPEED:1000MB/s Duplex:full port:twisted Pair Phyad:1transceiver:internal Auto-Negotiation:on MDI-x:on Supports Wake-on:g Wake-on:d Current message level:0x000000ff(255) DRV probe link timer ifdown ifup rx_err tx_err link detected:yes
How to:linux to check if the network card is plugged in by command