SHARE
TWEET

Untitled

a guest Nov 8th, 2012 30 Never
  1. IF=eth0
  2.  
  3. if [ ! -z $1 ]; then IF=$1; fi
  4.  
  5. D=$(grep $IF /proc/net/dev)
  6. RX=$(echo $D | awk  '{print $2}')
  7. TX=$(echo $D | awk  '{print $10}')
  8.  
  9. if [ "$2" != "" -a "$3" != "" ]; then
  10.   RXD=$(($RX-$2))
  11.   TXD=$(($TX-$3))
  12.   RXDK=$(echo "scale=2;$RXD/1024" | bc )" Kb/s"
  13.   TXDK=$(echo "scale=2;$TXD/1024" | bc )" Kb/s"
  14.   echo -ne "D: $RXDK     | U: $TXDK      \r"
  15. fi;
  16. sleep 1;
  17. $0 $IF $RX $TX
RAW Paste Data
Top