Playing around with some low level functions to monitor my system stats.

I would like to get the current network utilization the same way like I can get cpu temp

cat /sys/class/thermal/thermal_zone0/temp

or fan speed

cat /sys/class/hwmon/hwmon6/fan1_input

Looking at


I didn't find a way to see the actual bandwidth consumption, rx_bytes just gives the total amount of data downloaded.

  • You want to monitor the traffic in B/s?
    – Quasímodo
    Aug 17, 2020 at 19:39
  • Yes thats what I want. Aug 19, 2020 at 9:26

2 Answers 2


To get the rate of B/s, no need of anything but your shell: Simply read rx_bytes file at each second and compare the current value with the value one second before.

rx1=$(cat /sys/class/net/wlp3s0/statistics/rx_bytes)
while sleep 1; do
    rx2=$(cat /sys/class/net/wlp3s0/statistics/rx_bytes)
    printf 'Download rate: %s B/s\n' "$((rx2-rx1))"

Of course, substitute wlp3s0 by the interface you want to monitor.

  • thats a nice little trick, will try it, thanks Aug 20, 2020 at 10:24

The Linux kernel doesn't keep track of the temporal network interface stats - you have to calculate the values by yourself.

There are multiple utilities and applications which do that for you, including Gnome System Monitor if you're a Gnome user, then KDE has KSysGuard/Plasma Network Monitor/KNemo and many others.

  • ok this means I cannot avoid using one of the "bloated" tools - I really liked the idea of using the lowest level command to keep workload at minimum, similar to the already mentioned methods. Aug 17, 2020 at 17:11
  • 1
    Speaking of bloat, there are console utilities to monitor network utilization as well: iftop, ifstat, nload, bmon, iptraf, cbm, bwm-ng, speedometer, netload, dstat and many more. Aug 17, 2020 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.