Statistics on high-speed network traffic and Linux traffic in linux
Netpps. sh counts the data volume per second, including receiving (RX) or sending (TX)
Netpps. sh eth0
#! /Bin/bashINTERVAL = "1" # update interval in secondsif [-z "$1"]; then echo usage: $0 [network-interface] echo e.g. $0 eth0 echo shows packets-per-second exitfiIF = $1 while truedo R1 = 'cat/sys/class/net/$1/statistics/rx_packets 'T1 = 'cat/ sys/class/net/$1/statistics/tx_packets 'sleep $ INTERVAL R2 = 'cat/sys/class/net/$1/statistics/rx_packets 't2 = 'cat/sys /class/net/$1/statistics/tx_packets 'txpps = 'expr $ T2-$ T1 'rxpps = 'expr $ R2-$ R1 'echo "TX $1: $ TXPPS pkts/s RX $1: $ RXPPS pkts/s "doneNetpps. sh
Netspeed. sh describe the receiving (RX) sending (TX) bandwidth in Network Transmission
Netspeed. sh eth0
#! /Bin/bashINTERVAL = "1" # update interval in secondsif [-z "$1"]; then echo usage: $0 [network-interface] echo e.g. $0 eth0 echo exitfiIF = $1 while truedo R1 = 'cat/sys/class/net/$1/statistics/rx_bytes 'T1 = 'cat/sys/class/net/$ 1/statistics/tx_bytes 'sleep $ INTERVAL R2 = 'cat/sys/class/net/$1/statistics/rx_bytes 'T2 = 'cat/sys/class/net/$1 /statistics/tx_bytes 'tbps = 'expr $ T2-$ T1 'RBPS = 'expr $ R2-$ R1 'tkbps = 'expr $ TBPS/1024' RKBPS = 'expr $ RBPS /1024 'echo "TX $1: $ TKBPS kb/s RX $1: $ RKBPS kb/s "doneNetspeed. sh