How to find speed of wlan interface?
You can use the iwconfig
tool to find this info out:
$ iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"SECRETSSID"
Mode:Managed Frequency:2.462 GHz Access Point: 00:10:7A:93:AE:BF
Bit Rate=48 Mb/s Tx-Power=14 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
If you want the bit rate from /sys
directly try this:
$ cat /sys/class/net/wlan0/wireless/link
51
Or from /proc
:
$ cat /proc/net/wireless
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 56. -54. -256 0 0 0 0 0 0
NOTE: The value for the link in the 2nd example is 56, for e.g.
I believe the MB/s is a calculated value, so it won't be stored anywhere specifically for the wlan0 device. I think it's taking the aggregate bits transferred over the interface and dividing it by the time it took said data to be transferred.
One additional way to get this information is using the tool iw
. This tool ew nl80211 based CLI configuration utility for wireless devices. It should be on any recent Linux distro.
$ iw dev wlan0 link
Connected to 00:10:7A:93:AE:BF (on wlan0)
SSID: SECRETSSID
freq: 2462
RX: 89045514 bytes (194863 packets)
TX: 34783321 bytes (164504 packets)
signal: -54 dBm
tx bitrate: 48.0 MBit/s
This also shows the amount of sent and received packets (RX/TX).
The approach by slm is wrong, the data rate shown by iwconfig
is the max speed supported by the interface for the link. It's not the current at which data is transferred. Use the /sys/class/net/<interfacename>/statistics/<tx/rx>_bytes
file to get per interface bytes transferred live.