To find out the duplex mode and speed of a network interface on a Linux machine, you can use the ethtool command. This command can be used to display and modify the Ethernet device settings.
To display the current duplex mode and speed of an Ethernet interface, you can use the following command:
ethtool INTERFACE
Replace INTERFACE with the name of the interface you want to check (e.g., eth0). This will output information about the interface, including the duplex mode and speed.
For example, the output might look like this:
Settings for eth0:
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: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Current message level: 0x00000007 (7)
drv probe ifdown ifup
Link detected: yes
In this example, the interface is operating at a speed of 1000Mb/s (1 Gb/s) in full duplex mode.