ethernet port in Linux?

$ ethtool <eth?>

For example:

$ ethtool eth0

provides:

Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000001 (1)
        Link detected: yes



Check /sys/class/net/eth0/operstate and other files in this directory

ifconfig dev_name

or

ifconfig -a


dmesg | grep eth
 

You can also use mii-tool to see if the link is up and check the negotiated speed.

# mii-tool
eth0: negotiated 100baseTx-FD, link ok

 

If your system is using ifplugd (e.g. on a Raspberry Pi with Raspbian) then you can use the associated status tool ifplugstatus to obtain the link status of all interfaces:

ifplugstatus
or a specific interface (e.g. eth0):

ifplugstatus eth0