aboutsummaryrefslogtreecommitdiff
path: root/bin/network
blob: 4565d4b868ea2273f7af4957caf123123767ec23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

file="/tmp/network"
if ! [ -f $file ]; then
    echo 0 > $file
    echo 0 >> $file
fi

tx_prev=$(cat $file | sed 1q)
rx_prev=$(cat $file | sed '2q;d')

cat /sys/class/net/wlp3s0/statistics/rx_bytes > $file
cat /sys/class/net/wlp3s0/statistics/tx_bytes >> $file

tx_now=$(cat $file | sed 1q)
rx_now=$(cat $file | sed '2q;d')

echo "dw: $(((tx_now-tx_prev)/1024))kB/s, up: $(((rx_now-rx_prev)/1024))kB/s"