Inspect speed in /sys/class/net
In addition to using commands like ethtool
, you can also find information about network interfaces directly in the Linux filesystem, specifically within the /sys
directory. The /sys
filesystem provides an interface to kernel data structures.
Network interface information is typically located under /sys/class/net/
. Inside this directory, you'll find subdirectories named after each network interface on your system (e.g., eth0
, lo
).
To find the speed information for your primary interface (which we identified as eth0
in the previous step), you can look inside the /sys/class/net/eth0/speed
file.
Open your terminal and use the cat
command to view the content of this file:
cat /sys/class/net/eth0/speed
Press Enter.
You should see a single number as the output, representing the link speed in megabits per second (Mb/s).
1000
This output confirms the speed of the eth0
interface is 1000 Mb/s, matching the information we saw with ethtool
.
This method of checking the speed by reading a file in /sys
is useful because it doesn't require installing any extra tools like ethtool
. It's a direct way to access information that the kernel makes available.
Remember that the path /sys/class/net/eth0/speed
assumes your network interface is named eth0
. If your interface has a different name, you would replace eth0
with the correct name.
You have now learned three different ways to get information about your network interfaces and their speed!
Click Continue to complete this lab.