Check what the active network interface speed is on Linux

Category: linux, year: 2020

Linux command to print out the active speed (in MBit/sec) of the primary (IPv4) physical network interface (non-wireless).

ip -o -4 route show to default | awk '{print "/sys/class/net/"$5"/speed"}' | xargs cat

Note: this won’t work for wireless interfaces, and virtual interfaces (i.e. many VPSs) will incorrectly show -1 for this, it’s only reliable for reporting on physical network interfaces.


Tags: linux network


Archive
Full Index

linux (4)
cpp (3)
rust (2)
macos (1)
matplotlib (1)
unix (1)


Tags List