bash-exercises/recordbandwidth

11 lines
300 B
Plaintext
Raw Permalink Normal View History

2024-11-20 09:29:51 +01:00
#!/bin/sh
init="$(($(cat /sys/class/net/[ew]*/statistics/rx_bytes | paste -sd '+')))"
printf "Recording bandwidth. Press enter to stop."
read -r wait
fin="$(($(cat /sys/class/net/[ew]*/statistics/rx_bytes | paste -sd '+')))"
printf "%4sB of bandwidth used.\\n" $(numfmt --to=iec $(($fin-$init)))