Created
February 28, 2020 09:26
-
-
Save rewida17/28411df201d5aa2343f3c231abea593d to your computer and use it in GitHub Desktop.
interface stats based on /sys/class/net/eth0/statistics/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
a="$(cat /sys/class/net/eth0/statistics/rx_bytes)" | |
b="$(cat /sys/class/net/eth0/statistics/tx_bytes)" | |
rx="$(echo "scale=3;$a/1024^3"|bc)" | |
tx="$(echo "scale=3;$b/1024^3"|bc)" | |
sum=$(echo "scale=3;$rx+$tx"|bc) | |
printf "\n\e[41mETH0_STATS:\e[0m \e[42m RX: $rx GB TX: $tx GB Su: $sum GB\e[0m\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment