I have tried to make script which can help me to output info about received and transmitted data on specific interface. Here is the beginning stuff of it:
#!/bin/bash
interface=$1
while true; do
ip -s link ls $interface | awk '{ print $1 "\t" $2}'
sleep 10
done
But also I want to get the difference of changes in data.
I haven't the faintest idea how to output it. So for i.e. I get this from my script line ip -s link ls $interface | awk '{ print $1 "\t" $2}'
:
2: enp0s3:
link/ether 08:00:27:ad:a6:53
RX: bytes
38134 399
TX: bytes
34722 247
I want to get the difference between 38134
and 34722
and then the difference between 399
and 247
and add to some file for example.