rxtx-stats.ion 475 B

1234567891011121314151617181920212223
  1. #!/usr/bin/ion
  2. # This script will print the current RX and TX statistics of each
  3. # network interface on Linux, minus the loopback interface.
  4. for interface in /sys/class/net/*
  5. let name = @split(interface, '/')[4]
  6. if test $name = "lo"
  7. continue
  8. end
  9. let tx = $(cat $interface/statistics/tx_bytes)
  10. let rx = $(cat $interface/statistics/rx_bytes)
  11. let tx /= 1048576
  12. let rx /= 1048576
  13. echo "$name
  14. RX: $rx MiB
  15. TX: $tx MiB
  16. "
  17. end