If all you want is to see that information for monitoring or a one-off, you can use the bmon
program. It is an interactive network monitoring tool.
You can install it with apt. And then run bmon
in your terminal.
apt install bmon
After it runs, tap the d
key to open the details section and, with the arrows, navigate to your desired interface. The total TX and RX will show up in the left column.
![bmon application](https://i.stack.imgur.com/y8MXN.png)
If you just want to print those 2 numbers and ignore everything else, you run bmon in "format" mode using the following command:
bmon -p 'en*' -o format:fmt='$(element:name) RX:$(attr:rx:bytes) bytes TX:$(attr:tx:bytes) bytes\n'
If you want the current rate instead of the total, you can use
bmon -p 'en*' -o format:fmt='$(element:name) RX:$(attr:rxrate:bytes) bytes TX:$(attr:txrate:bytes) bytes\n'
The -p
option is the policy to filter on interfaces. In your case, you also use it like so: -p enp3s0f1,enp3s0f0
This is how it looks on my system
$ bmon -p 'wl*' -o format:fmt='$(element:name) RX:$(attr:rx:bytes) bytes TX:$(attr:tx:bytes) bytes\n'
wlp3s0 RX:12482795221 bytes TX:5539315984 bytes
wlp3s0 RX:12482795554 bytes TX:5539316211 bytes
wlp3s0 RX:12482795614 bytes TX:5539316324 bytes
wlp3s0 RX:12482800220 bytes TX:5539321022 bytes
^C
You can use other formatting variables to suit your need. You can get the list of available variables by passing help
as a format option.
bmon -o format:help