The interface stats are located in /sys/class/net/interface_name/statistics/
collisions
multicast
rx_bytes
rx_compressed
rx_crc_errors
rx_dropped
rx_errors
rx_fifo_errors
rx_frame_errors
rx_length_errors
rx_missed_errors
rx_over_errors
rx_packets
tx_aborted_errors
tx_bytes
tx_carrier_errors
tx_compressed
tx_dropped
tx_errors
tx_fifo_errors
tx_heartbeat_errors
tx_packets
tx_window_errors
rx stands for received packets
tx stands for transmitted packets
[root@archlinux ovi]# cat /sys/class/net/wlp2s0/statistics/tx_packets
8034
[root@archlinux ovi]# cat /sys/class/net/wlp2s0/statistics/tx_packets
8036
[root@archlinux ovi]# cat /sys/class/net/wlp2s0/statistics/tx_packets
8045
[root@archlinux ovi]#
The differences are noticeable and the output was captured every 1 sec.
I can create a simple script as well to check the stats.
#!/bin/bash
INTERFACE=$1
echo "Listening $INTERFACE..."
while [ 1 == 1 ] ; do
RX=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
TX=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`
echo "Received: $RX B/s Sent: $TX B/s"
sleep 1
done
[ovi@archlinux ~]$ ./nettool wlp2s0
Listening wlp2s0...
Received: 542819023 B/s Sent: 31408529 B/s
Received: 542819089 B/s Sent: 31408615 B/s
Received: 542819448 B/s Sent: 31408701 B/s
Received: 542819448 B/s Sent: 31408701 B/s
Received: 542819448 B/s Sent: 31408701 B/s
^C
[ovi@archlinux ~]$
Change 'sleep 1' to other values, for example 5 to get a 5 seconds delay.