To get the Ethernet link speed in macOS through the command prompt, you can use the netstat
command with the -I
option.
To get the Ethernet link speed, open a terminal window and run the following command:
netstat -I en0
Replace en0
with the name of your Ethernet interface. You can use the ifconfig
command to list the available network interfaces on your system.
The netstat
command will display information about the Ethernet interface, including the link speed in megabits per second (Mbps).
For example, the output might look something like this:
Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll Drop en0 1500 link#4 a4:5e:60:f7:fd:e2 105836 0 168869897 132065 0 133424012 0 0
In this example, the Ethernet link speed is 1500
Mbps.
It's worth noting that the netstat
command may not display the link speed if the Ethernet interface is not currently connected to a network. In this case, the link speed will be displayed as 0
Mbps.
To get the Ethernet link speed automatically at regular intervals, you can use the watch
command to run the netstat
command every few seconds.
For example, to get the Ethernet link speed every 5 seconds, you can use the following command:
watch -n 5 netstat -I en0
This will run the netstat
command every 5 seconds, displaying the updated Ethernet link speed each time.